Changes between Version 6 and Version 7 of MapGuideCodingStandards


Ignore:
Timestamp:
Jul 14, 2008, 10:59:57 AM (16 years ago)
Author:
jbirch
Comment:

Another check-in

Legend:

Unmodified
Added
Removed
Modified
  • MapGuideCodingStandards

    v6 v7  
    8585}}}
    8686
     87== Object Creation and Runtime Speed ==
     88
     89As with Java, unnecessary object creation is something you should avoid whenever possible.  Just be smart about it when you code.  For example, if a call to a method returns a new object and you call that method multiple times in the same context, then change your code to call this method only once and reuse the returned value.  Another example: use private helper objects when it makes sense to avoid unnecessary object creation.
     90
     91== Threading Guidelines ==
     92
     93It’s important to follow strict threading rules when writing new code. Some of the MapGuide code will be used in a multithreaded deployment environment. Failing to follow multi-threading guidelines will be costly in the future. There are detailed guidelines provided by Microsoft's ''Design Guidelines for Class Library Developers'' ([ms-help://MS.VSCC/MS.MSDNVS/cpgenref/html/cpconnetframeworkdesignguidelines.htm local VS link]) that should be reviewed.
     94
     95Here are some points from those guidelines:
     96
     97 * Avoid providing static methods that alter static state
     98 * Be aware of method calls in locked sections
     99 * Avoid the need for synchronization if possible
     100 * Avoid using global variables
     101
     102== Source File Naming ==
     103
     104The naming of source code files will match the class names except that the “Mg” prefix will be dropped.  For example, if I have a class called !MgClassA then all source files for that class will have the name !ClassA.  If this class is defined in C#, then there is only one source file with the .cs extension.  If this class is defined in C++, then there are two files: the source file with extension .cpp and the header file with extension .h.  No mismatches between class names and file names are allowed!
     105
     106One consequence of this rule is that you can only define one class/enumeration/struct/interface per file.
     107