I have the following requirements:
- Load data from a variety of sources and fill a list with it
- Use a batch of data to perform some computation
Some additional information:
- The algorithm for computation expects the list of data to be ordered by a key that comes with the data.
- I want to use a queue instead of a list inside the algorithm for performance reasons (Loaded data is already stored sorted)
- The data batch needs to be loaded beforehand
I tried to break the requirements up into different classes and came up with this design (pseudocode):
class Data {
int key;
// some more data fields
}
class SortedDataQueue{
Data peek();
Data dequeue();
void enqueue(Data);
}
class ComputesData {
Result performComputation();
void setDataBatch(SortedDataQueue dataBatch);
}
class DataLoader {
static SortedDataQueue loadFromJsonFile(File file);
static SortedDataQueue loadFromDB(DataDAO dao);
}
Is this a good design?
I try to get better at software architecture/design, but it is really hard without someone experienced to review your work. I tried to follow the SOLID principles in this one.