dimanche 25 octobre 2015

Design pattern for configurable system

I have an interesting design problem that I will attempt to simplify in a toy problem below:

I wish to design a system for which the output will be student objects based on certain inputs and intermediary processing. The flow will be as follows: I have a list of classrooms as one type of input. To generate the output, the processing steps are:

  1. Filter each classroom by students under the age of X (lets say 10)
  2. Sort the filtered results by any permutation of this hierarchical order: height, weight, arm length
  3. Return the top 8 students.

Another input can simply be a list of students I already have and want included as part of the result. For example: Input 1: List of 3 students, Input 2: List of 2 classrooms for which the processing steps above will run.

What would be the best way to design such a system with inputs being input type {student list|classroom list}, filter type {age|height|etc}, sort order{any ordering of height,weight,arm length}, returnNum{how many students to return}? The system should be flexible enough to accommodate more input types and more sort order entries {ie. sort students by shoe size}. What data structure can I use to model each part of this section (ie. what is the best way to represent the sort order criteria?) Is there any design pattern that would fit these needs? Any help with the architecture design would be greatly appreciated!

Aucun commentaire:

Enregistrer un commentaire