This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes OO, Patterns, UML and Refactoring and the fly likes OO Swiss Army Knife? (from the desert island dept.) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "OO Swiss Army Knife? (from the desert island dept.)" Watch "OO Swiss Army Knife? (from the desert island dept.)" New topic

OO Swiss Army Knife? (from the desert island dept.)

Bert Bates

Joined: Oct 14, 2002
Posts: 8801
I'm wondering if you OO gurus would comment on what OO principles you think are most important for the aspiring OO developer? If you could only bring 5 (or so) principles with you to a desert island, which ones would you pick? Which are most foundational, or most commonly used?

True confession, right up front. I got the following list from

ocp - open closed principle
lsp - liskov substitution principle
dip - dependency inversion principle
isp - interface segregation principle
rep - reuse/release equivalency principle
ccp - common closure principle
crp - common reuse principle

principles of package coupling
adp - acyclic dependencies principle
sdp - stable dependencies principle
sap - stable abstraction principle

I definitely don't think that this is the list I'd create, and I'm not convinced that this list is the superset of the list I'd create. (In other words some key principles might be missing from this list.)

Talk amongst yourselves


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
Missing are at least:

srp - single responsibility principle
scp - single choice principle
lod - law of demeter

I wouldn't know which ones to pick, though - I definitely use them all.

Why do you ask?

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Bert Bates

Joined: Oct 14, 2002
Posts: 8801
We cover some OO concepts in Head First Java, and we cover some additional concepts in Head First Design Patterns. Dave Wood has completed maybe 80% of Head First Objects. Our hope is that the three books will work together well, and that they will provide a good foundation in both Java and in Object Oriented software development.

I'm doing a review of the three books to see if we have good coverage of the basics. I ask this question as a way to get some unbiased opinions about what would constitute a good set of foundational concepts and principles, to see how such an unbiased set of opinions matches up with what we've already got, and what we plan to provide with the HF Objects book. (In other words, it's not too late to add a chapter if we're convinced that we've missed something important ).


Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I wasn't familiar with Single Choice and Googled for it. The top hit ... Tablizer! I recognized it from the content before I checked the URL.

A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
I see - that helps!

I'd say that the ocp is the most basic (and most abstract) principle - it really is what basically motivates most of the others, but doesn't tell you much about how to achieve it.

lsp, srp and scp are the next most important to a beginner, in my opinion, as they give very straightforward help in how to achieve the ocp.

dip and isp are more complicated to understand and apply, but also give a very deep inside into how polymorphism can be used to manage code dependencies. Very important, but advanced topics, in my opinion.

The package-related principles are less important to grok OOP, in my opinion. They apply more at the binary packaging (jar-file) level than the java package level. If at all, I'd concentrate on adp, sdp and sap and drop rep, ccp and crp.
Don't get me started about those stupid light bulbs.
subject: OO Swiss Army Knife? (from the desert island dept.)
Similar Threads
OOP is POO the functions are comming
principles of good OO design , preferably simplified
Bob:Using UML to teach good OO based on 11 principles
organizing classes into packages
HeadFirst Design Patterns - Decorator Chapter