Thread: Reading materials on OO design?

  1. #1
    Ex scientia vera
    Join Date
    Sep 2007
    Posts
    477

    Reading materials on OO design?

    While reading books on general C++ programming is all well and good, not many of them seem to cover OO design.
    By OO design, I mean whatever it is that will equip me with the skills and knowledge to identify which design patterns should be used in which scenarios.

    Are there a special book that you guys would recommend on this subject? Because I find myself wondering which design patterns I should be using.

    Any resource would be greatly appreciated.
    "What's up, Doc?"
    "'Up' is a relative concept. It has no intrinsic value."

  2. #2
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Chappell Hill, Texas
    Posts
    2,332
    Mainframe assembler programmer by trade. C coder when I can.

  3. #3
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Last edited by VirtualAce; 12-05-2009 at 02:27 PM.

  4. #4
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Quote Originally Posted by IceDane View Post
    While reading books on general C++ programming is all well and good, not many of them seem to cover OO design.
    By OO design, I mean whatever it is that will equip me with the skills and knowledge to identify which design patterns should be used in which scenarios.

    Are there a special book that you guys would recommend on this subject? Because I find myself wondering which design patterns I should be using.

    Any resource would be greatly appreciated.
    The first rule of OO desig is to not use OO design - write code as if the member variables were C global variables (just be sure to always be encapsulated, avoid static variables, etc). Once everything is working properly then finish implementing the user interface of the class, run test cases, etc.

    As far as patterns go, remember to include mundane operations as well (anything that can be generalised), and make them free-form functions wherever possible. Focus on templates, and always try to abstract the problem out, eventually you'll build up a toolbox of reusable components that can be connected interchangeably.

    Finally, remember that OO isn't only about "everything as an object" - functional programming is also very important. The main thing, though, is to just use "common sense", and to avoid complicated solutions where more simple simple ones are sufficient.

  5. #5
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    One of our members used to have the quote that class design should not be like a swiss army knife. I think the quote had more to it but the idea is classes should focus on one important aspect of the system and they should be the best at what they do. When you try to make one class do to much or support everything on the moon it quickly becomes a nightmare.

    Limit your inheritance to one concrete derivation if possible and often aggregation or composition will work. I see inheritance used far too often which usually results in a very complicated class hierharchy that is definitely object-oriented but almost impossible to use.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Design problems, help!
    By Coodle in forum C++ Programming
    Replies: 4
    Last Post: 11-03-2009, 09:38 AM
  2. Making child object access parent - best design?
    By IceDane in forum C++ Programming
    Replies: 8
    Last Post: 09-17-2009, 06:48 AM
  3. Reading from a file
    By Wiz_Nil in forum C++ Programming
    Replies: 1
    Last Post: 02-26-2002, 09:31 AM
  4. Need Help with 2D Garden Design Program
    By frgmstr in forum C++ Programming
    Replies: 7
    Last Post: 02-04-2002, 04:58 PM
  5. OO in C
    By Shiro in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 01-05-2002, 11:02 PM