Answer the question
In order to leave comments, you need to log in
Compliance with the OCP principle regarding the controller when developing Android applications?
Actually, there was such a question. This principle is observed when designing business entities (i.e. models in the MVC pattern), but when designing activities, the principle of openness / closeness is not very well observed. Is this due to the fact that the controller is not an object that models some entity of the subject area?
Code example where this principle is violated :
class MainActivity extends Activity
{
private void someMethod()
{
SuperClassName objectName = new SubClassName(); // здесь нарушается принцип OCP
...
}
}
class MainActivity extends Activity
{
private void someMethod(SuperClassName objectName)
{
objectName.methodName();
...
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question