Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have find this article Turning Your Code Inside Out and I want to know how this approach described in article is for OO programmers/languages.

Is this style of design used in OO programmers/languages? What's downsides and goodsides of this approach in a OO language?


OO objects have state and behavior, the design explained in article is stateless. Is not only Single Responsability Principle.

(If I'm talking shit, please explain to me instead of only downside/close votes)

share|improve this question

the article is just explaining single responsibility principle

the base line is don't have an object/function do stuff it shouldn't; either use a signal/slots pattern or let the caller handle it

share|improve this answer
But the caller will orchestrate all? It would not be too much responsibility for the caller? – Acaz Souza Apr 4 '12 at 14:57
@Acaz The caller should orchestrate it all. You design modules, the caller decides what they want to do with them. – Jonathan Henson Apr 4 '12 at 15:01

I'm not sure why you separate OO programmers from other programmers. The article is for everybody and all it really says is that your functions should do only one thing and do it well.

There's nothing OO specific about this.

share|improve this answer

It is for OO (as well as any other paradigm) because it sets one on the way to loose decoupling. The function the writer was describing can only be used in one environment (i.e. a terminal). Usually, you would want to have modules, functions, or layers that handle a task and only that task. You don't want them either a.) doing something outside of the scope of the task, b.) limiting the future usage of the module to a particular environment or paradigm, or if possible c.) being aware of the other modules.

Furthermore, the function name says what it should do, it shouldn't do anything more than that.

This isn't just OOP by the way, this is just good design.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.