Nouns to classes

This message:

reminded me of an old sketch about OO design - first you make a word cloud about your project. Then you sort:

nouns are candidates of classes
adjectives are candidates of interfaces
verbs are candidates of methods

There is no guarantee that it will lead to a good design, but at least it helps to get some systematic into the word cloud.

Examples:

paddle -> class Paddle : that’s a farily certain guess to be alright
colored -> interface Colored with setColor/getColor : overkill, but the idea leads into the right direction
moves -> one or more methods for moving : details still to figure out, but activites go into methods, that’s alright in any case

You still have 1001 options to get the design wrong, but if you know nothing about OOD/OOP yet, this can help to get started.

Okay…

;D

This is surely nowhere near a scientific approach to program design, but I actually found it helpful to start with a word cloud of what you expect to be in your project. You can make a mind map of it later, as well as transform it into one or more class diagrams.

We were taught something similar to this in my OO class in college actually.

I think this is essentially the design philosophy behind OOP. You allow the programmer to talk (code) in terms of things his (or her) brain has adapted to understand - real world objects - ie nouns/classes. Once you understand the limits of the various types then you can decide what is relevant based on the requirements rather than the name. But they both tend to end up doing the same thing anyway.