Posted on 2 Comments

Today’s Programming Advice – Code for the impossible

Always code for the impossible case! The impossible tends to happen surprisingly often. The programming language is irrelevant. Whether you code in C, C++, F#, ColdFusion, PHP, JavaScript, or whatever, conditional statements and case statements should always accommodate the unexpected value.

Right now I am dealing with some code that involves a list of 1 or more items. The actionable part of the code involves clicking on one of the items in the list therefore at least 1 item must exist. Having zero items is impossible because if there were no items then I could not click on the item to start the actionable part of the code. So why waste time coding of the zero items case? This is not the best example since this is a multi-user, client/server web application and the zero case can be created quite simply by having two users pull up the same list and then one user deletes an item before the other. But that answers the question of why waste time coding for the impossible? Because it does happen. My code frequently has conditional statements that end with a default case or a special case that simply outputs "This is impossible. Please contact the administrator." and includes some debugging information. In my career, doing this has saved me hours and hours of debugging time on more than a couple of occasions.

Posted on 3 Comments

I’m moving to France!

This probably isn’t safe for work. The New York one has a bit of a disturbing aspect to it. The France one feels more fun.

Thank you Internet!

(Apparently this happens in New York too Seen at Synthtopia)

Update: Jon found an interview on Pitchfork with the co-directors (Taylor Cohen and Otto Arsenault) and stars (Matt and Kim). Don’t forget, France has healthcare!

Update: Some links- Make the Girl Dance MySpace page, Make the Girl Dance blog, and the unofficial Matt and Kim video.