For the last few years I've been making the students work to a coding standard (by giving them a small amount of marks for doing so). This has a number of advantages
- All the code looks the same and makes it easier to integrate into a larger code base.
- Makes spotting plagiarism easier (especially with the citation rules)
- Prepares the students for real life working situations (our coding standard is based on two real world examples)
When the original standard was published the code base for ngl was based on OpenGL and SDL however this year it has all been ported to Qt as this seems to be the new standard for most animation apps.
The problem I now face comes from this section in the standard
Function NamesFunction names have the first letter of each world capitalised, with no underscores between words.
Where possible, functions/methods that return a bool result should have a name that looks like a question, eg
IsValid, HasProtocol, AreParallel...Each function should be preceeded by a comment containing a brief description about the function (how it works, what it does) above the function body in the .cpp file.
All of the Methods in ngl follow this rule, however when using Qt the following is the standard syntax
ui->m_initEdit->setAutoIndent(true); ui->m_initEdit->setAutoCompletionThreshold(2); ui->m_initEdit->setAutoCompletionSource(QsciScintilla::AcsAll); ui->m_initEdit->setBraceMatching(QsciScintilla::SloppyBraceMatch); ui->m_initEdit->setMatchedBraceForegroundColor(Qt::blue); ui->m_initEdit->setMatchedBraceBackgroundColor(Qt::yellow);
This means we have a mixed standard in most programs, I could re-factor the ngl: lib but this would take a while and break quite a lot of legacy code (which is still in the process of being re-written anyway).
At the present my thoughts are
- Makes all the code look the same and matches Qt style
- Will not confuse people when writing code as it will always be the same
- quite like the looks of the Qt syntax
- Not issued much code to the students yet, and start the main NGL teaching in a couple of weeks
- I will take quite a while to convert things
- Could break quite a lot of old code
- I'm actually used to using the current method and would have to re-learn how I write things
- The actual Qt guidelines are not that good so can't use them wholsale
Think I will wait until Monday and decide then.