I have (x2) ways to get information for my object:
- Read from a file stored on the disc
- Access the application that made the file through the application's API
Once the information is acquired, I'll have methods to:
- Display
- Analyze
- Change the information (again as either a file or through the API)
If I change the information, it need not be the same way that I received the information. Therefore I could:
- Receive the info by file and push the info back by API
- and all the other obvious combinations...
I won't have additional ways to get the data in/out (e.g. API and file cover all options).
The code will be in Matlab, so I don't have easy access to enumerated types and a few other nice programming features, so I'm tempted to use a design pattern rather than a switch inside the class.
Questions
What are appropriate design patterns for this problem?
Should I use a design pattern and write a few classes to get this done or just write a single class with a switch for file or API?
Aucun commentaire:
Enregistrer un commentaire