Saturday, December 6, 2008

Coding for the Weekend

Sometimes I feel like I'm not living up to my potential as a programmer. All too often I find myself wishing that I were in a situation where I would be expected to write better code. I feel like there is still so much for me to learn, but I've somehow missed the boat.

I've got a pretty good job. I'm glad to have it and I've got some terrific co-workers. The trouble comes in two flavors. Our company has deep seated custom of doing what is needed at the moment without planning ahead. Being flexible is one thing, but we spend days and days resolving problems which could have been fixed by planning and writing the right code in the first place.

The other trouble I find is a bloated Frankenstein's monster which we dubiously call our legacy code. It is patched together into a terrible tapestry. Some pieces are wonderful gems of ideas and well-written code. But for every pleasing morsel there are seemingly dozens of fetid carcasses. And they are all tied together. Nothing is separated, all is unclean. I cringe at some of the security issues that are just glossed over.

I realize that this scenario isn't exactly uncommon. But the combination of the two problems (at least from my perspective) leaves me in a place I do not want to be. I find myself doing a lot of mediocre work just to get the job done. I never feel like I'm taking ownership of my code, as the kids say. But I can't justify taking the time to fix many of these problems. Those kind of decisions are not part of my job description.

But there are a few rays of light that peek through the dark clouds from time to time. We have a relatively new manager who seems to value most of the software practices that I do. I'm hoping that eventually he will be able to change things. And I always look for little places where I can write better code.

I'm trying to keep abreast of many best practices and new ideas, but it can be difficult. One issue that I worry about is that I have little to no work experience with things such as:

  • Unit testing (let alone having a testing group / phase!)
  • Development life-cycles (Agile, XP, Waterfall, etc.)
  • Design and documentation
  • Code reviews

So I'm trying to learn on my own and incorporate things into my work as best as I can. But my recurring lament is the lack of time for working on my own projects. I'd like to participate in some open source projects and work on my own projects. But they always get pushed to the back-burner.

So I guess for now I'll just keep plugging along like good ol' Charlie Brown. I'll try to do the best I can, but I know that there will still be many days where I'm still coding for the weekend.

Saturday, November 29, 2008

Thankful

As I've enjoyed this Thanksgiving holiday weekend, I have had time to reflect on many things for which I am grateful.

The first and most important thing I am thankful for is my beautiful wife. She is amazing. There is never a day that goes by where she doesn't do something for me. Some days it is wonderfully new. Other times it is just the multitude of little things. But every day she lets me know that she loves me. And I love her too.

I am grateful for my family. On my side of our family, I have people whom I have loved all my life. I have an adorable little nephew. On my wife's side, I have people who have taken me into their homes and lives.

I'm grateful for our home, our cars, and our jobs. Although sometimes expenses or frustration can cloud my view, when I stop and survey what I have, I am content.

There are so many things I am grateful for. Some are small things like playing Rock Band or watching a movie. Tasting delicious food. Or just sleeping in under a warm blanket.

Sometimes the holiday season can feel cliché, but I am genuinely thankful for the reminders the season provides for me.

Saturday, November 15, 2008

Opportunity

They say that one should be ready for when Opportunity knocks. I thought I was. But he is elusive, and is known to be a consummate doorbell-ditcher (albeit he knocks rather than rings). I flung the door wide open and saw him there.

He seemed a bit startled to see me. I think the door opening so quickly had caught him by surprise. I motioned for him to come in. He hesitated. I reached out to grab him. He bolted.

It was sad to see him go. But I'll be ready for him when he comes around next.

Saturday, November 8, 2008

"Mr. Spock, scan that book!"

I am not exactly sure what started it, but recently I have been in the mood to be reading again. I have not done much reading for my own enjoyment since before I graduated from college. I suppose you could say that I've been busy doing other things. I have certainly gorged myself on a virtual buffet of video games and DVDs. But I feel like I should be reading more. So I eventually got around to it.

Typically the biggest challenge I face regarding reading comes (ironically) before I even set my eyes on a page. I have trouble choosing a book. For some reason or another, the selection process hampers my progression until I strongly resemble The Thinker -- complete with a stony expression.

However, this time around I had a helpful jump start. I've been listing to the Security Now Netcast and they recommended an author by the name of Michael McCollum. I've always been a big sci-fi fan, so I wandered over to his site and checked it out. As I read some of his short stories, I felt the electricity start to flow. Pretty soon my engine turned over and started running on its own. I was ready to really start reading again.

Now I just need to get my hands on some books. I looked on my shelf, but only found a lonely handful of novels. Only one of them was science fiction. My wife has a few... but no science fiction. So I devoured the single Star Trek book over this weekend. My goal this week is to get my hands on a few more books to read.

Another influence for reading that I've had has come from my work. Occasionally my co-workers will talk about the books they are reading. Then one of them invited me to try out a site called Goodreads which is sort of a social networking site about books. So if any of my friends out there are on it, or choose to try it out, let me know what you think. Currently I'm using it to cull a list of books to read.

