Re: [WSG] Coding Standard...
Michael Kear wrote: So just for the hell of it, I hit the Top Style 'stylesweeper', and bingo! Everything was nicely laid out. I love TopStyle's stylesweeper - before a site goes live, I use it to remove all extra spaces (to reduce download time). If I want to work on that file again, I run another stylesweeper which spaces everything out again. If I have to open someone else's messy css file, one click and it's beautiful again :) K. --- http://kay.smoljak.com * The discussion list for http://webstandardsgroup.org/ *
Re: [WSG] Coding Standard...
My brace style of use is KR (Kernighan and Ritchie -- or what you call 'goofy') but I prefer to read GNU style, then BSD style (what you called 'lined up method'). I guess it goes back to my C programming days. If wateva team I'm working with doesn't like it then it's only 2 lines of perl to change it... And I definately agree with SC that it's probably one of the aspects that matters the least when it comes to code readability and reuse -- althought it should be kept consistent throughout a project. -- tim www.toolmantim.com * The discussion list for http://webstandardsgroup.org/ *
Re: [WSG] Coding Standard...
Don't forget that it also has a lot to do with what you're using to edit the files. I use jEdit with it's folding functionality set to indent which means... div.row span.left { float: left; text-align: left; font-weight: bold; color: #fff; width: 49%; } ...can be expanded or collapsed and all I see is... div.row span.left { } which is VERY useful when working on long files. Nick Thats my opinion too! But every tutorial website I see (well most)... Use the IMO - goofy method.. I mean why have the Open bracket on the top line? It makes it so hard to find the opening, because its not inline with anything! * The discussion list for http://webstandardsgroup.org/ *
RE: [WSG] Coding Standard...
IN my case its really simple. I started tinkering with Bradsoft's Top Style, CSS editor. The first time I used it, I downloaded a style sheet off a site, it was totally in abbreviated style, and I couldn't understand any of it. So just for the hell of it, I hit the Top Style 'stylesweeper', and bingo! Everything was nicely laid out. That's how I continue to layout my styles. But I don't think it matters a damn, as long as it's syntactically correct, and the people who have to work on it can understand what it's all doing. Cheers Mike Kear Windsor, NSW, Australia AFP Webworks http://afpwebworks.com -Original Message- From: russ weakley [mailto:[EMAIL PROTECTED] Sent: Sunday, 29 February 2004 2:18 PM To: Web Standards Group Subject: Re: [WSG] Coding Standard... Forgive me for sounding grumpy, but I think this sort of thing can go on too long. We are not talking about standards or best practices now, we are talking about personal preferences. Whitespace inside a declaration block is ignored - so it can be used to lay out rules or rules sets in any way you want. It comes down to personal or production team choice. Russ * The discussion list for http://webstandardsgroup.org/ *
[WSG] Coding Standard...
Hey Everyone, This is a great debate in Perl, C++, PHP... Its all the same with CSS too! I HATE It When People code with the curly brackets like this: div.row span.left { float: left; text-align: left; font-weight: bold; color: #fff; width: 49%; } I prefer to code like this: div.row span.left { float: left; text-align: left; font-weight: bold; color: #fff; width: 49%; } What is your preference See I hate when things dnt Line up... I love having nicely formatted code. Sorry - I hope this standard doesnt make this off topic. I would just like to know what you like, and dont like. It will be interesting to see what your opinions are! -- Chris Stratford [EMAIL PROTECTED] Http://www.neester.com * The discussion list for http://webstandardsgroup.org/ *
Re: [WSG] Coding Standard...
Properly lined up is better IMHO div.row span.left { float: left; text-align: left; font-weight: bold; color: #fff; width: 49%; } is much easier to work with especially when the program you're developing highlights matching open/close brackets. Chris Stratford wrote: Hey Everyone, This is a great debate in Perl, C++, PHP... Its all the same with CSS too! I *HATE *It When People code with the curly brackets like this: /div.row span.left { float: left; text-align: left; font-weight: bold; color: #fff; width: 49%; } / I prefer to code like this: /div.row span.left { float: left; text-align: left; font-weight: bold; color: #fff; width: 49%; } /What is your preference * The discussion list for http://webstandardsgroup.org/ *
Re: [WSG] Coding Standard...
Yeah, Thats my opinion too! But every tutorial website I see (well most)... Use the IMO - "goofy" method.. I mean why have the Open bracket on the top line? It makes it so hard to find the opening, because its not inline with anything! So far its: 2:0 for, LUM -vs- GM (Lined Up Method -vs- Goofy Method) Chris Stratford [EMAIL PROTECTED] Http://www.neester.com Neerav wrote: Properly lined up is better IMHO div.row span.left { float: left; text-align: left; font-weight: bold; color: #fff; width: 49%; } is much easier to work with especially when the program you're developing highlights matching open/close brackets. Chris Stratford wrote: Hey Everyone, This is a great debate in Perl, C++, PHP... Its all the same with CSS too! I *HATE *It When People code with the curly brackets like this: /div.row span.left { float: left; text-align: left; font-weight: bold; color: #fff; width: 49%; } / I prefer to code like this: /div.row span.left { float: left; text-align: left; font-weight: bold; color: #fff; width: 49%; } /What is your preference * The discussion list for http://webstandardsgroup.org/ * * The discussion list for http://webstandardsgroup.org/ *
Re: [WSG] Coding Standard...
Good point james - about the team work :) i will make sure i remember that before I start any group coding... Could save a lot of time/effort... well - I dont understand why whenever I read someones code - its using the goofy method... I mean - if most people prefer the lined up method... That link was very interesting... I didnt realise there were so many "methods"... well im in with the BSD method :) thanks for that james! Chris Stratford [EMAIL PROTECTED] Http://www.neester.com James Ellis wrote: Chris We had a chat about this over at sydney.ug.php.net and position : divided; :D The one you mention is discussed among others at http://www.kafejo.com/komp/1tbs.htm. I prefer the BSD style as you get: if() { ... }//end if else { ... }//end else And the braces are all lined up which makes for great readability of where conditionals end. I also comment conditional ends. CSS is different as you are only applying rules rather than conditionals and nested conditionals. As long as you are consistent and document what is done then there should be no problem when handing over or sharing a project codebase. Doing this #obj { position : absolute; color : cyan; border : 1px dotted yellow;} #nav { color : green; } #ihaterealitytv { color : black; background-color : white; } or this #obj { position : absolute; color : cyan; border : 1px dotted yellow; } #nav { color : green; } #ihaterealitytv { color : black; background-color : white; } is more prefarable to this: #obj { position : absolute; color : cyan; border : 1px dotted yellow; } #nav { color : green; } #ihaterealitytv { color : black; background-color : white; } If you are working in a team, deciding on the bracing method for these types of languages is probably the first thing to be worked out amongst coders. Cheers James Chris Stratford wrote: Hey Everyone, This is a great debate in Perl, C++, PHP... Its all the same with CSS too! I *HATE *It When People code with the curly brackets like this: /div.row span.left { float: left; text-align: left; font-weight: bold; color: #fff; width: 49%; } / I prefer to code like this: /div.row span.left { float: left; text-align: left; font-weight: bold; color: #fff; width: 49%; } /What is your preference See I hate when things dnt Line up... I love having nicely formatted code. Sorry - I hope this standard doesnt make this off topic. I would just like to know what you like, and dont like. It will be interesting to see what your opinions are! -- Chris Stratford [EMAIL PROTECTED] Http://www.neester.com * The discussion list for http://webstandardsgroup.org/ * * The discussion list for http://webstandardsgroup.org/ * * The discussion list for http://webstandardsgroup.org/ *
Re: [WSG] Coding Standard...
This is great flamewar material, dude :). I adhere pretty closely to the KR style (opening curly bracket on the same line as the selector [or function or class definition, or conditional, or whatever]), mostly because it conserves the most space (and because I don't think I've ever used curlies to see blocks -- that's what proper indentation is for!). It's all good as long as you keep it consistent, though. -- Andrew Taumoefolau http://www.midspark.net/shazbot/ * The discussion list for http://webstandardsgroup.org/ *
Re: [WSG] Coding Standard...
On Feb 28, 2004, at 4:37 PM, Chris Stratford wrote: well - I dont understand why whenever I read someones code - its using the goofy method... I mean - if most people prefer the lined up method... Most people *who have expressed a preference here* - that is not most people :) A lot of code examples out there use either the inline style: .foo { some : thing; } (usually to conserve space on the page) or this style which is very common in Java, JavaScript and a lot of C and C++ code: .foo { some : thing; } Because of my C / C++ / Java background, I tend to use the latter style in CSS because that's what most other folks around me do (i.e., I am consistent with their code). Personally, I do prefer the BSD method but I just don't use it much! :) Sean A Corfield -- http://www.corfield.org/blog/ Got Mach II? -- http://www.mach-ii.com/ * The discussion list for http://webstandardsgroup.org/ *
Re: [WSG] Coding Standard...
I said MOST people, because on teh website that James sent over. They say that thy have conducted Polls etc... And found that the most common is the BSD method... :) Thats where I got it from :) Chris Stratford [EMAIL PROTECTED] Http://www.neester.com Sean A Corfield wrote: On Feb 28, 2004, at 4:37 PM, Chris Stratford wrote: well - I dont understand why whenever I read someones code - its using the goofy method... I mean - if most people prefer the lined up method... Most people *who have expressed a preference here* - that is not "most" people :) A lot of code examples out there use either the inline style: .foo { some : thing; } (usually to conserve space on the page) or this style which is very common in Java, _javascript_ and a lot of C and C++ code: .foo { some : thing; } Because of my C / C++ / Java background, I tend to use the latter style in CSS because that's what most other folks around me do (i.e., I am consistent with their code). Personally, I do prefer the "BSD method" but I just don't use it much! :) Sean A Corfield -- http://www.corfield.org/blog/ Got Mach II? -- http://www.mach-ii.com/ * The discussion list for http://webstandardsgroup.org/ * * The discussion list for http://webstandardsgroup.org/ *
Re: [WSG] Coding Standard...
On Feb 28, 2004, at 5:10 PM, Chris Stratford wrote: I said MOST people, because on teh website that James sent over. They say that thy have conducted Polls etc... It's like the cat food commercial... they used to say 8 out of 10 owners said their cats prefer Whiskas and after a while they were forced to say 8 out of 10 owners who expressed a preference said their cats prefer Whiskas... I'd be interested to know how many people actually responded to those polls... I mean, they didn't ask *me*... I didn't even know about it. For much of the early 90's I used to write coding standards for a living and conduct code audits. Folks got very religious about brace styles, indentation and naming convention - three of the least important aspects of a good coding standard (in my opinion). Consistency is the only defensible position for those subjects. As for the other stuff, they were happy to be advised what to do (I'm talking about guidelines for complexity, cohesion, coupling, coding for maintenance...). Anyway, it's interesting to know that people actually do care about brace style in the CSS world! :) Sean A Corfield -- http://www.corfield.org/blog/ The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man. -- George Bernard Shaw * The discussion list for http://webstandardsgroup.org/ *
Re: [WSG] Coding Standard...
I'll put my hand up for the goofy style. It's my preference, my habit - be it CSS rules, functions, CFScript, what have you. In a team environment, I'd use whatever style made it easier for the whole team to concentrate on the work at hand. What's next? Space or tab indentation? :) --ben If I work on your stylesheet, I'll try to follow your style. If I inherit your stylesheet, I'll format it my way. If you screw up my stylesheet with weird formatting - I'll chuck a wobbly. * The discussion list for http://webstandardsgroup.org/ *
Re: [WSG] Coding Standard...
LOL Yeah? Im all for TAB indentation (I set my tabs to be a width of 4 Spaces) :) Tabs are more definable, I use SOURCEEDIT... And when I turn on the SHOW WHITESPACE, all the Dots as spaces are very irritating... :P Chris Stratford [EMAIL PROTECTED] Http://www.neester.com Ben Bishop wrote: I'll put my hand up for the "goofy style." It's my preference, my habit - be it CSS rules, functions, CFScript, what have you. In a team environment, I'd use whatever style made it easier for the whole team to concentrate on the work at hand. What's next? Space or tab indentation? :) --ben If I work on your stylesheet, I'll try to follow your style. If I inherit your stylesheet, I'll format it my way. If you screw up my stylesheet with weird formatting - I'll chuck a wobbly. * The discussion list for http://webstandardsgroup.org/ * . * The discussion list for http://webstandardsgroup.org/ *
Re: [WSG] Coding Standard...
I agree, it's a personal preference more than anything else. I can say from the butt-load of site's I looked at, the vast majority used the goofy style. I personally choose that way when I code because it's what I'm used to and comfortable with. The one that drives me nuts is what someone called the inline style, which is a major pain in the butt to look through quickly when attempting to fix or change things. I've had quite a few redesigns recently where I had to run through the old stuff and it was in this format...I shoulda bought stock in Advil beforehand. The coding was very sloppy to say the least. My experience with that is it's a favorite among those ASP/M$ guys. Only one site wasn't, and that site already utilized PHP and had clean clode everywhere (HTML, CSS, PHP, etc.) and was nicely commented. She was a breeze to redo and a pleasure...wish more went like that one did. MD On Feb 28, 2004, at 22:18, russ weakley wrote: Forgive me for sounding grumpy, but I think this sort of thing can go on too long. We are not talking about standards or best practices now, we are talking about personal preferences. Whitespace inside a declaration block is ignored - so it can be used to lay out rules or rules sets in any way you want. It comes down to personal or production team choice. Russ I'll put my hand up for the goofy style. It's my preference, my habit - be it CSS rules, functions, CFScript, what have you. In a team environment, I'd use whatever style made it easier for the whole team to concentrate on the work at hand. What's next? Space or tab indentation? :) --ben If I work on your stylesheet, I'll try to follow your style. If I inherit your stylesheet, I'll format it my way. If you screw up my stylesheet with weird formatting - I'll chuck a wobbly. * The discussion list for http://webstandardsgroup.org/ * * The discussion list for http://webstandardsgroup.org/ * * The discussion list for http://webstandardsgroup.org/ *