B
B
BonBon Slick2021-11-01 01:08:45
Web development
BonBon Slick, 2021-11-01 01:08:45

When should you duplicate code?

On the back end, it is much easier to trace dependencies due to DI, highlights, and other hints.
At the front, it is very difficult to debug, trace the dependencies where which template, styles, which scripts are rewritten with which ones, obeyed, and so on.
In general, the front, it's pure chaos.
And now I'm thinking, is it necessary to make a unified code?

For example, I created a Vue mixin , and I use it and everything seems to be ok, while we are developing it.
But then the project goes to support.
On page A, you need to expand the mixin or change it. Ok, we are doing, testing, everything is OK, the task is closed.
And then it turns out that the modification of the mixin or template breaks, distorts, incorrectly displays some important functionality, because it began to work differently. And that's it, it's impossible to test it except manually.
In the case of extending a mixin, a template, it becomes more and more difficult to maintain. it is necessary to take into account all the unknown functionality that is tied to them. As it happens with basic layouts.
You can sculpt and build all dynamically or super config configs like in Magento, which spend an awful lot of effort on support, the goal of which needs to be simplified.

  1. The question is, is it necessary to do unification on the client side?
  2. Or is it still better to have each component unique and isolated?
  3. How to determine which functionality should be unified, generalized, and which should be isolated and duplicated?

Yes, there will be many times more code, cons is a slow extension, but debugging and changing in theory is much easier, because the code is isolated.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim, 2021-11-01
@BonBonSlick

All chaos does not depend on the front or the back. It is obvious that all the chaos was created by the developer or architect .
Most often, the reason lies in the ignorance of some basic things (patterns) during development, as well as poor knowledge / understanding of the framework and components.
For Frontend, I can suggest an interesting design approach — feature-sliced ​​.
Also a good example of a Frontend application using hexagonal architecture: https://github.com/Sairyss/domain-driven-hexagon

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question