Thursday, December 08, 2005

C++ Ten Commandments

This is absolutely brilliant. Have it for my OOP course tomorrow. Thought of sharing it with you guys.

By Phin Straite
1) Thou shalt not rely on the compiler default methods for construction, destruction, copy construction, or assignment for any but the simplest of classes. Thou shalt forget these "big four" methods for any nontrivial classes.

2) Thou shalt declare and define thy destructor as virtual such that others may become heir to the fruits of your labors.

3) Though shalt not violate the"is-a" rule by abusing the inheritance mechanism for thine own twisted perversions.

4) Thou shalt not rely on any implementation-dependent behavior of a compiler, operating system, or hardware environment, lest thy code be forever caged within that dungeon.

5) Thou shalt not augment the interface of a class at the lowest level without most prudent deliberation. Such ill-begotten practices imprison thy clients unjustly into thy classes and create unrest when code maintenance and extension are required.

6) Thou shalt restrict thy friendship to truly worthy contemporaries. Beware, for thou art exposing thouself rudely as from a trenchcoat.

7) Thou shalt not abuse thy implementation data by making it public or static except in the rarest of circumstances. Thy data are thine own; share it not with others.

8) Thou shalt not suffer dangling pointers or references to be harborer within thy objects. These are nefarious and precarious agents of random and wanton destruction.

9) Thou shalt make use of available class libraries as conscientiously as possible. Code reuse, not just thine own but that of thy clients as well, is the Holy Grail of OO.

10) Thou shalt forever forswear the use of the vile printf/scanf, rather favoring the flowing streams. Cast off thy vile C cloak and partake of the wondrous fruit of flexible and extensible I/O.

5 Comments:

Anonymous Anonymous said...

You wrote these?

Friday, December 09, 2005 12:23:00 AM  
Anonymous Anonymous said...

Ya :).. Am I not creative :p

Friday, December 09, 2005 12:55:00 AM  
Anonymous Anonymous said...

To be honest didn't get what you have written...really.well did get some parts,but then i think maybe am not as creative thinker as you are.
love and gud luck for tomorrow,
Pratibha.

Saturday, December 10, 2005 1:28:00 AM  
Blogger Unknown said...

Freak! this is heavenly..was doing java all day this seems like the icing on the cake!
Creative you;) fan club goin up!:)

Saturday, December 10, 2005 7:49:00 PM  
Blogger adarsh said...

we want new post
we want new post
we want new post
we want new post
we want new post
we want new post
we want new post
we want new post

Friday, January 27, 2006 7:33:00 AM  

Post a Comment

Subscribe to Post Comments [Atom]

<< Home