Programming Ethics!!

Ethics are an integral part of everyone’s life. Although, they are far from being absolute, they influence a lot of our decisions.
Also, not to mention, since ethics are NEVER absolute, we usually find ourselves negotiating and compromising on for the other.

The same applies to programming as well.
As they say :

If a code compiles and passes the unit test(s) doesn’t always mean that it’s written right

All our ethics and actions driven by those are primarily ruled by 2 school of thoughts :

  1. Utilitarian Perspective : It says your actions and means are evaluated based on the consequences, i.e. If the end result is good then the means and actions are good.
  2. Deontological Perspective : This school of thought takes into account the action(s) itself and evaluates the end result based on the type of actions and means used to reach it.As you might have experienced yourself that following a Deontological approach to programming is a little painstaking at times. Following a Deontological approach would expect us to do the following at least:
      a) following naming conventions
      b) following programming best practices like looking for memory leaks
      c) writing and updating documentation to reflect the design exactly
      d) putting proper comments wherever possible in order to make it understandable for the next person who picks up your code
      e) writing programmatic Unit Tests and constantly testing your changes against them

    … And the list goes on.

As you might have already decided that its almost impossible to follow all of ’em.

Most of the time following a Utilitarian approach solves the purpose.
Along with that we follow a few of the deontological actions to treat us with some Moral Balm.

But trust me, its nothing more than a moral balm.
Following a Deontological approach in life can land you in all sorts of moral and ethical dilemmas and may be excruciatingly difficult.

Take for instance the classic Moral Dilemma:

The driver of a runaway tram can only steer from one narrow track on to another; five men are working on one track and one man on the other; anyone on the track he enters is bound to be killed.

There are numerous arguments comparing both the schools of thoughts. The basic idea is to reach a point of “Greater good and lesser evil”.

That’s the reason I say that ethics can never be absolute. You just cannot follow one school of thought always. The approach you follow will more often than not depend upon what’s at Stake for “You”.

Fortunately, following a Deontological approach in programming never lands you in a Moral Dilemma. It just takes more time and effort to follow it.

But, at the end of the day you have a clear conscience. And by that I mean, a conviction that your code will not break, will perform well, would be scalable and maintainable.. Now and in the future.. Because “YOU” have made it that way.

The fact that nobody can question the code you’ve written gives a “kick” to a programmer like nothing else.

So, I suggest, each of us to not compromise on the Deontological approach when it comes to programming, ‘coz that’s what will make you a better programmer at the end of the day. Passing just functional tests will make you just another employee who does his/her job.

Happy Coding!!!

Posted from WordPress for Windows Phone