M
M
Michael2018-01-03 18:35:09
symfony
Michael, 2018-01-03 18:35:09

How to arrange business logic?

When working with magento 2, I made many different modules with strong cohesion. It seems like you want to share work with the client and orders, but it still turns out that the modules will not be able to work separately. In general, I want to take and throw them away and do everything in one. And recently I learned that Symfony recommends not to bother with this and keep the application logic in one module, and if it is possible to create an independent module, then you can take out the code.
My question is about modules in magenta. Would it be correct to do as in the symfony example and combine the application-specific code into 1 common module?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FanatPHP, 2018-01-09
@springimport

The point of this recommendation is quite simple - don't create bundles just for your own sake. A Bendle is a standalone module that can be used separately from others, either on its own or as part of various applications.
Accordingly, the key phrase here is "they cannot work separately." That is, it is immediately a red light to attempts to divide. You have to do everything in one.
In other words, the division into modules is not about business logic. Bundles in Symphony should be considered as browser plug-ins - they can add some functionality, they can use some browser resources, but at the same time they are completely independent and not required for the main application.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question