I’ll give a practical example to explain better what I am asking: Let’s say I want to develop a budgeting software in an OO programming language. Now, when the user registers a transaction they can choose its type. Of course transaction types should be customizable by the user via the UI. Those type have to be saved, e.g. in a file or a database table. The question is: how should I manage those transaction types? I do not think creating subclasses or enums is possible, since it would (generally speaking) require recompiling. Is it correct to create a class “Transaction” with an attribute indicating its type or is it “incorrect” in an OO approach? What’s the “best practice” - if any - in these cases? Thank you!
Aucun commentaire:
Enregistrer un commentaire