Le 2012-02-25 à 01:58:00, katja a écrit :

I'll do it the hard way, plain C. I've rewritten one of my own C++ library classes into C by way of exercise and comparison. It does exactly the same thing at the same speed, with not so sweet-looking code. This doesn't cover all the C/C++ differences, but in the end, everything can be solved in C one way or another.

It's not a strict matter of beauty of code. The reason why programmers talk so much about the beauty (or cleanliness) of the code, is because of the practical qualities. But the appreciation of beauty or cleanliness is something that evolves with time... depending on one's experience of what matters and what doesn't.

In my (not so huge) coding experience, I've always noticed that code
typing is the least time consuming aspect of a dsp project. To figure
out a good concept takes longer. Testing and bug fixing takes longer.
Optimization takes longer. I've once written an optimized FFT lib (in
C). It took me a month if I remember well, and that was not because of
all the code typing.

If you have to write twice more characters to do the same thing in C as in C++, then you will have to read twice more characters when you want to review the code, debug the code, or just re-understand the code later. If you optimise your code or reorganise your code, then you will need to read twice more AND rewrite twice more. But that's not that much compared to the effect of having to think about cluttered sentences of code.

That's just an example. Some C is the same length as the C++ equivalent. Some other C is 3, 4 or 5 times longer than the C++ equivalent, sometimes worse.

As a conclusion, a famous quote :

« There are two ways of constructing a software design; one way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult. »

 — Antony HOARE (alias Mr. QuickSort)

 ______________________________________________________________________
| Mathieu BOUCHARD ----- téléphone : +1.514.383.3801 ----- Montréal, QC
_______________________________________________
Pd-list@iem.at mailing list
UNSUBSCRIBE and account-management -> 
http://lists.puredata.info/listinfo/pd-list

Reply via email to