Friday, October 18, 2013

My Code is Beautiful

I'm the type of programmer that likes to beautify, structure and document my code for no reason other than I like to look over the source code and refine every last detail whether it really matters or not. I think that is taking pride in my work. One advantage is that in looking it over so much, I become very familiar with its ways, so that if I ever have a problem, I can resolve it quickly. And we all know the advantage of structure and documentation, which make one less likely to forget things and faster at apprehending complicated processes. I was looking over my regen.sh for Dungeon Crawl Stone Soup today, which I updated, and I thought to myself what a work of art that little thing has become. It's a lot better than it has to be. The idea behind the script file is simple and could have been accomplished with 95% less code, but I added bells and whistles to simplify use and maintenance so that it could endure the centuries, so to speak, although that does seem a bit unlikely. I was always that way with code, whether I was coding pages for web sites using html and css in a text editor or backend programs to handle the accounting for a billion-dollar corporation. I remember spending days refining the central program that handled all the accounting processes from A to Z in the company I worked for. It began its life as spaghetti code, and all the programmers hated it, but in particular I was contemptuous of it. Code like that actually offends me and fills me with the compulsion to clean, clean, clean. When I had finished with it, it was highly organized and easier to understand. Instead of looking at it in the middle of the night, say, when the you-know-what had hit the fan due to technical glitches caused by some other process, and wondering what the hell was happening, I or anyone for that matter could just glance at it and understand exactly how things were supposed to work. It had progressed from being crap-code to being a work of art. I believe that programmers should focus on getting things done first, because after all that is the most important thing, but it is also very important to focus on ease of maintenance to ensure that the code will be useful for years to come. There are some systems and programs that even the end user can tell are based upon very refined code, because of the way they work and the absence of bugs, and even when bugs do arise they magically seem less in severity.

No comments:

techlorebyigor is my personal journal for ideas & opinions