Quick thoughts on writing bug free code

posted in A different way
Published September 11, 2013
Advertisement
Quick thoughts on writing bug free code


From a recent posting of mine:


>>

[background=rgb(247,247,247)]And you should write bug free code as well.[/background]





[color=rgb(40,40,40)][font=helvetica]

[background=rgb(250,251,252)]definitely.[/background]

[/font][/color]

[color=rgb(40,40,40)][font=helvetica]

[background=rgb(250,251,252)]one thing at a time, do it very well, then move on.[/background]

[/font][/color]

[color=rgb(40,40,40)][font=helvetica]

[background=rgb(250,251,252)]programming is about precision.[/background]

[/font][/color]

[color=rgb(40,40,40)][font=helvetica]

[background=rgb(250,251,252)]mind your p's and q's - cross your i's and dot your t's .[/background]

[/font][/color]

[color=rgb(40,40,40)][font=helvetica]

[background=rgb(250,251,252)]always think ahead about what you're doing and what potential pitfalls could be: ok, this call here does memory allocation i need to deal with. this other snippet is "critical section" stuff where i have invalid addresses and such and the normal rules don't apply (constructor issues), etc.[/background]

[/font][/color]

[color=rgb(40,40,40)][font=helvetica]

[background=rgb(250,251,252)]nobody's perfect, but the only bugs in your program are ones you put in. [/background]

[/font][/color]

[color=rgb(40,40,40)][font=helvetica]

[background=rgb(250,251,252)]so divide and conquer. modular-ize until the parts are so simple you can't F-up .[/background]

[/font][/color]

[color=rgb(40,40,40)][font=helvetica]

[background=rgb(250,251,252)]turn complexity into a hierarchy of layered simplicity.[/background]

[/font][/color]
0 likes 2 comments

Comments

swiftcoder

Unit test, unit test, unit test. Did I mention unit test? :)

Lone-wolf developers don't always like the idea, but they really do help you keep the bug count down. It's easy to build up complex interactions when you have hard proof that your basic building blocks are bug free.

September 15, 2013 12:13 AM
Norman Barrows

Unit test, unit test, unit test. Did I mention unit test? smile.png

Lone-wolf developers don't always like the idea, but they really do help you keep the bug count down. It's easy to build up complex interactions when you have hard proof that your basic building blocks are bug free.

precisely! build each lego brick carefully and test it thoroughly. Then you can build lego castles to stand the test of time.

March 10, 2014 10:20 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement