''Note to editors of this page: please be sure _not_ to set the "ConvertSpacesToTabs" switch on save, or the examples are destroyed.'' Is there any discussion etc about coding styles here? ''Yep. Check out CodingStandard. In my opinion having, _a_ standard is more important than having _a particular_ standard --AlexVanDenBergh'' '' What about CodingStyle or CodingStandard for languages that don't rely on curly brackets for scoping? I can see how this page applies, for example, to DelphiLanguage, but what is a good SqlCodingStyle? -- BevanArps I prefer this int f(int a, int b) { if(a= b) return a - b; printf("hello!"); return a + b; } That is, I prefer to handle simple cases earlier in a function, and return from the middle of functions freely. But if not permitted to rewrite the logic like that, I'd prefer int f(int a, int b) { if (a < b) { printf("hello!"); return a + b; } return a-b; } I also "cuddle" my elses, as in: /( )*\} else \{/ on a line by itself. And '''''no tabs'''''!! -- KarlKnechtel ---- how about this, it lets you visually ignore the braces, much easier to read since you only need to look at indentation. I do this mostly because I'm jealous of SmallTalk. I think I picked this style up from the guy who wrote BlocksInJava. -- RamonLeon int f(int a, int b){ if(a functions -> objects -> modules -> to your final program. There are probably only a few exceptions to this and those who use Anonymous functions, for example, know when to use them. * DontRepeatYourself/OnceAndOnlyOnce. Place duplicated code and functionality in its own function/class, etc. Do this ''always'' when code is duplicated thrice -- force yourself to find the common idea employed. If only twice, do so only after you have a good ''conceptual grouping''; that is, an abstraction that would likely facilitate code re-use. * Documentation/Comments? If your language integrates it lexically (ex. DocStrings), probably yes, because there will be more eyeballs/tools keeping docs up-to-date. If it integrates TestDrivenDevelopment via DocTest''''''s, for sure. Otherwise, ''there is no rule'', because out-of-date comments are worse than useless (cf. TimPeters). --MarkJanssen ''Your tips are reasonable, but none are about CodingStyle. The first is more about levering language capability than applying CodingStyle, and it's largely governed by the language you're using -- for example, some languages reasonably and usefully support anonymous functions and/or classes. Your second tip is a good example of DontRepeatYourself and OnceAndOnlyOnce. It's more about good programming practice -- and common-sense avoidance of repetition and redundancy -- than CodingStyle. The last is also an issue of good (or not -- it's controversial) programming practice. However, how you format the comments would be about CodingStyle.'' ** You got me before I updated. I've called-out my recommendations for procedural languages. Thanks for reminding me of the pre-existing pages. I disagree that they aren't coding style, because they inform every line of code you type. ---- CategoryCodingIssues CategoryCee