1

Possible Duplicate:
OO Software Design Principles

My questions concern methodology that are built onto OOP (not sure about the terminology here...). I have learned some things about the Law of Demeter and MVC.

I am not a total beginner in programming, but I have never worked on a really tricky OOP development. So I would say that I am aware of the basic principles of OOP. I am about to embark upon a personal project using C++.

My questions:

  1. So first, are there some methodologies like those two that can be useful to know, or at least to be aware of?
  2. And are there good websites that describes them?
  3. What other things that I am not even aware of could be useful?
Community
  • 1
  • 1
Plouff
  • 3,290
  • 2
  • 27
  • 45
  • If one were to edit the question down to it's bare bones, [this one](http://stackoverflow.com/questions/1089504/oo-software-design-principles) would be a duplicate. – razlebe Sep 21 '11 at 11:23
  • There we go - I've given it quite an edit, to (hopefully) make the core question clearer and to remove superfluous details. Hope you approve. :) – razlebe Sep 21 '11 at 11:27
  • 1
    The most important principle to learn is that *no methodology* (including object-oriented programming) is the end-all be-all of methodologies. – Travis Gockel Sep 21 '11 at 11:31
  • I’m tempted to say, forget all this bullsh*t, it’s not important. Not right away at least, and probably not later. What *is* important is the C++ standard library. Learn that. It will teach you more than any theoretical treatise about OOD could. – Konrad Rudolph Sep 21 '11 at 11:38
  • When you lack the terms it is not so easy to find what are locking for. Sorry for the duplicate... – Plouff Sep 21 '11 at 18:41

3 Answers3

3

You should realise that although C++ was initially designed to enable OOP, it is very ill suited for that kind of programming (where I define OOP as the use of virtual functions, which imply dynamically allocated objects, etc...).

Modern C++ programming provides tools that are far better than traditional OOP for solving many programming problems.

If you are learning C++ I would recommend that you learn about RAII, and learn why it is that is is absolutely central to correct usage of the language. After that you should learn about templates, and how they can be used to create reusable components.

Read through and understand everything in Guru of the Week, and consider reading the associated books (Exceptional C++ and More Exceptional C++). Also consider reading some of the other books from The Definitive C++ Book Guide and List.

While you are doing this, have a look at the design and implementation of the libraries in boost. Many of them are examples of near perfect usage of the C++ language, and they have widespread usefulness.

Most importantly: write code.

It is often difficult to understand solutions to problems that you have never faced. It is crucial that you have a deep understanding of when particular techniques are appropriate, and what problems can be solved by which methodologies. Attempting to use methodologies, techniques, libraries or patterns that solve a fundamentally different problem from the one that you are up against will never result in good code.

Community
  • 1
  • 1
Mankarse
  • 39,818
  • 11
  • 97
  • 141
  • Very interesting to read. I totally agree with the last part of your answer. In other fields I noticed that reading with out practice is useless. I will also take a look at your links. Thank you! – Plouff Sep 21 '11 at 18:52
  • It is difficult to choose which one of you gave the answer to my questions since I was not accurate at all! But Mankarse, your answer is covering most of the thing I had in mind but couldn't express. So I give it to you! Thanks again. – Plouff Sep 21 '11 at 19:05
1

Methodology? I'd say that objects ought to map onto the physical components in the system you're trying to model. Object-oriented accounting software ought to have objects like Account, Customer, Money, Ledger, etc. Components are abstract data types that interact to fulfill your use cases.

There are times when you'll introduce objects that have no physical analog (e.g. Transaction in that accounting system). It's an idea called "reification" - creating an object for an abstract concept.

Specifications are natural language descriptions of software systems. One approach is to identify nouns and verbs in specs. Nouns are candidate objects; verbs are candidate methods.

Once you have those, UML is a notation for helping to design object-oriented software. Get out a piece of paper or a whiteboard and start sketching class diagrams that show how those nouns interact to make the verbs happen.

duffymo
  • 305,152
  • 44
  • 369
  • 561
  • Nice to read you too! I am also aware of UML but never used it. Maybe this is the good time to give it a try. Thanks for this basic explanation of UML. – Plouff Sep 21 '11 at 18:58