Answer the question
In order to leave comments, you need to log in
UML model of a Yii2 application, implementation of an interface by a group of classes. How? Is there a pattern for this?
Hello. We need a specialist in OOP and UML, who worked with MVC at one time!
I’m just learning (I don’t offer courses and other options myself), but I don’t have a lot of time for specifically designing in UML, + I don’t have enough experience in OOP, so I’m asking for advice. I read GOF, Zandstra, etc. Right now I'm writing a simple directory management engine. Typical CRUDs, wherever possible, essentially form the basis of the project. But I do it based on the objectives of the training, in order to competently use the acquired skill, paying attention to BP in another project (online stores, etc.).
Task 1
Competently and appropriately use the capabilities of interfaces. In this case, I have not yet fully understood whether I need this or whether I can also stick between Base [class] and the final class - the so-called. Real[class], or is it better to use an interface for this? the class most likely will not have a body, because RealClass is essentially a generic class, which, however, is intended to be used already in the domain zone. Those. this is the base class of the domain, if we move a little further and look already at the scale of the metamodel.
Hence the question - is it better to have an interface or an intermediate class (..what if then for everyone in the domain you have to write additional functions or modify the constructor? You guess the hell. On the other hand, if you talk like that, you can say this about any interfaces that are not used for multiple inheritance, or am I wrong?)
Task 2
Just writing " [classname] implements [interfacename] " is of course possible in the code in each class. But is there a more elegant solution to this problem? The idea is actually as old as the world: accustoming myself to DRY, I reuse typical CRUD-actions in different Yii controllers, but maybe there is an optimizer dog buried somewhere, which I, due to inexperience, have not yet managed to dig up?
Subtask : how best to display in the UML the relation of a group of elements to another (for example, the same implementation of an interface by many Actions) without the need to draw it from each element (the hand will fall off if there are 100 of them). Recommend a visual pattern like: group(object1 -> Int, object2 -> Int, ... , ObjectN -> Int), where Int is an interface, "->" is a connection type, and Object is an Action in our case.
Note
- Base[classname] are wrappers to ensure a smooth update of Yii itself in the future, don't mind.
- let me remind you in advance: for such a simple task, I am using UML solely for the purpose of training and mastering
OOP, besides, this project has a chance to grow and scale, all the more so a competent architecture is needed from the very beginning.
With reverence and hope, I am attaching a class diagram, a DDL diagram, and an interface layout so that I can give mega-useful advice to OOP green dudes like me as quickly and without strain as possible.
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
We need a specialist in OOP and UML, who worked with MVC at one time!
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question