Software Engineering

Code archeology

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.

Code exit strategy - 3 tips

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. Try to make all names as logical as you possible can. Making it easy to read the code

Simple Webpage Slideshow

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.

Quality of code

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). On the level you’re looking, let me suggest, for each piece you judge the required (minimum) quality on two simple parameters:

How do you know good code?

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.

Caching & WebApplications

One of the funny observations as a web developer: It’s amazing how many people consider caching bad by definition. If you know what you’re doing, caching is an amazingly powerful tool, which can provide cheap and efficient scaling to those who know how to use it.

Know when it’s okay to cache

If thousands of people see the same non-personal frontpage of your website - do you then do the 20+ database queries to build a fresh one for each visitor or do you just refresh a cacheable version from time to time?

Tip a friend - not so simple

Many online sites such as news-sites and other content providers often have a “tip a friend” option. With this you can mail a friend and tell them about an interesting piece of content you’ve found. The Idea seems quite simple, and everyone should have the tip-option, wright? - no, wrong. While it may offer a convenience for some, it has several backsides.

First if you - or your email provider - has implemented anti-spam techniques such as SPF-records, the “tipping mail” will not be sent through the authorized list of mail-servers and thus have a larger likelihood of being labeled as spam. Your mail be sent, but you don’t know if it will arrive in your friends mailbox.

The case against tags

To every modern web 2.0 site offering tagging seems to be an absolute requirement. While I may agree, that tagging in some cases may offer some improvements in content navigation over many other points, I do think it’s been too abused in way to may cases.

Tags on sites such as Flickr and Del.icio.us are absolutely fantastic. They offer some cross navigation options, which would probably be near impossible, if not for the tags. I often find my self exploring links though del.icio.us, since the content stored there generally seem to be of a muh high quality than a simple Google search on a common term.

Checking requirements for PHP Applications

A great strength in PHP is that it’s so accessible, that almost anyone can get access to a PHP site and often will download “applications” for their site such as discussion boards, photo galleries and others. While it may easy to download such applications, it often happens that the people trying to get things to work, doesn’t read the requirements section of the install.txt or readme.txt file, and thus never get the application running and doesn’t understand what the problem was and how to fix it. This is a brief guide with some tips on how to improve usability in this area.

No comments

The option to leave comments on this site has now been disabled. A new version of the website is coming and the pain comments – from time to time – causes with movable type (in terms of comment spam, server load and likewise issues) is really not worth the trouble. You will quite possible be able to leave a comment once the new version is launched, but until then sorry, no comments.