Answer the question
In order to leave comments, you need to log in
What design pattern is this
There are several entities
category, article, event (special article), page template,
despite the fact that they are completely different entities, they have common properties - “text content”, “picture”, “summary”, “update time”. They also have individual properties - “event date”, “event link” (for an article), etc.
Each property has a number of methods for working with them. For example, a number of methods for working with an image, a number of methods for working with text. etc.
the idea arose to write the architecture of entities as a set of primitive parameter classes. And the parameter class (for example, “image” or “text”) encapsulates the methods specific to this parameter. Thus, the event class is a set of parameters - “text”, “picture”, “event time”, and the article class is “text”, “picture”, “summary”, “event link”
In all the variety of patterns, I suppose that there is a similar or even just such a pattern to which I have arrived in my reflections. If anyone knows what pattern is in question, please tell me its name.
Answer the question
In order to leave comments, you need to log in
… despite the fact that they are completely different entities, they have common properties… They also have individual properties…
each property has a number of methods for working with them. For example, a number of methods for working with an image, a number of methods for working with text. etc.
the idea arose to write the architecture of entities as a set of primitive parameter classes
Either inheritance from abstract classes (c++), from interfaces (java, C#), or duck typing in scripting languages ​​(python, groovy, etc).
In general, there are SOLID principles (http://en.wikipedia.org/wiki/Solid_%28object-oriented_design%29), in which the letter I means ISP - interface segregation principle (http://en.wikipedia.org/wiki /Interface_segregation_principle). This is what it is.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question