Architectural puzzle

Worst of all, when you are working on a single-person project, this is the lack of information that you usually get from your colleagues. And due to the lack of this, you tend to make obvious mistakes.

Having caught this road for some time, I will need help from the community.

I started a small project home <brew, which should turn into some kind of portal. And the main thing that bothers me is the save layer I came up with. It should be completely separate from the starter view level, and OR-mapper is also located somewhere. This is because I have several data stores that I need to use.

Thus, the main idea was that separate β€œrepositories” each work in their own separate database and that the business layer then combines the business objects, which are then converted into view objects in the view layer.

The main problem I am facing is the following:

Multiple classes for the same concept . There is a user DAL representation and a user BL representation and a user representation representation. I can handle the conversion with a tool, but this is really the right way. I mean, they are all perfectly separated, but overhead is something.

What do you think? Am I too deeply going into the separation of anxiety for a rabbit hole or is this still normal?

+1
architecture separation-of-concerns
source share
3 answers

This is more than usual.
Usually, no one does this and cries about problems with lazy loading of ORM when rendering html or whatnot.

It's easier to write a DTO layer than to think about DA, BLL, and UI at the same time. Some go even further and apply command and query separation on an architectural scale, clearly drawing a line between I / O (which solves problems, such as the need for an artificial business object that is actually used only for reporting purposes).


On the other hand, it depends. If your application is simple, you may not need so much abstraction (for example, the simple homepage of a portfolio of companies).

+1
source share

I don't see a problem with this, to be honest. Having separate classes for data in separate layers means that you can change them without changing the others. The extra cost of other views is usually minimal β€” typing speed is usually not a performance factor.

OTOH, being able to change something in the data warehouse, without being obliged to change the entire stack, can save a lot of time and effort, since often using the same design for several purposes leads to unforeseen side effects when making changes.

IOW, while the need to spread change across multiple layers can suck, it can often be supported with the right tools, etc. On the other hand, when a trivial change in your data level has an unforeseen side effect in the user interface, which always sucks and slows down any changes, since everything you do can break anything in the whole system.

+1
source share

This is the danger of having multiple repositories. This raises the question of "do you need everything or not"? Does it make sense to consolidate any of them, and can you?

I would advise you to read something in Data Architecture - I am a beginner myself, but I had a great contribution from a very experienced one. One consideration is that data architects are more concerned about how you define data than about how the physical database is actually assembled: my advice would be to start by capturing and documenting ( modeling ) the logical data model, and the physical one. Having a really clear understanding of the data will help a lot.

The specific of this (that is, the DA bits are worried) is the definition of the data - what is this data bit (do not rely on the names of columns and tables)? How is it used, what does it mean, where is it created? It is also important that we do not talk about where it is created physically in your system, but where it is created in business processes. yes, you need to worry about the system - but this is for later; business process must manage the system. Thsi is an all logical data model.

Once you have the definitions, you can start collecting them together - how are the data from different repositories related? (maybe more in the physical model here).

Once everything becomes clear, the answers to the question of how you put it in the application should be obvious, and documentation will help. thsi is one of those cases where really good documentation is really needed.

0
source share

All Articles