I think I designed my app focusing all the logic in one single class (A). I have been reading that is not a good practise to do this. Class A have a lot of nested logic, each method of Solve() uses as input the result of the previous ones. I dont know if I should create separate classes for DoTask1, DoTask2, DoTask3 and DoTask4, and instantiate them from Solve(). Would that be better? I know I can also create separate classes with static methods but I have read that too many static methods are bad.
Main()
{
A a = new A()
a.Solve()
}
A()
{
Solve()
{
partialresult1 = DoTask1()
partialresult2 = DoTask2(partialresult1)
partialresult3 = DoTask3(partialresult2)
finalresult = DoTask4(partialresult3)
}
DoTask1(){}
DoTask2(){}
DoTask3()
{
B b = new B()
b.doWathever()
}
DoTask4(){}
}
B()
{
doWhatever(){}
}
Aucun commentaire:
Enregistrer un commentaire