• Code is indented by 4 spaces
  • LongAndDescriptiveNames forMethodsAndVariables. Easy to understand, grep and change. Use conjugations of be for boolean returning methods.
  • Short Methods (aim for below 7 lines) longer than one screen -> you have to refactor it.
  • Model / Controller split: Everything that can go into the model should go there. (Controllers tend to get very big in SproutCore so combat that early and often). General rule of thumb: Put the Code where the data is that it it is acting upon.
  • Avoid sc-gen, it generates 90% crap and with the wrong filenames too.
  • Name sproutcore files to contain their roles (foo.js (model), foo_controller.js, foo_view.js, foo_test.js...)
  • File Size: < 500 == good, > 1000 == refactor
  • Use Guard clauses (main flow of method should not be indented)
  • Use whitespace to express logical grouping (and use if ( _ ! _ foo) to make it easier to spot the negation in conditions)
  • Constants first if (undefined === foo)
Last modified 9 years ago Last modified on 07/08/2010 09:40:04 AM

1.3.15 © 2008-2016 Agilo Software all rights reserved (this page was served in: 0.15617 sec.)