The Quality in the Code

Posted on December 17, 2006. Filed under: Musings |

The bugs are always in the code.  The programmers till now have been creative types, but most of them did not have any grounding in mathematics or logic.  Some of the freshers I see today dont even know much about flowcharts, binary, hexadecimal, etc.

 Anyway, I am making a much more finer point.  The way we write a loop.


This manner of writing the loop is popular because this is the way it is taught.  I have always found it irritating because this is a half-open interval.  I would prefer to write it as a closed interval, like this:


Big deal, you say?  What difference does it make, you ask?  They both work the same way, you exclaim!  That just goes to show how difficult it would be to reach quality in the code.  At the level of pseudocode, such things should be standardized ( or recommended)..

when writing a counting loop, always use closed intervals.

This should apply whether you are writing in java, c, python, ruby, whatever. 

Instead we have people talking endlessly about how to name variables and do indentation.  These things do not affect quality, and dont need to be done manually.


Make a Comment

Leave a Reply

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

You are commenting using your 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

  • Posts


  • Blog Stats

    • 78 hits
  • Meta Information

Liked it here?
Why not try sites on the blogroll...

%d bloggers like this: