I’ve been spending quite some time the past days digging around in old code (3+ years old with no or very little changes). It’s quite fun noticing what efforts pay off and which doesn’t when you go back to make chance to old stuff. I’m sure my observations aren’t generally applicable. We’re web developers and are keeping web platform (several pretty big websites on a common codebase) alive year after year.
It seems many developers get stuck in the same systems maintaining the same code for years and years. While it may be a common phenomenon there are a few things you can do as a developer to avoid being trapped in your own code forever.
First make things readable. While your brain may be wired to a system of only using single character variable and function names or naming global variables after your cats, no one else will get the system.
At work we produce a few websites and have a few “web dashboards”. Wouldn’t it be nice, if public screens around the office could play a little loop mixing the websites and the dashboards together in a slideshow loop?
After an hour of javascript debugging, a nice little generic webpage slideshow was put together, and if you have a similar need a copy is now available in the lab. It’s simple, it should work in most browsers, and it probably has the least features of any slideshow out there.
Not all code are created equal. Some pieces of code are more important than others. The code that powers critical parts of a nuclear power plant is hopefully of a much higher standard than the code behind this site, but how do you recognize which quality of code you should aim for when developing websites?
A website may not have one set level for all content - usually the various pieces which make up the site (no matter if it be classes, files or functions - in PHP).
One of the great challenges of PHP is that it’s so easy to learn, that just about anyone can learn it with not too much of an effort. While this is great for the number of PHP developers, it also seems to have the effect, that there is a huge number of bad examples of code out there. How do you then know good code? In my book there are a few signs, which you could judge from – and they may even apply broader than just php-code.