How many of you have coded in C, C#, Java or even JavaScript for that matter? If you have, then you'd probably know i=i+1 as one of your best companion when dealing with loops. Yet, I call the practice ridiculous...Why do you think that is?
For one, any programmer with a basic understanding of math would have puzzled over this question: isnt i->i+1 more meaningful than i=i+1 in a programming context? Why then do all programming languages follow the pattern of variable = variable +1?? I have no clue whatso ever, but I would reckon it is a reminiscent of the age when there were no standardized charecter sets for various programming languages and all vendors defined their own charecter sets, and standards.
And, to add to this mess, every programmer, no matter how experienced uses the counter variable named i, instinctively. Of course, he'd have to use an alternate variable to nest loops within other loops, he'd have to use another variable, and the second variable would instinctively be named j. I do not know if the collective conciousness of all programmers is at play here, for I have seen the same pattern repeating with every coder I have met over the past decade or so.. Even with me ! As we all pave way for new programming languages and techniques, I also hope that this hideous practice will be stopped, for all our sakes.
2 comments:
I take it you haven't worked in a modern software development company where code is maintained across the work of hundreds of programmers. The answer to all you questions is this: simplicity. If I read the statement "i = i + 1" or "i++", where 'i' is assumed to be an integer data type, I perfectly understand it to be that 'i' is intended to be incremented by an integer value of 1. I think you are making rather superficial observations especially when you set out to attack that it is a ridiculous practise to use single-character integer names when using a typical loop counter, i.e. 'i', or its subsequent, 'j', 'k', etc..
If you're not suggesting to use alternative letter names, perhaps 'a', 'b', or 'c', and instead to use descriptive words in place of single character names, then that would immediately affect the legibility of code that would use that parituclar counter variable, especially when there will be many references to that variable in that particular variable scope.
Try picking up a software development guideline document some day. You'll realize there are far more important software development issues to make significant observations about (eg. lack of type safety, third-party derivation across assemblies, to name a few).
hi,
i am from singapore and noticed your ad on elance.com. Will you be interested in designing a website for me? Please contact me via msn or email on Dugarry_59@hotmail.com
Thank you.
Post a Comment