Prev: MAKE UPTO $5000 MONTHLY! $2000 INYOUR FIRST 30 DAYS!
Next: help: enum cause failure in multi thread run
From: Roedy Green on 16 Jul 2010 05:35 On Wed, 14 Jul 2010 11:16:45 -0700 (PDT), Sanny <softtanks22(a)hotmail.com> wrote, quoted or indirectly quoted someone who said : > > if (Str.charAt(50)!='-') xx+=bit;bit++; > if (Str.charAt(49)!='-') xx+=bit;bit++; This code does not make sense. Why would you want the sum of the bit numbers that contained a -? I could see xx++ to count the number of - chars. Very rarely do you manually unravel loops now adays. We leave it up to optimisers which loops to unravel. That is confusing code. A novice might read it as if (Str.charAt(50)!='-') {xx+=bit;bit++;} Visual form should reflect logic. This is a form of obfuscated code. -- Roedy Green Canadian Mind Products http://mindprod.com You encapsulate not just to save typing, but more importantly, to make it easy and safe to change the code later, since you then need change the logic in only one place. Without it, you might fail to change the logic in all the places it occurs.
First
|
Prev
|
Pages: 1 2 3 4 5 6 7 Prev: MAKE UPTO $5000 MONTHLY! $2000 INYOUR FIRST 30 DAYS! Next: help: enum cause failure in multi thread run |