Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NX: Code Formatting Question

 
Javini Javono
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In the following example #1, there are two problem areas:
1. the for statement
2. The assignment statement to records[field].
Any other suggestions as to how I might have broken these individual lines
as concerns code formatting?

Thanks,
Javini Javono
[ March 05, 2004: Message edited by: Javini Javono ]
 
Charlie Goth
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What about:

?
Charlie
 
George Marinkovich
Ranch Hand
Posts: 619
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

For some reason I prefer breaking a line on a parenthesis or a comma, rather than the dot operator. I like the for statement as is.
[ March 05, 2004: Message edited by: George Marinkovich ]
 
Max Habibi
town drunk
( and author)
Sheriff
Posts: 4118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'd go for Charlie's way.
M
 
George Marinkovich
Ranch Hand
Posts: 619
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Charlie,
I like your suggestion better, it's much more readable. Also, it's a great idea to get the method call out of the for loop test condition.
Two additional minor naming convention suggestions: I would name the "val" variable "count", and I almost always use "i" (or "j", "k", etc.) for looping variables that are used as array indexes.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic