O wretched man that I am!   Leave a comment

“For the good that I would I do not: but the evil which I would not, that I do.” Rom 7:19 I am not a preacher but I do read the Bible and I am not going to talk about the verse I read. I found this quote while I was reading and at the end it says, ‘O wretched man that I am! Who shall deliver me from the body of this death?’ I don’t know if the picture here could show what I intend to show with the post, but in my opinion, that animal there feels like wretched surrounded by lots of people around it. I think it feels like it’s not in a place it belongs.

I was looking at the code I wrote few months back. At the time I wrote it, it felt like a normal thing. It performed what I wanted it to do and the application has been implemented. It is this time that made me say ‘for the good that I would I do not…’. I had a chance to see the video of Uncle Bob’s presentation about clean code and also read the e-book. It was on how to make the code as clean as possible for future maintenance. After watching the presentation, I promised myself I would do my best to write that kind of code, the good thing, but the evil was what I did. When I looked at it for sometime and couldn’t figure out exactly what I was trying to do with a specific line of code…. ‘O wretched man that I am!’.

I have been working for years as a programmer. In my previous years, I worked with a team of developers. Each of us came from different projects working with other people having a different way of doing things. We set standards for that project for making the communication between us easier. Though there were challenges with some guys aligning them to the teams way of doing things, it was a good experience. However, that doesn’t mean there was a code review. We just write it and it works, then we are good to go. Whenever we talk with other developers, we talk about design patterns, how to write a SOLID code and so on. We read something interesting, we try it in a sample project, may be with the default ‘Hello world’ kind of project. When the time comes to use it in a real world project, the issue of time comes along with it. We rush and forget all the promises we made. I know for sure there are guys who keep the promise to themselves.

Most of the applications I took part in involve a back end database access or are used in an application that access a database.  Some are made public and accessed through the internet, some are used internally within an organization. The importance of keeping the promise and doing it clean starts in designing the database, followed by the code that talks with the database ( Forgive me here: I said design because I did things with relational database mostly.) There comes the challenge and temptation to do it the quick and dirty way than the clean way. In the days where we had no luxury of choosing the ORM (Object Relational Mapping) tools, we used to do it ourselves (Oh, I feel like I’m old). Selecting between data adapter or data reader, using stored procedures or inline query …. were some of the choices we had to make. I remember there was a tool which generates classes for each table, with the CRUD (Create, Read, Update and Delete) methods having in-line queries in it. There was a guy who used that code to build a website which ended up in an SQL-injection attack. I am not going to bother you with the mistakes made by not taking due diligence in design and coding. Today, a friend sent me an email about Operation Shady. It says that about 70 prominent organizations were attached in an operation called shadyRAT. This year, 2011, was a year that we heard a lot about hacking and it’s consequences; remember SONY. Imagine the developers of the sites that were attacked, definitely when they look back at the code and hear how the hackers gained access…. The same is true during maintenance; Sometimes a code written to update something somewhere affects another module which doesn’t seem to be connected.

I think this post is more of a confession; Confession of a wretched developer. May be I will be writing sometime what the solution is. I think there is no absolute way of writing a neat code but there is for sure a way of writing a better, readable and maintainable code. I guess I might be lucky to get to that path soon. I will tell you on how to do it if I succeed; will tell you who shall deliver, but in the mean time, if you have any idea on how to do it…. the floor is yours.




Posted September 5, 2011 by Behailu S. in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: