Archive for the ‘Programming’ Category

Don’t Forget to Ask Why

Thursday, February 4th, 2010

As programmers we are constantly  worrying about the ‘hows’ of things.

  • How am I going to make this function faster?
  • How can I write this query without joining 16 tables?

More often than not though, when writing code we forget to ask the really important question, WHY?  We take instructions from our clients and users and immediately get to figuring out ‘how’ we’re going to make it work.  We plan out how we are going to set the IDs for our DIVs and whether or not we want to use jQuery to make it work.  We get so excited to dig in and start writing code that we forget to ask that critical question to figure out why we need to write it in the first place.  Perhaps the reason that your client is asking to change the colour of a block of text is actually because the page layout doesn’t make sense for the situation.  Maybe they think a help button is needed next to your feedback form because your form labels aren’t making it clear what you’re asking for.

Sometimes the answer to ‘Why?’ will be an unjustified ‘Because that’s the way I want it to be.’ The thing is that is totally OK, at least you asked the question. There will be plenty of other times where the answer will reveal a deeper issue, and it’s sometimes even easier to fix those instead of making the change that was requested.  Which as a programmer, should appeal to your genetic desire to get more done by doing less.

So go ahead, the next time you get a change request, ask why, the answer may surprise you.

Diving into iPhone development

Saturday, July 4th, 2009

After many long months of decision making and cash saving, I have finally decided to dive head first into the wonderfully complicated world of iPhone application development. It is something that I’ve had in the back of my mind since I first got my iPhone almost a year ago, but at the time with my wedding and everything I wasn’t in the market to get myself started.

The first step on this journey involved me purchasing my first Mac ever, the 13″ Aluminum MacBook. I was tempted to go with the Mac Mini instead, however for the money the MacBook just offered too many advantages.

I have to admit, after giving it an honest shot, I’m really starting to like how OS X does things. It definitely isn’t perfect but it is a refreshing change for somebody who has been looking at a Windows desktop for the last couple years. The mental workflow took some getting used to, though I’m now feeling nearly as comfortable on my Mac as I do on my Windows machine, with only a couple of exceptions that I don’t need to get into during this post. Maybe some other time.

So far I have really liked the Xcode development environment as well, like everything else on the Mac, it just takes some getting used to. Before you know it everything just makes sense. Even though I’m sure there’s a ton of stuff included in Xcode, it all sort of hides in the background instead of being right in my face and adding to the confusion. I was able to build and execute a simple iPhone simulator app very quickly without having to resort to a tutorial.  I’ll admit that was a pretty exciting moment for me!

I still have an absolute TON of things that I need to learn before I start releasing stuff on the iTunes App store, but I’m going to do my best to document what I learn as I go.  I’ll also try to point out any useful resources that I find along the way.  I’m sure there will be plenty of surprises, it’s all very exciting!

Wish me luck!  Hopefully I don’t suck at this…

‘Synchronous AJAX’ or SJAX for Short

Saturday, January 27th, 2007

We had a problem at work the other day, we had a piece of JavaScript code that was making an AJAX style web server call, unfortunately other UI elements on the page required the results of that call to be available before the user attempts to use them. I tried searching the web for all sorts of things, ’synchronous ajax,’ ‘ajax wait for response’ etc., leading to many explanations of the differences between asynchronous and synchronous requests, but no indication on how to do a synchronous request.

Finally, by looking through the JavaScript documentation for the XMLHttpRequest object and discovered that by simply adding an additional ‘false’ parameter to the normal http.open() call it forces the XMLHttpRequest object to run in synchronous mode. Exactly what we were looking for!

Here is an example: xmlhttp.open(“GET”, url, false);

This solved our problem completely, but since it was a difficult solution to find I figured I would post an example here in hopes of spreading the word of this useful tool.

Hope that helps!