Code Team Guidelines

Code Team Guidelines

Postby Bertram » 15 Mar 2014, 12:13

Hi everyone,

I'm opening this new topic with the sole purpose of providing a guidelines for patches and team development practices.
Please, follow those guidelines when working on something else than your own private branch.
If you disagree with anything, please comment and we'll update this first post accordingly once we agree on the change.

The purpose of all this is to permit more code quality to happen to this project and to permit proper team work. Bear this in mind when coding. Thanks. :)

- Development course:
For reference, OD development is happening here: http://sourceforge.net/p/opendungeons/g ... ster/tree/

- The 'master' branch is used for clean release purpose only. This means only bugfixes or release-ready patches should go there, usually coming from the 'development' branch.

- The 'development' branch is a Team branch. This means patches that are either not desired, incomplete, untested, breaking game functionalities, or not following the code style guidelines must not go there. Please, see this as a public area, where you should avoid bothering your coding neighbors.
This branch is made to code on bleeding edge features, yet with reviewed and streamlined patches.

- Each dev can have its own private branch, eg: 'bertram-integration' where he/she does tink whatever he/she wants. Each dev should try to keep its own branch up-to-date
with the development branch, and put his/her commits on top of it, using 'git pull --rebase' (See the hints part.). Why? Because it makes commit reviews much easier, and you are your first own code reviewer, after all, right? ;)

- The best way to put things on 'development':
Once you've done a patch or a serie of patches, and are happy with it, you can ask for a review of another coder. To be reviewed, the resulting change should the most possible:
- Follow the code style guidelines.
- Be readable. (this also means be properly indented.)
- Be commented on the difficult parts.
- Doesn't add warnings.
- Compile. (eh)
- Is tested to not break any functionalities, especially in the game area of the change. (By both devs if possible.)
- When adding a feature, well, adds a feature that is desired. This means you shouldn't add, well for instance, GPS support to OD without everyone agree with it, as it is a nonsense. ;)

The dev reviewed could then fix all the stuff noticed by the other one in another patch until it's good. He/she will then be able push the overall stuff to development. :)

- Hints:
- Don't avoid doing some of those things because it is 'quicker', or 'easier'.
We have no time pressure as it is a spare-time project. We have no deadlines, so you have the time to make things properly. If you feel in a rush, it means you lack spare-time, not that you should hurry pushing things. Better resume at another time, believe me. ;)

- Discuss new features details and make them validated before starting coding on them: The risk is fairly simple, we might end up with an undesired feature, or a features that is working but doesn't fit the other components and the team plans. This usually ends badly as you want to push it on the common branches and others don't, so don't do that.

- Try to keep your unmerged patches based on the tip of 'development' branch by using 'git pull --rebase development' on your private branch before asking for review. This will make the life of the reviewer easier.

- Try to avoid using too much deepness in your code as it makes it harder to read and usually forces people to make more complex things to get out of the loops properly.
Eg:
{l Code}: {l Select All Code}
function()
{
    if (true)
    {
        // long stuff
        // ...
    }
}

is uselessly complex as you can do:
{l Code}: {l Select All Code}
function()
{
    if (false)
        return;

    // long stuff
    // ...
}


If you can't do that for any reason and your code is becoming complex, maybe it's time to put some of it into a sub-function.

- Respect the life-cycle of objects

This means that when you create an object somewhere (with keyword 'new'), you should the most possible delete it within the same parent object or function if not a parent object.
Doing otherwise makes things tedious and insane to debug. It is considered a very bad practice in most cases, anyway.

- Don't use an object or a functionality because you fancy it, but rather because you need it to make things work.
As an extreme example, it's not because B-tree components exist that you have to use them to parse a simple stack of items. There are sets, vectors or list for that.
The more simply you'll use objects, the more it will be readable by yourself and by others. It's not a competition about the guy who knows the most about high-grade c++ stuff.
Last edited by Bertram on 20 Mar 2014, 13:57, edited 3 times in total.
User avatar
Bertram
VT Moderator
 
Posts: 1652
Joined: 09 Nov 2012, 12:26

Re: Code Team Guidelines

Postby nido » 17 Mar 2014, 22:50

in - Development course: development branch; you might want to emphasise 'must not' instead of just 'must'. Regarding the private integration branches; I would like to explicitly suggest these to be the development + 'for review' branches.

In absense of a build infrastructure, I would also like to suggest to make sure that dev + reviewer together span all supported build targets. On linux, we currently support GCC, though I can make a few patches to make cmake work. on windows there is msvc(?) and mingw?
nido
 
Posts: 57
Joined: 07 Mar 2014, 00:47

Re: Code Team Guidelines

Postby Bertram » 17 Mar 2014, 23:20

Hi,

As for the build target, just for the record, we only have linux and MSVC working atm. MingW isn't due to outer dependencies problems between themselves.
Namely, Ogre and CEGui are using the gcc-tdm flavour to compile and Ogre requires GCC-TDM sjlj flavour while CEGui is compiling using GCC-TDM Dwarf2 one to compile fine, at least from my latest experiment with it. This is making the whole stuff not working together as far as I tried.
What I'm saying now might have become false, btw.
User avatar
Bertram
VT Moderator
 
Posts: 1652
Joined: 09 Nov 2012, 12:26

Re: Code Team Guidelines

Postby nido » 17 Mar 2014, 23:42

If we indeed have nobody using mingw, I would like to rip statements for specific support for this out of the cmakelists. Makes little sense to have complications in place for something which we don't work with in the first place.
nido
 
Posts: 57
Joined: 07 Mar 2014, 00:47

Re: Code Team Guidelines

Postby Bertram » 18 Mar 2014, 11:02

Yes, but as requested in the other thread, let Paul try our gathered changes first, and have this pushed on development. Afterwards, you're right, let's do this.
Do you have an integration branch on sf (and access there)?
User avatar
Bertram
VT Moderator
 
Posts: 1652
Joined: 09 Nov 2012, 12:26

Re: Code Team Guidelines

Postby Bertram » 18 Mar 2014, 11:54

nido {l Wrote}:in - Development course: development branch; you might want to emphasise 'must not' instead of just 'must'. Regarding the private integration branches; I would like to explicitly suggest these to be the development + 'for review' branches.

Ok, updated. :)
User avatar
Bertram
VT Moderator
 
Posts: 1652
Joined: 09 Nov 2012, 12:26

Re: Code Team Guidelines

Postby Bertram » 20 Mar 2014, 14:07

Added a point about discussing new features before coding them. This is simply what we're doing atm btw. ;)
User avatar
Bertram
VT Moderator
 
Posts: 1652
Joined: 09 Nov 2012, 12:26

Who is online

Users browsing this forum: No registered users and 1 guest

cron