Coding at work and at home...
While looking at an inexorably large wall of XML and redundant code today something occurred to me; I write better code for my job than I do for myself. The reason? I'm willing to do the less desirable things when someone else is writing my paycheck.
I do like what I do, don't get me wrong, but as with every task, there are always elements which are more onerous than others which make a job feel like a job. Luckily I feel very few of those moments, but today was one long such moment and in the midst of it all I thought "If I weren't getting paid for this, I would have walked away hours ago". Which lead me to my next thought. How many times have I walked away from just such a task in a personal project?
The code I was writing today was in its own way integral to the application I'm developing. I was adding lines of code in one of the Spring.Net configuration files and then generating the respective default classes we will inject into the project. However, this was just step 1, so everything was just populating skeleton code files where only a handful of words changed from class to class or method to method. I was even feeling like the task of writing code snippets was becoming redundant. I would probably be several days from completing all of that work without them, but at the end of the day, I was glad even to not have to see another code snippet until tomorrow either (by the way I like code snippets, I just rarely hit a task where I can justify the time to write them).
But, there are elements like that to every well done project. That my work was so redundant that everything could be generated for my via a quick code snippet means that both the code the snippets were built on and the code they produced conformed to standards. If the code wasn't well written, predictable and conformed to standards, then I likely would have wasted my time writing code snippets since I would need to do more then just set a few simple variables to get everything to work and it likely would have caused a lot of human error in the process.
In version 2 of my project this sort of code exists in my business objects, hibernate mapping and the classes created to access NHibernate for each model object. It didn't feel onerous at the time, but it was probably because I hadn't written a Hibernate mapping file in 2+ years and it was fun struggling to learn it again. The fact that I was able to stick with the conventions and standards in that integral portion of my application is probably a huge reason why Version 2 of my project has been so good to work with.
But after today I may need to go back over it and see if there were areas where I took shortcuts or avoided using standards in the name of keeping things shaken up and a little more exciting. Off the top of my head I know a few places where I could have designed things better, in those cases for another reason why my code at work is better (I refactor my work when I come across a better way of doing something or the design changes), but it would be an interesting task to review my own work looking for these snags I fell into.
Comments
Post a Comment