Topic:   [Any OOP Lnguage] Coding Conventions   (Read 19906 times)


0 Members and 1 Guest are viewing this topic.

WarHampster


  • GMG Extraordinaire

  • ***


  • Posts: 1501

  • The People's Moderator
    • Arcade of the Absurd
[Any OOP Lnguage] Coding Conventions
« 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?
« Last Edit: August 15, 2010, 12:36:26 AM by WarHampster »

GMG Mike


  • Administrator

  • GMG-er

  • *****

  • no avatar

  • Posts: 536
    • mikerichardson.name
Re: [Any OOP Lnguage] Coding Conventions
« Reply #1 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".