Pergunta

How can I name an abstract class that has a common part of view of my two panels? One of them is for creating an object and the other one is for updating it. I want to keep these view in different classes to maintain SRP.

Foi útil?

Solução

One of them is for creating an object and the other one is for update it.

You shouldn't have 2 views for that at all. Views are meant to collect the data input from the GUI, not to introduce the logic, if an underlying data set should be created or just updated.

I'd rather recommend you should have a single view panel for that data, and manage to create a new or update an underlying data set, in a separate layer, that communicates with the database.

The "single responsibility principle" rather means that the view should be responsible for collecting the necessary data, and doing (primitive) input validation of that data.

An underlying data set should carry the information, if there's need to create a new record, or to modify (update) an existing one, if the user commits the data from the view panel.

Thus your question of "how to name an abstract base class" for these becomes completely irrelevant, because there isn't one.

Licenciado em: CC-BY-SA com atribuição
scroll top