ForumNorway.com Forum Index ForumNorway.com

 
Log in to check your private messagesLog in to check your private messages

Log inLog in  RegisterRegister


Profile  Search  Memberlist  FAQ  Usergroups
C++ Desing patterns.

 
Post new topic   Reply to topic    ForumNorway.com Forum Index -> C++
View previous topic :: View next topic  
Author Message
KBleivik
Site Admin


Joined: 31 Jan 2006
Posts: 78
Location: Moss Norway

PostPosted: Fri Feb 13, 2009 3:46 pm    Post subject: C++ Desing patterns. Reply with quote

Design patterns is in essence a least common denominator of minimalistic programming. The classic reference on design patterns is:

Design Patterns: Elements of Reusable Object-Oriented Software by ErichGamma, RichardHelm, RalphJohnson, and JohnVlissides (the GangOfFour - GoF) ISBN 978-0201633610 , ISBN 0-201-63361-2 Publisher: AddisonWesley Professional (November 10, 1994).

Understanding design patters can dramatically improve your programmng sklls. The GoF state two important principles of object oriented design:

  1. Program to an interface and not to an implementation.
  2. Favor object composition over class inheritance.

C++ code from that book can be downloaded from Hillside Group's webpage:

Home: http://hillside.net/

C++ Code download: http://hillside.net/patterns/DPBook/Source.html

You shall not overuse inheritance - white-box reuse. Composition - black-box reuse is an alternative to class inheritance. Composition means that objects work together creating complex functionality. Example a class (object) gets access to another class (object) at run time through its constructor and not via class inheritance (at compile time).

So try to balance the mix of class inheritance and composition. That makes your classes more flexible and the class hierarchy simpler.

Conclusion:
Design your interface carefully. As a result the physical implementation will be more efficient and easier to update / refactor to future needs.

Related - On Refactoring C++ Code:
http://www.goingware.com/tips/xmlmemory.html

Other books:
Andrei Alexandrescu Modern C++ Design: Generic Programming and Design Patterns Applied Addison Wesley Professional
ISBN: 0201704315.
_________________
Kjell Gunnar Bleivik
Make it simple, as simple as possible but no simpler: | DigitalPunkt.no |
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    ForumNorway.com Forum Index -> C++ All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum