Function names as signaling

In most web applications there’s a host of functions (or methods if speaking in the object-oriented world). It’s widely recognized, that it’s probably a good idea to name them something, which may suggest the purpose or functionality of what the function is doing, but often developers seem to fail at making a stringent naming convention. Before starting on your next big development adventure, here are a three suggested rules for naming functions.

Bread crumbs in version control

I’m sorry but sometimes I really don’t get why even seasoned developers doesn’t learn the art of the commit message in version control system. All too often I’ve come across check-ins where the entire commit message just reads “bugfix”, “change”, “oops” or something just as mindless.

The effort of writing a useful message compared to the potential benefit seems to be one the best ratios - but of course the pay-back is usually some time away - too bad. Once you work on the same code for years - or even better inherit code from others, you’ll quickly learn to appreciate anyone who used more than 10 seconds on composing a thoughtful message for the future.

PHP best practice: Function Parameters

I’ve been developing web applications for some years now, and while I make no claims to being the world greatest developer, I do figure, that I do have some solid experience which may help others

  • or at least encourage thoughts and discussion. This is the first in a series of posts, and while it may be from a PHP developers point of view, it may applicable to other programming languages, and maybe even beyond web applications. Here are my four tips on function parameters.

Always have a default value on all parameters

Functions parameters are often used as input to SQL queries, calling webservices or computations. Null or non-existing values often tend to break these things and throws horrible messages to the end-user.

Build-in time bombs

I’ve been refactoring and refactoring some old code, and it’s kind of odd what short-cuts (or even time bombs), you’ll find in code, which apparently wasn’t supposed to live on for years. In a now retired CMS system, we had an issue every new year, when some kind of bug would reset all “schedules” for upcoming stories and content. No-one ever got around to fix it, as the system was soon to be decommissioned - but sadly the bug did survive a few years anyway.

Roaming todo-lists

I’ve been exploring todo lists for a while, but so far not found the ideal solution. I did however get a mighty step closer after Schack told me about a firefox plugin called Quickfox Notes.

Before introducing Quickfox notes, let me spend a second on my daily workflow in broad terms. I usually have Firefox running 8+ hours a day. Either browsing the web, doing web development or just by habit. I work on several machines - A few Linux laptops and an iMac at home. As I use several machines, I’ve been a huge fan of bookmark synchronization. I tried Mozilla Weave for a while, but their lack of PowerPC support (on an other Mac), eventually made me switch to FoxMarks - which is now called Xmarks. Xmarks has worked flawless since day one, and it’s one of the very first plugins I always install along with firefox on any machine I use.