• Categories
  • actionscript 3 (7)
  • Design (10)
  • flash (6)
  • flex (6)
  • general (6)
  • inspiration (3)
  • interactivity (3)
  • MA (6)
  • photoshop (3)
  • processing (1)
  • programs (2)
  • Uncategorized (3)
  • vvvv (1)
  • programming styling

    yes its been a while since my last post but this month always seems to fly by in an instant with all those holidays.

    but I have been spending my time reading books and web site’s about various programming styles people use and which would work best in my case the reason I spent a lot of time in this is because I wanted to see if I could find any kind of similarity between it all and I came to the conclusion there is.

    it basically come’s down to using clearly structured code and making it humanly readable by this I mean you might be able to understand the code with out needing additional comments to go with it even if your not that experienced in the language. as well as using clear prefixes for certain variables and methods.

    also the usage of neatly spaced code helps with the readability of it all.

    the style I use will have more comments in it then you would normally use, but that is because I plan on using it for tutorials and such.

       1: // ActionScript file example layout
       2: /* 
       3: start class names with a capital letter
       4: 
       5: 
       6: in class files preferred not to use this as this makes for poor readability
       7: this example:
       8: this._area = this._width * this._height;
       9: 
      10: without this example:
      11: _area = _width * _height;
      12: */
      13:  
      14: //Constants 
      15:  
      16: /* these should have descriptive names like, FIRST_NAME:String = Joost;
      17: */
      18:  
      19: //public properties (variables)
      20:  
      21: /* define all private and protected properties with a underscore like so, _example:String = example;
      22: */
      23:  
      24: //private properties (variables)
      25:  
      26: /* start local variables with the letter p so its easy to track them back,  pExample:String = example;
      27: */
      28:  
      29: //constructor (class named function)
      30:  
      31: /*  for constructors use this method so its easier to keep constructors and methods apart
      32: 
      33: function myFunction(){
      34: //function code in here
      35: }
      36: */ 
      37:  
      38: //public methods (function)
      39:  
      40: /* 
      41: function myFunction()
      42: {
      43: //function code in here
      44: }
      45: */ 
      46:  
      47: //private methods (function)
      48:  
      49:  
      50:  
      51: //getter/setter methods
      52:  

    admin | December 30th, 2007 | MA, actionscript 3, flash, flex, programs
    Copyright 2007 | Designed by Joost Harts Add to Technorati Favorites