03.12.2012 Views

C++ for Scientists - Technische Universität Dresden

C++ for Scientists - Technische Universität Dresden

C++ for Scientists - Technische Universität Dresden

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

88 CHAPTER 3. CLASSES<br />

There are two lessons we can learn from this, firstly:<br />

Advise<br />

Don’t push C ++ too far! Avoid fragile features and minimize implicit conversions.<br />

C ++ enables many techniques but that doesn’t mean one have to use them all. Especially the<br />

comma operator bears so much danger that its utilization must be limited to very rare cases<br />

or better avoided entirely. It is important to have an appropriate notation and time spent on<br />

syntactic sugar is really worthwhile <strong>for</strong> the sake of better usability of new classes. But some<br />

tricks provide a little improvement in the syntax and create large problems in the interplay with<br />

other techniques.<br />

Secondly:<br />

Advise<br />

If you can’t find a perfect solution, pick what serves you best and accept it.<br />

We dare the hypothesis that there is no single C ++ program that everybody is happy with. The<br />

attempt to come up with the world’s first perfect C ++ program will end in failure and bitterness.<br />

Of course that does not mean always willingly accepting the first working implementation one<br />

comes up with. Software always can be improved and should be. As mentions in § 2.11,<br />

experiences have shown that is most efficient to refactor software as early as possible than<br />

retroactively fixing issues when important applications crash, users are angry and the program<br />

author(s) <strong>for</strong>got the details or are already gone. On the other hand, by the time one reaches<br />

a really good implementation one has certainly spent already much more time than initially<br />

planned.<br />

3.8 Other Operators

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!