All good answers.
I would add only “minimize data structure”. It may even be simpler in C, because if C ++ is “C with classes”, OOP tries to encourage you to take every noun / verb in your head and turn it into a class / method. It can be very wasteful.
For example, suppose you have an array of temperature readings at points in time, and you want to display them as a line chart in Windows. Windows has a PAINT message, and when you receive it, you can skip the array that performs the LineTo functions, scaling the data as you convert it to pixel coordinates.
What I saw too many times, since the diagram consists of points and lines, people will create a data structure consisting of point objects and line objects, each of which is capable of DrawMyself, and then make it permanent what it somehow " more efficiently "or that they may possibly be able to mouse over parts of the diagram and display the data numerically, which is why they build methods in objects to deal with this, and that, of course, involves creating and deleting even more objects.
Thus, you get a huge amount of code that is well read and just spends 90% of the time managing objects.
All this is done in the name of "good programming practice" and "efficiency."
At least in C, a simple, effective way will be more obvious, and the temptation to build pyramids is less powerful.
Mike Dunlavey Mar 19 '09 at 13:16 2009-03-19 13:16
source share