Answer the question
In order to leave comments, you need to log in
Class design, inheritance, aggregation, what to choose?
c# language. It is necessary to implement the architecture of classes for orders, in short, then:
There are several types of orders, for all of them there is common data and behavior, which means we make an abstract class Order (Order) that implements this.
Further there are two classifications for the development of orders:
1) Orders are divided into:
a) Orders with one executor . (Contain an Employee object that completes the order in full);
b) Orders with several performers . (They contain the Employee-->Task list, where Task is the part of the order that the executor performs).
2) Orders are divided by type:
a) Translation order.
b) Order for interpretation.
c) Order for reading the course.
At the same time, Orders for translation and interpretation have a common logic, and therefore it is logical to assume that they should have a common ancestor, for example, the abstract "Order for translation".
But here's the thing:
A translation order has many executors.
Order for interpretation and course reading - one performer.
This means that if you enter the parents "Order with one executor" and "Order with several executors", then you will not be able to have a common ancestor for translations.
How to act in such a situation?
Answer the question
In order to leave comments, you need to log in
I support asdz. In theory, the behavior of classes for N executors should not differ, given N (even if N = 1).
If the relationship "I am an order with one/many performer(s)" is very important, you can specify that the order for reading the course and for interpreting implements the IHaveOnePerformer interface, and the order for translation implements the IHaveSeveralPerformer interface.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question