IDE influence (was RE: [thelist] ColdFusion: Nested pound signs)

.jeff jeff at members.evolt.org
Fri Nov 16 18:32:02 CST 2001


joel,

the topic of coding conventions is one that's near and dear to my heart.  in
looking at my own style, i find it interesting that i use two different
techniques when it comes to curly brace usage.  when it comes to javascript,
i match up the braces like so:

function myFunc()
{
  if(lala != po)
  {
    alert('haha, you watch the teletubbies!');
  }
}

however, when it comes to css, i don't match them up.

body {
  background: #ffffff;
  color: #000000;
  margin: 0px;
  font-family: tahoma;
  font-size: 11px;
}

after thinking about it for a bit i think i figured out why.  javascript can
be nested any number of levels deep making it critical that you are able to
quickly match up opening and closing braces.  css, on the other hand, is
only one level deep.  in this instance it's more important to create a
visual bond (ie, only a single line-break) between the selector and each of
its properties and a visual separation (ie, a curly-brace and two
line-breaks) between the last of the properties of one selector and the next
selector.

thanks,

.jeff

http://evolt.org/
jeff at members.evolt.org
http://members.evolt.org/jeff/






More information about the thelist mailing list