Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  Do NOT use boolean variable as function parameters

We follow lots of coding styles and coding standards when we do programming, but we may frequently forget one. The forgotten one is that do not use boolean parameter as the function parameters. The reason is it would greatly reduce the readability of the code. Don't believe it?When you read the following code, what does this code mean? widget->repaint(false); Do not repaint? Or what does this mean? After looking at the document, we know that this parameter is whether to repaint immediately, i.e, false to not immediately redraw or true to immediately redraw. The Windows A...

14,538 1       CODING STYLE CODING STANDARD BOOLEAN FUNCTION PARAMETER METHOD PARAMETER


  The Mature Programmer

1. The Mature ProgrammerThe mature programmer manages their own time and productivity well. The MP knows that maintenance is as much work as the initial writingand code always takes longer than you think. The MP knows that any changes to code can introduce bugs, no matter how seemingly trivial.The MP knows that premature optimization is foolish and dangerous. The MP knows that sexy coding like writing big complex systems fromscratch is rarely the best way to go. The MP does not get into ego competitions about who has the prettiest code. The MP acheives thebest final result in the minimum ...

2,397 0       EFFICIENCY FEATURE CODING STANDARD MATURE PROGRAMMER MP


  Leaving comments in real life

As a programmer I like to write comments because I know that some future person (often me) is going to need to know something about my code that won't be immediately obvious from reading it. Here's a recent example from my homebrew display's code:// protocol_init: Set up a newly powered-on string of lights.  The lights are arranged// in an array wired diagonally starting from the bottom left.  For ease of programming// it's better if they are given numbers which correspond to coordinates.  Given that// each LED has a 6 bit address it's possible to address the entire array u...

1,582 0       COMMENT PROGRAMMING STYLE FORMAT CODING STANDARD