Click here to Skip to main content
13,042,807 members (79,140 online)
Click here to Skip to main content
Add your own
alternative version


Posted 27 Jul 2012

To do or to doer.go()?

, 27 Jul 2012
Rate this:
Please Sign up or sign in to vote.
One of the most important things about Java is their "as is" approach to "everything is an object" concept.

For the last year, I've been mostly using Java. After having a lot of experience with C#, its events, delegates, lambdas and generics, Java feels pretty weird. One of the most important things about Java is their "as is" approach to "everything is an object" concept. If you want something, it definitely should be an object. If you want an object, you either have to have a factory (to build composites) or build a new class.

It appears that the modern object-oriented approach to software design should be declared like this:

  1. You build a number of small silly classes. Every class should incarnate the only concept.
  2. You create objects of your classes and wire them together, depending on logic you want. The idea is, you're normally paid for implementing complicated concepts, so you have to describe the problem in terms of your primitive concepts. At this point, you have an object graph (or network) where nodes are simple processors aimed to solve simple problems. This network has input and output nodes.
  3. You then take your input data (mouse movements, HTTP-requests, whatever) and pass it to the input node(s) of your network. Then you read network's output and send it back (UI animations, HTTP-reponses, ...)

This approach is encouraged by GoF, P of EAA and others. There's a number of IoC containers to help with wiring objects together, there are mock object frameworks aimed to help with testing individual classes/objects and their impact to the dependencies.

But, frankly, after trying to write code accepting all these values, I have a feeling that something's wrong:

  • I build classes like PersonNameFormatter which have the only method - format(String firstName, String lastName).
  • I build a plenty of small classes, which are sweet as long as you see them individually.
  • I think in terms of "I want a doer" instead of "I need to do".
  • Looks like I'm not that far from using the concept of "evaluators" everywhere: IfEvaluator, ForEachEvaluator, etc.
  • When I try to understand how the whole application works, the only idea that comes to mind is: "well, it works somehow, there are sweet small classes, and then objects are created and wired, it should just work".

And even more frankly, I think that writing terrible procedural code with 500 LoC procedures should not be considered that bad.

Here's an interesting reading related with the topic:


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior)
Russian Federation Russian Federation
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionDescription Pin
Kenneth Haugland27-Jul-12 5:07
memberKenneth Haugland27-Jul-12 5:07 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170713.1 | Last Updated 27 Jul 2012
Article Copyright 2012 by loki2302
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid