New Perspectives On Web Design

(C. Jardin) #1
By Nicholas Zakas CHAPTER 2

Chapter tWO · by niChOlas ZaKas

wRiTing MainTainable,

fuTuRe-fRienDlY CoDe

hether you learned how to write code in school or on
your own, it’s unlikely that you learned one of the strange
truths of computer programming: most code is a mess.
I remember thinking when I was young that massive websites must have
the most unbelievably clean yet complex code running them. When I
joined Yahoo!, I found that the code running some of the world’s most
popular websites looked strikingly similar to the code running my person-
al blog. The truth is, code is code no matter where you go, and code has a
tendency to get messy as it gets large and old.
Unfortunately, developers are rarely taught how to deal with messy
code. The most common response is to rewrite everything from scratch.
Yet doing so gives you only a moment of peace as this code very quickly
starts to become messy as well. Things start to break, you find it hard to
figure out why bugs are occurring, and there are parts of the codebase that
seem to be “magic” (a term I use when nobody understands how a piece of
code works).

W

Free download pdf