Beautiful code - part 2 - top down design
2,410
2
Advertisement
Beautiful code - part 2 - top down design
an example of beautiful code.
this was a result of top down design. IE high level routines fist, lowest level routines last.
first, the algo was written in comments in english.
then the highest level code was written, defining the lower level routines and their APIs as it was written, before ever actually defining the lower level code. so the high level code determined that there would be a camera_can_see_target function, and that it would take the index of a target as a parameter. the actual camera_can_see_target function was written later. the high level code defined what the lower level APIs would be. the highest level code was written to be as english-like as possible.
this is the high level code that started this process (from SIMSpace 8.0):
an example of beautiful code.
this was a result of top down design. IE high level routines fist, lowest level routines last.
first, the algo was written in comments in english.
then the highest level code was written, defining the lower level routines and their APIs as it was written, before ever actually defining the lower level code. so the high level code determined that there would be a camera_can_see_target function, and that it would take the index of a target as a parameter. the actual camera_can_see_target function was written later. the high level code defined what the lower level APIs would be. the highest level code was written to be as english-like as possible.
this is the high level code that started this process (from SIMSpace 8.0):
void draw_targets(){// for each target, if in vis rng and pass frustum cull, add to render queue// vis rng = 100x tgt size = 200x tgt.radint a;for (a=0; a
clarity, simplicity, and read-ability are hallmarks of beautiful code.
Previous
Beautiful code part 3 - bottom up design
Next
Skinned mesh code part 5 - implementation example 2
Advertisement
Advertisement
Advertisement
Discussion