I like to know what the advantages to putting the logic in separate classes rather than putting all the logic in the RuleManager
class.
For example
Separate the classes for each responsibility
class RuleManager {
public function create(string $name)
{
return (new CreateRuleCommand($name));
}
public function list()
{
return new ListRulesCommand();
}
}
vs:
class RuleManager {
public function create(string $name)
{
// Do all the create logic Here
return $something
}
public function list()
{
// Add all the listing Logic Here
return $something
}
}
Aucun commentaire:
Enregistrer un commentaire