3

According Uncle Bob /source/, every user story should have separated "integrator/controller". Its sounds good because classes will be small and do the only one thing.

But in the real world I didnt see architecture organized in that way. Always if there was eg AccountController it contained all methods related with Account. In Uncle Bob "way" this should be designed just like this:

+Controllers
---+Account
------+DepositMoneyIntoAccount
------+WithdrawalMoneyFromAccount
------+TransferMoneyToAccount

or maybe Im misunderstanding of Uncle Bob? But if not, have someone of you see architecture organized in this look? Its practical in real world?

Regards

  • Do you have a reference to Uncle Bob's words? – darlinton Apr 08 '12 at 22:09
  • You can also check this post for clarification and improve your question. http://stackoverflow.com/questions/1866794/naming-classes-how-to-avoid-calling-everything-a-whatevermanager – darlinton Apr 08 '12 at 22:11
  • 2
    @darlinton, sure check this out http://www.youtube.com/watch?feature=player_detailpage&v=WpkDN78P884#t=1672s – Sebastian Brózda Apr 09 '12 at 07:04
  • 2
    We've organized our project this way. We use the Entity - Bondary - Controll pattern for our Services and each of our Interactors implements exactly one UseCase. This causes some overhead but this way we can test our business logic independent of the Boundary or even the Backend and the logic to access the backend. – andih Apr 09 '12 at 07:17
  • @andih thx for reply, but could you tell me if you really have directories called "interactors", "boundaries" etc? – Sebastian Brózda Apr 09 '12 at 16:28
  • Yes we have separate packages / directories for boundaries, interactors, entities, gateways. In most projects the boundaries, interactors and gateways are located in different maven sub modules. – andih Apr 09 '12 at 16:34
  • @andih great! is there any possibility to send me/or paste wherever the structure? not the whole tree project of course, but small scrap of it. I mean eg one file name from each directory. Im really interested in this. If it impossible, I understand :) – Sebastian Brózda Apr 09 '12 at 16:46
  • @Sebastian Brózda For me anybody that mentions Uncle Bob, has a +1 straight away :) I am a big fan of that guy, great question. – javing Mar 01 '13 at 21:24

2 Answers2

2

It certainly is practical, and an excellent vehicle for larger and complex systems. I put the entities/boundaries/interactors (instaead of controller to avoid confusion with popular web interfaces) in directories at the top level, and the entire communications system in subdirectories (such as z_rails, z_sinatra, and the like). With Rack, for example, it is straightforward to deliver web solutions using various communications framework with minimal additional work. For example, look at github.com/wizardwerdna/avdi and github.com/wizardwerdna/bobbit for initial experiments along these lines.

wizardwerdna
  • 948
  • 6
  • 11
1

You are right, that is the way he wants the project to look like.

Remember his talk "Architecture: The lost years", the architecture should describe its intention(And what better than a Use case?).

At the beginning I was also a bit confused but if we think about it BDD, the philosophy wants to make sure we make understandable software.

I watched the video a couple of times and I probably will again, because it is a new concept and requires study. For me the most important part and more challenging is creating the plugins for the other modules, he talks about a request and response model needed in order to keep the surrounding layers such as front end and database, completely independent from the software.

The final goal of this is that our software can easily replace any addon such as a database or a UI.

Just one more thing I want to mention, I think you are maybe interested. In this interview at the end, he reveals that his next book will be all about this new methodology we are discussing now.

Update

I see in the comments you are talking about calling packages with names such as Boundaries, Interactors...

This is completely ok, in his book clean code that some developers use the name of the pattern in occasions to name the Classes or packages... That is correct, because it is technical terminology that developers should be familiar with. In the same way you know that a class is a builder or a factory by reading its name or package, you can know what interactors or boundaries are. That is correct according to clean code.

javing
  • 12,307
  • 35
  • 138
  • 211