I'm excited about reading again. It seems like a good thing.

Wednesday, October 8, 2008

The Goliath Says, "Comm-link Online."

Last week I decided to test the waters at my work concerning instant messaging. When I started my new job I was told that instant messaging was discouraged, but that our department had been cut some slack. I was given the impression that it would probably be alright for me to use one.

But I chose not to. I thought that as a new employee, I didn't want the first impressions I would make to be exploring the edge of what was allowed. Also, I thought it might be good for me to focus on getting to know the new job. So I decided to wait.

Fast-forward to last week. Coming off a busy week of putting in extra hours, things seemed slow and laid-back. Plus management was gone on a retreat, so things were really quiet. I installed my IM client.

I chatted with a couple friends. It was really nice to be able to communicate again. Especially since some of them are people whom I rarely see in person. And it was nice to see the list of friends there and know that I could chat with them, if I wanted to.

But somehow I didn't feel quite satisfied. Being plugged back into my psychic-like connection wasn't all that I thought it would be. And in the back of my mind, I felt a nagging doubt start to grow. What if this is not okay? What if I get in trouble?

So since having installed the client, I've only been on intermittently. This morning I asked my manager about it. He said it should be fine, just keep it on the down-low. Phew!

I'm back.

Saturday, September 13, 2008

Crashing More Than Just Castles

With the recent release of the game Castle Crashers, there has been some controversy about bugs in the game. This has led me to think about the difficulty of programming.

This topic has been exacerbated by a recent event at my work. I've been learning how to do iPhone/iPod Touch application development. It is really interesting. It's also very nice to be learning something new. Development has been going really well, but then yesterday I hit a nasty problem. The program is crashing due to a memory issue I cannot find. (For those interested: somewhere something is trying to free an object which has already been freed.)

I spent several hours wrestling with this problem. The debugger was of no help, nor were the tools for tracking objects and memory leaks. I tried all of my usual techniques, but just couldn't find the problem. After I had spent an extra two hours at work, I decided that the best thing to do would be to go home. On Monday I plan to go back and take the component completely apart and start from scratch. Very annoying.

There is a tried and true method for fixing really confounding problems like this, and I'm hoping that it will work in this case as well. The method is this:
  • Go home.
  • Get some sleep.
  • Get the problem out of your head for a while.
  • Go back and take a fresh look at it.

I am sometimes amazed at how complex programming can be. Computers are complicated enough to begin with! After taking a class in which we built an 8-bit computer from CAD tools, I often think it is a miracle that computers work at all! Then on top of that you add OS software, all sorts of libraries, and your own code... there are many layers.

Unfortunately, one of the truths of programming is that there will be bugs. For non-trivial programs, it is asymptotically hard to find and fix all the bugs in a program. Luckily, like a squeaky wheel the worst bugs usually reveal themselves and are subsequently fixed.

But despite the many bugs and occasionally rip-out-your-hair problems, I love programming. It is a euphoric experience to be able to see the results of well-written code.

P.S. Castle Crashers is a great game!

UPDATE: I figured out the problem with my iPhone program and had it fixed within an hour of showing up to work. Like I said, tried and true.

Tuesday, August 26, 2008

With a Ph.D. in Horribleness



A few weeks ago I found a little gem that you may have heard about: Dr. Horrible's Sing-along Blog. I realize that I'm late to the party of telling everyone about how great it is, but if you somehow haven't seen it yet then click that link already!

Seriously.

This blog will still be here when you're done.

Dr. Horrible is a great example of how to tell a story. It really just gets in there, tells the tale, and then is done. And it doesn't hurt to have some clever humor either. It really helps establish an opinion of mine which I've held for some time (and I believe I've written about it a little before) which is basically this:

A good movie (or show in this case) is mostly determined by the writing and storytelling rather than special effects, attractive actors/actresses, or other gimmicks.

(By the way, I'm a fan of the old-school way of calling them actresses instead of actors... although heroine can be kind of a problem.)

There are actually several awesome examples from Dr. Horrible, but to avoid any spoilers I'll just focus on the setup. Within the first 5 minutes of the show you learn basically everything you need to know:

  • Dr. Horrible is an aspiring villain who desires social change (amongst other things) and wants to rule the world.
  • The Dr. has a video blog.
  • The Dr. is an inventor. His current project is the "Freeze Ray".
  • There is an "Evil League of Evil" which the Dr. wants to be accepted into.
  • The Dr.'s nemesis is Captain Hammer.
  • Dr. Horrible has a crush on a girl, but he's too shy to talk to her.


Additionally it provides a nice setup for Bad Horse and Captain Hammer, gives the viewer with a general feel for the show, and has plenty of humor. And it does all this exposition within the regular context of the show. No need to have an intro sequence or some other sort of contrived method of getting the message across.

I guess what it all boils down to is that there need to be more Joss Whedons in the world, and they need to be writing in Hollywood. No one will miss all the drivel-spawning clowns who currently claim to be screenwriters.