When is a Use Case layer needed?

In his blog post The Clean Architecture Uncle Bob suggests a 4-layer architecture. I understand the separation between business rules, interfaces and infrastructure, but I wonder if/when it’s necessary to have separate layers for domain objects and use cases. What added value will it bring, compared to just having the uses cases as “domain services” in the domain layer?

The only useful info I’ve found on the web about a use case layer is an article by Martin Fowler, who seems to contradict Uncle Bob about its necessity:

At some point I may run into the problems, and then I’ll make a Use
Case Controller – but only then. And even when I do that I rarely
consider the Use Case Controllers to occupy a separate layer in the
system architecture.

Edit:

I stumbled upon a video of Uncle Bob’s Architecture: The Lost Years keynote, in which he explains this architecture in depth. Very informative.

I disagree with Uncle Bob’s use of the term “use case” but I understand what he’s getting at. I don’t really want to quibble over the semantics of the term in any case.

For the sake of this question, use cases are application specific business rules.

Your question is really “when are separate layers needed for both enterprise business rules and application specific business rules?” And the quick answer is you need them when your application grows large enough to justify it.

If there are a small number of rules from either set, then it’s just as easy to keep the implementation of those rules within a single application layer. If there are lots of rules for both sets, then you’ll want to break them out to specific layers.

Uncle Bob lays out a rule that the inner circles shouldn’t know of the outer circles in his architectural diagram. And that’s ultimately the answer to your question. As the rules evolve and have clear delineation from the others then you’ll need to isolate them out to separate layers.

I’m no expert on the subject, but this is the way I understand it. The idea with a separate layer for the domain objects and the use case objects is you may eventually have a need to implement multiple versions of the use case object layer for applications that should have a different behavior, but follow the same enterprise rules. The way he explains it is the innermost layer is the enterprise rules, and the user case layer is the application behavior rules.

Whether you agree with Uncle Bob or not, in my opinion the answer provided by @GlenH7 is not in the spirit of what Uncle Bob is promoting. He does not want you to wait until your application grows larger before you separate the layers. He wants iteration zero to be when you design how you will keep the architectural layers separate and decoupled. The idea is that once a need to swap out a layer arises, you should be able to act upon that need quickly and easily because you already separated the layers before hand. If you wait until the application grows larger or the need to separate the layers arises, you probably won’t actually do it because it is too much work. But if you make it easy you will do it just because you are curious to see what would happen if you swapped out a layer with an alternate one.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật