Question

General Context

I started reading about layer based architectures like DDD, Onion, Clean Architecture etc. I am considering switching, but am currently unclear about how strict the "first level division" into layers is.

Current State of the App

For the app we are working on, imagine a mix between a webshop and the video game The Sims: The user is placing and configuring products in a 3D environment, but the end goal is to present them with a bill for all these products.

At the top level, the app is divided into floors, window decorations, users etc. Each of these "categories" has their own views, their own business rules etc. and does not interact with the other categories. They implement common interfaces where they need to be brought to a common standard, e.g. the price calculation.

So, our app is currently primarily divided into what would probably be called "subdomains".

What's unclear

I understand that views belong in a UI layer, but what I am unclear about is if there is supposed to be only one, or if the layer structure can exist for every sub-domain.

I never found this stated explicitly, but I think I am supposed to take e.g. all the views out of all those domains and put them into one common UI layer. I think it can be summarized as the primary concern is not what part of the business the code is about, but what the code does in a technical sense.

The Question

Do layered architectures condone separation first by "subdomains" and then by layers? Is this maybe even handled differently in different types of layered architecture?

Was it helpful?

Solution

Both approaches are valid.

1: Single app which covers more than one domain

enter image description here

2: App per domain

enter image description here

enter image description here

Licensed under: CC-BY-SA with attribution
scroll top