4

I am a huge fan of software design principles such as SOLID and DRY. What other principles exist for OO software design?

Note. I’m not looking for answers like "comment your code" but instead looking for OO design principles like the ones discussed by Uncle Bob.

laalto
  • 150,114
  • 66
  • 286
  • 303
Kane
  • 16,471
  • 11
  • 61
  • 86
  • 2
    Needs to be marked as community wiki. – Jonathan Holloway Jul 06 '09 at 22:30
  • Here's one: http://stackoverflow.com/questions/813534/dry-vs-prefer-containment-over-inheritance. Looks like it may be a duplicate, in fact. There's a lot out on SO like this. Just clicked "ooo" tag. – John Saunders Jul 06 '09 at 22:38
  • @John I read a whole bunch of SO answers before writing this question. Most other questions want to know about using a specific principle but I couldn't find a question on "what software principles exist" which is why I asked it. – Kane Jul 06 '09 at 22:42
  • @Jon how can I make this question an community wiki? – Kane Jul 06 '09 at 22:43
  • @hasen click the link to Uncle Bob (http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod) or read the PDF found here http://www.lostechies.com/blogs/chad_myers/archive/2008/03/07/pablo-s-topic-of-the-month-march-solid-principles.aspx – Kane Jul 06 '09 at 22:51
  • -1 because I am sick of these kinds of questions. Sorry. – Ed S. Jul 06 '09 at 22:57
  • @Kane: there is a check-box to the lower right of the body text input field named "community wiki". Change the state of this check-box to checked to mark your question as community wiki. – Peter Mortensen Aug 04 '09 at 19:59

8 Answers8

6

A fairly comprehensive list from Wikipedia:

http://en.wikipedia.org/wiki/List_of_software_development_philosophies

  • Agile software development
  • Agile Unified Process (AUP)
  • Behavior Driven Development (BDD)
  • Big Design Up Front (BDUF)
  • Brooks's law
  • Cathedral and the Bazaar
  • Code and fix
  • Constructionist design methodology (CDM)
  • Cowboy coding
  • Crystal Clear
  • Design-driven development (D3)
  • Don't repeat yourself (DRY) or Once and Only Once (OAOO), Single Point of Truth (SPoT)
  • Dynamic Systems Development Method (DSDM)
  • Extreme Programming (XP)
  • Feature Driven Development
  • Hollywood Principle
  • Iterative and incremental development
  • Joint application design, aka JAD or "Joint Application Development"
  • Kaizen
  • Kanban
  • KISS principle (Keep It Simple, Stupid)
  • Lean software development
  • Microsoft Solutions Framework (MSF)
  • Model-driven architecture (MDA)
  • Open source
  • Open Unified Process
  • Quick-and-dirty
  • Rational Unified Process (RUP)
  • Scrum
  • Smart (agile development)
  • Separation of concerns (SoC)
  • Service-oriented modeling
  • Software Craftsmanship
  • Software System Safety
  • Spiral model
  • Test-driven development (TDD)
  • Unified Process (UP)
  • V-Model
  • Waterfall model
  • Wheel and spoke model
  • Worse is better (New Jersey style, as contrasted with the MIT approach)
  • Xtreme
  • You Ain't Gonna Need It (YAGNI)
  • Zero One Infinity
Neil N
  • 24,862
  • 16
  • 85
  • 145
  • Thanks Neil but only some of those are actual principles. I.E., "Cowboy coding" and "Code and fix" aren't principles IMHO (but I'm happy to be wrong on this) – Kane Jul 06 '09 at 22:49
  • you are right, and I am/was considering chopping this list down. I might actually link all of them as well.. if I get a few minutes. – Neil N Jul 06 '09 at 23:01
  • DAMP (Descriptive and meaningful phrases) basically used while testing a software... – Rahul Sep 22 '15 at 06:01
4

High Cohesion - How focused are the responsibilities of the modules you are designing.

Low Coupling - The degree to which modules rely on other modules.

JasCav
  • 34,458
  • 20
  • 113
  • 170
  • @Jason I would have thought High Cohesion and Low Coupling are inferred by the SOLID principle – Kane Jul 06 '09 at 22:44
  • @Kane - Yeah, you may be right. S and D. May be different names to the same thing. (I had never heard of SOLID until now and learned cohesion and coupling which is why I posted it.) Thanks for pointing this out. – JasCav Jul 06 '09 at 23:01
2

KISS

William Brendel
  • 31,712
  • 14
  • 72
  • 77
2

Chose composition over inheritance, is one.

Many people, especially those new to OO will start extending classes when all they really need to is to use composition. Really if you should ask your self, is the new class B a Class A? If not then you shouldn't extend.

For example, let's say I have a Person Class, a Car Class, and I would like to make a new class called a DrivenCar class. A naive implementation would be to say (let's pretend we got multiple inheritance)

class DrivenCar extends Person, Car  { ... }

Is the DrivenCar a type of Person? No so it shouldn't be extending Person. Is the DrivenCar a Car? yes so it makes sense to extend

Using composition the implmentation would look like

class DrivenCar extends Car {
    private Person driver;
}
hhafez
  • 38,949
  • 39
  • 113
  • 143
2

The GRASP patterns. Yes, they seem rather trivial. More like distillation down to core qualities that other, more involved patterns demonstrate.

Matt
  • 4,388
  • 1
  • 15
  • 8
1

YAGNI

M4N
  • 94,805
  • 45
  • 217
  • 260
0

Interface. Most design patterns are based on separation of interface & implementation.

janetsmith
  • 8,562
  • 11
  • 58
  • 76
0

When your API are expected to grow, use Abstract class instead of Interface. Adding a new method in Interface requires to change ALL the classes which implement it.

janetsmith
  • 8,562
  • 11
  • 58
  • 76