Interface and architecture

Hi there,
I've got a few more skills in C++ programming and I thought I'd never had trouble again after I was able to build some really cool class hierarchy using some well designed polymorphism.

After that one, I'm moved to a new project and boom! I can't write anything decent! I'm stuck at the design for the basic building blocks. I believe the second project is more difficult only because I'm not sure how I'd like to approach it...

My post is intentionally vague because I'm not looking for help specific to this project, rather I'm looking for general help in designing interfaces and class hierarchies. It's been a recurrent problem for me to make a good design, let alone a good design that takes advantage of C++.

I'm looking for a methodology to layout the basics, the public member functions for the public interface, those I will want protected for inheritance... how objects will deal with each other. If anybody got tricks, like a kind of brainstorming that helps design interfaces, etc... please let me know, because so far, I must have rewritten my design 6 times and I'm far from satisfied.

I thought of buying Design Patterns, but again, it will only help "fit" my project into a pre-made design, and it may not help my current issue at all. I need help building new original designs.

Sorry guys, for writing long novels like this one, but thanks in advance for any help, pointers, reference, anything you share!

Corto
Learn about design patterns - you can apply these to quite a number of situations.

http://oodesign.com

literature: Heads First Design Patterns

They aren't pre made designs, they are patterns that occur very often. You don't need to buy them, they are public knowledge.
Last edited on
Hi Hanst99,
ok, so I'll definitely look that way since it was one of my current instincts... and as for buying "design patterns" I was actually referring to a book I thought was a pillar in computing science:
http://www.amazon.ca/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612

Actually, this amazon link helped me clarify my problem. One of the other books shoppers often buy with it is called "Refactoring: Improving the Design of Existing Code" and the very first sentence of the description is this:

Your class library works, but could it be better?

This is my problem, and it feels like some sort of analysis paralysis as well (another design pattern, actually an "anti" one). I've read some more stuff in the mean time on the net, and I saw some guidelines (actually on stroustrup's page) to make a decent "shape, circle, square" class hierarchy. Reading that page highlighted that #1 i really need more advice on making better C++ designs (i'm not sure design patterns directly help this) and #2 i really need to practice abstract beginner stuff, but push this beginner stuff well beyond into space.

I think I need to learn more about the basic theory, such as "what exactly is an interface?"... like, say i have to make a program that draws lots of rectangles, what would help me in designing the quickest and cleanest route to get it working? I can't just draw the rectangles, I need to handle moving, rotating, flashing, rounded-rects, etc... clarifying what needs to be flexible and what needs to be put in stone is my problem.

Hey guys, I have a budget of 200$ easy for books on this topic. Here's my shopping cart so far, can you help improve it?

Design Patterns: Elements of Reusable Object-Oriented Software - Erich Gamma
http://www.amazon.ca/gp/product/0201633612/ref=ox_sc_act_title_3?ie=UTF8&m=A3DWYIK6Y9EEQB
AntiPatterns: Refactoring Software, Architectures, and Projects in Crisis - William J. Brown
http://www.amazon.ca/gp/product/0471197130/ref=ox_sc_act_title_2?ie=UTF8&m=A3DWYIK6Y9EEQB
Code Complete - Steve McConnell
http://www.amazon.ca/gp/product/0735619670/ref=ox_sc_act_title_1?ie=UTF8&m=A3DWYIK6Y9EEQB
(This would be 121$, so I can add some, modify... let me know what you think!)

Thanks, and again, sorry for writing overwhelmingly long posts! =/
Corto
For design patterns, I personally liked "Heads First Design Patterns" - it's written in a way that's not boring, but at the same time they aren't treating the readers like idiots either.

As to the
clarifying what needs to be flexible and what needs to be put in stone is my problem.
- I am afraid that's something books can not teach. Those are decisions you have to make yourself, and the ability to make the right decisions there comes from experience. Then again, no one designs a perfect object oriented system over night (ok, instead of never let's say it probably doesn't happen very often), designing the interface, the interaction between classes and objects and stuff is actually quite a large part of the work.
Topic archived. No new replies allowed.