New Perspectives On Web Design

(C. Jardin) #1

CHAPTER 2 Writing Maintainable, Future-Friendly Code


implementing their own designs due to a lack of on-the-ground, in-the-
trenches perspective.
Truth be told, there are architects who fit that description, but good
architects are priceless commodities who increase the value of an entire
organization through their high-level vision and perspective. Such vision
and perspective transform an architecture.
The role of architecture is overlooked in many places when it may be
the most important part of software. A robust architecture:


  • Provides easy ways to complete common tasks.

  • Ensures everything has a place and a purpose.

  • Allows us to quickly add or augment functionality.

  • Encourages good software design.


Most of the horribly unmaintainable code I’ve come across in my career
could be traced back to a lack of good architecture. Without such structure,
we get confused about where and when to make certain changes. When
that happens, we end up hacking solutions where they don’t belong and
that starts a downward spiral of code quality. Anytime someone can’t an-
swer the question “Where does this go?”, it means that code ends up in an
unexpected location and that, in turn, perpetuates the problem.
Code has a habit of multiplying when you’re not looking. If there is
when the component was recently one way of doing something in the
codebase then there will quickly be two instances of that same pattern. Two
leads to four, and it continues until that pattern has permeated the entire
system. This happens when developers look for examples of how others
have achieved certain functionality. When they find an example, it gets
copied into another place for a similar purpose. If the pattern is good, then
you’re getting a desired result; if the pattern is bad, then your code becomes
less maintainable as you go.
That’s why the best architectures have a place for everything.
Whenever you need to make a change or addition, you know exactly
Free download pdf