I have a mostly-non-CEGUI-related question.
Basically, what are some common / generally-accepted coding standards?
Don't get me wrong, I don't name my variables crazy things, I comment, and I like to think I mostly use code that is efficient but formatted nicely.
However, I have only ever been a hobbyist programmer; I'm looking to apply for a software engineer position at a video game company and I'm wondering, what are some of the standards that professionals (may) use? I'm sure, especially working with a large code base, that there are practices that are smiled upon that I may not yet be using in my own coding.
I generally have found CEGUI to use very consistent, good coding style and object orientation. Are there any guidelines that you follow? Whether common / available for reading, or simply personal rules of thumb? Anything from specific naming issues to higher-level program structure. As I prepare a "programming sample" for use with applications, I'd like to make sure that I'm not filling it with "casual programmer snafus" or somesuch.
Well, let me know if you have any thoughts, and thanks for reading-
Coding Standards?
Moderators: CEGUI MVP, CEGUI Team
Re: Coding Standards?
http://www.cegui.org.uk/docs/current/co ... dards.html
Yep we do.
To be honest I have contributed layout containers without a clue that such a document exist . I just stuck to the code style I saw in CEGUI source and CrazyEddie didn't suspect a thing
Please note that these things are very subjective. Practically every library uses different coding standards. From my observation CEGUI and Ogre coding standards are very similar, except they use different "warts" for member variables (Ogre uses mMemberVariable, CEGUI uses d_memberVariable).
This is something that the company hiring you will tell you so I wouldn't stress about it now. Just make sure you don't excessively introduce "your style" to existing code.
Yep we do.
To be honest I have contributed layout containers without a clue that such a document exist . I just stuck to the code style I saw in CEGUI source and CrazyEddie didn't suspect a thing
Please note that these things are very subjective. Practically every library uses different coding standards. From my observation CEGUI and Ogre coding standards are very similar, except they use different "warts" for member variables (Ogre uses mMemberVariable, CEGUI uses d_memberVariable).
This is something that the company hiring you will tell you so I wouldn't stress about it now. Just make sure you don't excessively introduce "your style" to existing code.
-
- Not too shy to talk
- Posts: 42
- Joined: Thu Jan 24, 2008 06:30
- Location: UW-Madison
- Contact:
Re: Coding Standards?
Ahh, thanks Kulik. Good readin'. Obviously I can't be expected to already have been following the exact same code formatting as wherever I apply, but it's probably good to have clearly thought out some format rules for my own stuff. This gives me some things to think about that I haven't before ;]
Re: Coding Standards?
In my experience the CEGUI standards are better (imo) than most of the other projects/work I have experience with.
That said there are a few things we disagree on: namespace-style, member-variable style, local-variable style, constant-style, and space (vs tab) style. Namespaces should be lower-case, nuff said. You do not need a prefix on member-variables. Even though I mostly use _ for class-members, I detest the use of prefixes for scope; it generally means your code is lacking intrinsic meaning. Local variables should be distinguishable via their name, if you need to change the variable-naming style to discern local-variables (from member/globals), it means your code lacks intrinsic meaning. For a long time now the use of constants has been moving to free-functions, eg: simulator::EARTH_RADIUS >> simulator::getEarthRadius(); imo this is the gold-standard these days. And I absolutely hate using spaces for scope; scope should be delineated via tabs and code alignment/formatting via space after the scope has already been established. If you are viewing code in a browser, you are doing it wrong. Actually I could probably go on a little more, but I have already asserted myself too much lol.
We have had a few interesting discussions on coding standards before. You can find some more discussions in these:
viewtopic.php?p=25249
viewtopic.php?f=5&t=5075
In general you should always following the existing code style for the code-base you are working on, that is unless you are specifically working on updating the style
That said there are a few things we disagree on: namespace-style, member-variable style, local-variable style, constant-style, and space (vs tab) style. Namespaces should be lower-case, nuff said. You do not need a prefix on member-variables. Even though I mostly use _ for class-members, I detest the use of prefixes for scope; it generally means your code is lacking intrinsic meaning. Local variables should be distinguishable via their name, if you need to change the variable-naming style to discern local-variables (from member/globals), it means your code lacks intrinsic meaning. For a long time now the use of constants has been moving to free-functions, eg: simulator::EARTH_RADIUS >> simulator::getEarthRadius(); imo this is the gold-standard these days. And I absolutely hate using spaces for scope; scope should be delineated via tabs and code alignment/formatting via space after the scope has already been established. If you are viewing code in a browser, you are doing it wrong. Actually I could probably go on a little more, but I have already asserted myself too much lol.
We have had a few interesting discussions on coding standards before. You can find some more discussions in these:
viewtopic.php?p=25249
viewtopic.php?f=5&t=5075
In general you should always following the existing code style for the code-base you are working on, that is unless you are specifically working on updating the style
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!
Return to “Offtopic Discussion”
Who is online
Users browsing this forum: No registered users and 6 guests