G
G
George2019-10-11 15:18:38
1C-Bitrix
George, 2019-10-11 15:18:38

Do I understand correctly that the Bitrix site management architecture is somewhat crooked?

The official documentation says about MVC and that a module is a Model, a component is a View and a Controller.
It is also recommended to make all changes in the program code by changing, adding functionality to the component, i.e. essentially creating "fat controllers".
I read a lot that fat controllers are evil. Does this mean that the Bitrix architecture is crooked?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2019-10-11
Madzhugin @Suntechnic

I would say - kind of.
As far as I remember, it says that the component is a controller, and its template is a viewer.
Yes, formally, if you look, it is.
In practice, this approach has both disadvantages and advantages.
Well, for example, we say that supposedly all three parts are independent, but in fact the View is always associated with the Controller, and the Controller is almost always associated with the Model. Bitrix did not pretend that this is not so - components are parts of modules, and templates are not separable, although replaceable parts of components. In most cases, this corresponds to practical cases.
But no one is forcing you to follow these recommendations. During my life as a developer, I have seen a lot, and most often these were some attempts to implement individual models on top of the Bitrix API, I myself have done this more than once and even made an attempt to generalize this experience, which has not yet been completed.
But I also saw, for example, ZendFramewormk over Bitrix and quite classic MVC.
Therefore, the Bitrix architecture is not a sentence.
And the legs of such an architecture grow from an attempt to make a CMS that, at least in theory, a person could handle without any training. You have to show something in presentations. But this does not mean that you have to make your own products for presentations.
Recommendations to do it this way are necessary for you to make a project that is as familiar as possible for any Bitrix developer. When I first encountered the Bitrix-Zend bundle, to be honest, I was taken aback, and if it were not for the experience with other frameworks and CMS, I would have been stupid for a long time...

A
Andrey Nikolaev, 2019-10-11
@gromdron

If you look at things more realistically, this is more likely a mistake in the documentation. In fact, the Bitrix architecture is not MVC, it is a set of specific architectures and it is worth considering them independently. If we talk about Components, Models and Templates, then Bitrix is ​​rather an MVVM model, where the component is the ViewModel, the template is the View, and the Model is a fundamental piece of data without business logic.
Does this mean that this architecture is a curve? No, it doesn't mean at all. It just implements a completely different approach, which is alien to many developers from the world of frameworks and a mono-project.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question