Tuesday, June 20, 2006

Impact of rewriting the code from scratch



 





  I was going through Joel's
website, and came across the cardinal law  of programming.

        It's
harder to read code than to write it



In fact this feels so correct. In the morning, I was trying out ways to
build a javascript function for "inline editing" in one of the custom
grid we have build. I found a sample source code on the website, and when I
opened it, the first thing I felt was this looks like a mess, there are no
proper comments, code is scattered !!!  I prefer to just understand some
part of the code and rewrite the whole stuff by myself rather than reusing the
same, which holds good for many developers.



As human beings each one of us are unique, and I believe the same applies for
us when we take the roles of programmers. We want to be unique.



Result: 1. A lot of time gets wasted in rewriting the code

2. Disaster can happen like for Netscape, where it seems they tried rewriting
Netscape 4.0 and it was all over the place, and it took nearly 3 years for them
to put there code together to release Netscape 6.0 (Jumping 5.0), and now they
have lost nearly 80% of the market.



Moral of the story: Never plan to rewrite an entire product from scratch
without clearly analyzing the impact










Tuesday, June 13, 2006

Testing the class that uses API and not the API itself

I read the following post from Uncle bob's Website:


It's not enough to write tests for an API you develop, you have to write unit tests for code that uses your API.

When you do, you learn first-hand the hurdles that your users will have to overcome when they try to test their code independently.