Update:Archive/2.0/Developers/Best Practices: Difference between revisions

No edit summary
Line 49: Line 49:
* We prefix all our global identifiers (functions and variables those which are not class members) with '''mozupd_''', to avoid namespace conflicts with libraries and includes? example: '''mozupd_addRating()''' or '''$mozupd_currentUser'''  
* We prefix all our global identifiers (functions and variables those which are not class members) with '''mozupd_''', to avoid namespace conflicts with libraries and includes? example: '''mozupd_addRating()''' or '''$mozupd_currentUser'''  
* We prefix all the functions in a module (include) that are not meant to be called from an including file (private utility functions) with '''_mozupd_'''? example '''_mozupd_dbTest()'''
* We prefix all the functions in a module (include) that are not meant to be called from an including file (private utility functions) with '''_mozupd_'''? example '''_mozupd_dbTest()'''
:Personally, if you want to avoid namesoace conflicts, then you should be writing things as classes; so <tt>mozupd_addRating()</tt> becomes <tt>$rating = new Rating(); $rating->addRating();</tt>. I would tend to agree on "internal" methods being called <tt>_methodName</tt> but I think prefixing everything with mozupd_ etc. is going to get extremelt annoying very quickly. --[[User:Csogilvie|Csogilvie]] 10:55, 22 Jan 2005 (PST)
73

edits