Good Vs. Bad Programmer

Good vs. Bad Programmer

Good Programmer is one who

  1. Always strives for excellence;
  2. follows good design principles;
  3. Always keep in mind CHANGE and MAINTAINIBILITY;
  4. At least refactors his/her code thrice
  5. Always try to improve the code base.
  6.  While working with Object oriented language always thinks of Object Oriented Design and Principles, so on…

In short a good programmer tries to stick to:

“Don’t Comment the Bad code rewrite it”

On the contrary a bad programmer (not so good programmer to be politically correct ;-)) is one who

  1. Don’t care about any rule
  2. Don’t follow any principle
  3. Never think about MAINTAINABILITY and the cost involved.
  4. Always try to find an excuse to support their bad code, for example they will say “Man!! I am not doing anything new or wrong that sort of code is already there in the code base.” Duh!!! We can’t expect them to improve the existing code base (in small steps of course) because they are not even willing to write the new code well.

The fundamental question nowadays is “Why do people write Bad Code?”

Let me share with you my experience before I answer that question!!

I have been mentoring wide varieties of people, from college graduate level to 8years programming experience doods. Here is my experience with them.

  1. College graduates learn things (good programming techniques) faster (given correct guidance, of course candidate should be willing to learn)
  2. There are three categories of  experienced people.
    1. People who do good programming. [Very rare]
    2. People who do not know what is clean code but they are willing to learn (I consider my self here). [masses]
    3. People who neither know about clean code nor they are willing to learn. This kind of people are very dangerous for the project, get rid of this kind of people at the very first place (obviously after giving them some warnings)  [rare]

So we have masses who don’t know anything about good programming, so obviously they will write Bad Code, because they are not exposed to Clean Coding (I see people write sequential Code With Object Oriented Languages [really frustrating])

Bad Code don’t Do this

public List<XyzCondition> getConditions() {
   List<XyzCondition> conditions = // Build or Get Conditions
   return conditions;
}

List List<XyzCondition>  list = getConditions();
list.remove(conditionName);

Simplified Version

 public Conditions getConditions() {
   List<XyzCondition> conditions = // Build or Get Conditions
   return new Conditions(conditions);
}
Conditions  conditions = getConditions();
conditions.removeCondition(conditionName);

There are lots of problems with the first version of the code, but most people would argue that there is not much difference. In fact some people would go to extend that they would say first code is simple than the later one. Duhhhh !!!!

People wont even think twice before initiating such kind of discussion, They enjoy writing sequential code and they can’t tolerate a change, there is a bit of emotional baggage that they don’t want to overcome

People (99% of them, as I said there will always be some exceptions) who work with me always think in terms of Object Oriented Design and principles, even in tight schedules they produce high quality code. I am  aware that some people would ask for more time the moment we demand clean code. Because for them writing clean code is like rocket science engineering.

Advertisements

2 thoughts on “Good Vs. Bad Programmer

  1. Salam Muhammad !

    Since you look intelligent and I can’t resist my self any more for asking you this question.

    What is the boundary of thinking in OO. I mean, is there any term like over engineered OO design ? Have you ever come across any scenario where OO doesn’t seems to work ?
    Every thing in OO, will it not complex things ? i am taking about big designs here not small projects.

    Don’t get me wrong, I think in OO and not against it a bit ! Just questions popping up now and then in my mind so better to ask them.

    OO=object oriented !

    • Wa alikum Asad,
      In my perspective there is no boundary for thinking in OO, Since every thing in this world can be considered as object.

      Problem start creeping in (And I think you are confused here) with the blind Use/misuse/overuse/unnecessary use of patterns/frameworks/principles, they solely exist to help/solve a specific set of problems with in a context,

      Albert Einstein was quoted as saying “make everything as simple as possible, but not simpler.”
      I think that’s the best advice for programmers.

      If you ever find yourself writing a piece of code that has some “trick” to it that would need to explain to someone,
      there’s probably a better way to do it.

      And I think that also applies to a lot of technologies that get misused, like AOP.

      So Things will get complex not just for using OO but for incorrect USE of OO

      Really good example of Bad Design (Who should we blame)
      Bad Design

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s