I agree Traci. The number of times I've had to debug code with crappy variable names is too many to mention. My strategy has always been to figure out the meaning of each variable, then search and replace each one with a decent name, in the block of code I'm dealing with, until finally the "meaning" becomes clear. If the original programmer had invested a tiny bit of extra time at the outset, it's 10 more likely that he/she wouldn't have created the bug and wasted my time.
----- Original Message ----- From: "Traci Sumpter" <[EMAIL PROTECTED]> To: "NZ Borland Developers Group - Delphi List" <[EMAIL PROTECTED]> Sent: Friday, September 24, 2004 2:52 PM Subject: RE: [DUG] DiamondBack Sneak Peek (Delphi 9) > When it is in the middle of a long procedure it helps if you dont have to > keep looking back in the code to see what you are meant to be doing. > > //commenting can help lots too..... > > As I said in my original I have a lot of work going over other peoples code > and often months after creation. So many times i get code like > > i := Query1.Fields[j].Integer; > Table1.Fields[i].asString := s; > > in the middle of many > > While i < j do loops and s is defined somewhere in the middle of > another loop. > > > In these situations it is impossible to understand what is trying to be > achieved and how to fix the bug that is created. > > Is this a better example when more descriptive varible names become > essential???? > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] Behalf Of James Sugrue > Sent: Friday, 24 September 2004 2:36 p.m. > To: NZ Borland Developers Group - Delphi List > Subject: RE: [DUG] DiamondBack Sneak Peek (Delphi 9) > > > Sorry can't agree. How is iCountFiles better than i. i is just a place > holder in a loop. Anyone with more than an elementary level of > programming will understand what is going on at a glance. > > I will concede that s could be more descriptive and possibly wasn't a > good example. > > On Fri, 2004-09-24 at 14:01, Traci Sumpter wrote: > > except 5 months down the track when it would be a lot easier to unserstand > > > > procedure DoSomethingorOther; > > var > > sFileList : string; > > iCountFiles : Integer; > > begin > > for iCountFiles := 0 to Pred(someList.Count) do > > begin > > sFileList := someList.Items[iCountFiles]; > > doSomething(sFileList); > > end; > > end; > > > > > > > > This means I can look at this short bit of code and can make assumptions > > that I am going through a list of Files and doing something with it. > > > > > > what does the other version of code allow you to make assumtions about.. > > > > Assume Ass out of you and me... I know > > > > > > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] Behalf Of James Sugrue > > Sent: Friday, 24 September 2004 1:25 p.m. > > To: NZ Borland Developers Group - Delphi List > > Subject: RE: [DUG] DiamondBack Sneak Peek (Delphi 9) > > > > > > I would have though i and j would be fine for loops and s for strings. > > x and y for anything to do with co-ords as well. > > > > > > I think the following is fine: > > > > procedure DoSomethingorOther; > > var > > s : string; > > i : Integer; > > begin > > for i := 0 to Pred(someList.Count) do > > begin > > s := someList.Items[i]; > > doSomething(s); > > end; > > end; > > > > > > On Fri, 2004-09-24 at 12:41, [EMAIL PROTECTED] wrote: > > > > Good practice (not always =) VCL source > > > > > > True, the VCL also uses _with_. > > > > > > Each to there own - but globally condemned is a bit rich > > > > > > > for multitudes of good reasons. > > > > > > name some then > > > > > > > > > What did you search on in google. > > > _______________________________________________ > > > Delphi mailing list > > > [EMAIL PROTECTED] > > > http://ns3.123.co.nz/mailman/listinfo/delphi > > > > _______________________________________________ > > Delphi mailing list > > [EMAIL PROTECTED] > > http://ns3.123.co.nz/mailman/listinfo/delphi > > > > _______________________________________________ > > Delphi mailing list > > [EMAIL PROTECTED] > > http://ns3.123.co.nz/mailman/listinfo/delphi > > _______________________________________________ > Delphi mailing list > [EMAIL PROTECTED] > http://ns3.123.co.nz/mailman/listinfo/delphi > > _______________________________________________ > Delphi mailing list > [EMAIL PROTECTED] > http://ns3.123.co.nz/mailman/listinfo/delphi _______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi
