Game Maker's Garage Forum

Game Creation => Code Exchange => Topic started by: WarHampster on August 15, 2010, 12:31:20 AM

Title: [Any OOP Lnguage] Coding Conventions
Post by: WarHampster on August 15, 2010, 12:31:20 AM
I'd never really paid any attention to this before, but working as part of a large group has made me realize how important it is to keep consistent and readable coding conventions. Here's what I've settled on for my current project:

Code: [Select]
class IAmAClass
{
     public iAmAMethod()
     {
          // blah blah blah
     }
        
     public IAmAProperty
     {
          get{return iAmAnyVariable}
     }
        
     public parenthesesExample(someInput, anotherInput)
     {
          iAmAnyVariable = ( ( someInput * (float)anotherInput / (someInput + anotherInput) ) );
     {
          
     private int iAmAnyVariable
}

What do you guys use?

EDIT - formatting on this forum is strange... stuff in braces should be indented. Or is it just my browser?
Title: Re: [Any OOP Lnguage] Coding Conventions
Post by: GMG Mike on August 15, 2010, 09:48:25 PM
In SilverCreator I have objects set up for everything:

SCCard
SCSprite
SCMethod
SCNumArray
SCStrArray
SCButton
SCClickArea
SCScript
SCParameterList

etc. There's a neat heirarchy of SCCards, which contain SCButtons and SCClickAreas, and those contain SCScripts, which have SCParameterLists and may reference SCNumArrays, etc.

All the classes related to the game objects are prefixed with "SC".