You're slightly misinterpreting this. The controller class still has only one responsibility - that is handing the requests for a specific resource.
The way you seem to be looking at this is that each controller should only have a single function which in an of itself should show you that there is something wrong here.
So much wut. Do you put a single method in all your classes? :o
SRP says nothing about the number of methods in a class. SRP has more to do about the actors (stakeholders) involved.
I highly recommend Uncle Bob's video series at http://cleancoders.com Start at the very beginning and watch them all carefully. Alternatively, the book Clean Code has the same information. I personally prefer the video content during lunch, etc.
There's a lot to misunderstand about object-oriented design. Be careful.
No but it says a class should have only 1 reason to change.
If there are 5 methods there then there are many reasons to change the class.
robclancy said:
You're an idiot.
Have respect this is public forum there is no reason to be rude. If you don't agree just write your comment.
behnampmdg3 said:
robclancy said:
You're an idiot.
Have respect this is public forum there is no reason to be rude. If you don't agree just write your comment.
l2troll
Couldn't understand your point of view, but since that i born, classes r supposed to have more than 1 method. I have never saw a class with just 1 method in a complete software.
behnampmdg3, you are about right, but a class has most times more then 1 method, even in SRP. Your class should have a single responsibility. Put onto the laravel controllers, each controller is repsonsibile for 1 route/resource, like, DashboardController, takes care of all dashboard access, or the LoginController about the login
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community