Wednesday, August 28, 2013

Programming by Word Association




A friend of mine recently told me about a conversation he had with a junior developer.

The developer was having trouble with a how a file was being read by Java. After being read by Java, the file was being parsed and used as in an HTTP post to  URL. My friend suggested he try changing the file encoding to see how it would be read.

The developer sent back his code and my friend struggled to find the changes. Finally he noticed that the developer had found a method named URLEncoder and tried to use that.

I shouldn't need to tell you that this wasn't the correct solution, but it highlights the need for curiosity in computer science. If  developer had a little curiosity to ask, "What's file encoding?" Or to read the documentation for URLEncoder he would have quickly realized he wasn't moving in the right direction.

Instead he decided to program by word association. Sometimes this strategy works, other times, it can land you in a lot of trouble.

As a programmer you should always be curious. You should always ask, "Does this actually work the way I think it does? Does it always do what I think it should do?" And always read any documentation you have available (It's rare enough to find, you'll eventually get excited when you do find it).

In summary, be this guy:


No comments:

Post a Comment