25

I've been reading this from Uncle Bob:

http://blog.8thlight.com/uncle-bob/2012/08/13/the-clean-architecture.html enter image description here

I have several questions to clarify:

  1. Can outer circles refer inwards crossing multiple boundaries. For example can Controllers access data structures in Entities?
  2. What are differences between Enterprise Business Rules vs Application Business Rules. For example what are the differences for something like stackoverflow? What would stackoverflow's Application Business Rules and Enterprise Business Rules be?
  3. Are there example code that I can refer to, mainly focusing on web applications.

Thanks

Jesse
  • 3,243
  • 1
  • 22
  • 29
0xdeadbeef
  • 4,090
  • 8
  • 33
  • 37

2 Answers2

62
  1. It's best if the circles don't cross multiple boundaries. Knowledge should be limited.
  2. Enterprise rules are rules that apply to more than one application. Application rules are specific to one application. There are many application based on the stack overflow idea, and they share many of the same business rules. Those rules would be enterprise rules. But there's only one stack overflow. The rules that make it unique are application rules.
  3. Yes, there are many examples. Just search for "Clean Architecture Examples". If you have a copy of either of my two books: "Agile Software Development: Principles, Patterns, and Practices" or "Agile Prinicples, Patterns, and Practices in C#", then the payroll case study is a good example of this architecture.
Robert Martin
  • 2,825
  • 1
  • 17
  • 6
  • 3
    Uncle Bob himself, I'm honored. Just to make sure, so it's best to create new data structures (even though they maybe similar, or just the same) going up the levels on the assumption that it might differ over time and while crossing boundaries it gets converted to the structure that is understood by the inner circle. – 0xdeadbeef Mar 17 '14 at 21:56
  • but in the Boundary Injector Entity pattern you describe in various presentations, the Use Cases (injectors) depend on an Entity Gateway interface. The implementation of this interface then creates Entities. Isn't this crossing multiple boundaries? Interface Adaptors -> Enterprise Business Rules ? – GWed Apr 25 '14 at 08:15
10

In addition to Robert Martin's answer, I'd like to add.

  1. It's best if you can keep your dependency graph as flat as possible. If you're crossing multiple boundaries, the aren't really boundaries.

  2. (See Robert Martin's answer)

  3. In Addition to Robert Martin's books, you may also want to refer to my book Dependency Injection in .NET, which follows the same principles, and comes with extensive (.NET) sample code.

Community
  • 1
  • 1
Mark Seemann
  • 225,310
  • 48
  • 427
  • 736