0
Laravel breaks the concepts of SOLID?
SRP - Single Liability Principle Unique - A class must have one, and only one, reason to change.
OCP - Open/closed principle Open/closed principle - You must be able to extend a class behavior without the need to modify it.
LSP - Liskov substitution principle Liskov - Derived classes should be substitutable with their classes bases.
ISP - Interface segregation principle interfaces - Many specific interfaces are better than one general single interface.
DIP - Dependency inversion principle dependency - Rely on abstractions and not implementations.
and if we use the command php artisan make:controller TestController -r
he will create a Controller
with all the verbs HTTP
, which turns out to be like index
, edit
, delete
and store
in a single controller.
In case we had such a class:
class TestController extends Controller
{
public function index() {
/* Consulta */
}
public function store() {
/* Insere */
}
public function edit($id)
{
/* Edita */
}
public function delete($id)
{
/* Deleta */
}
This does not end up violating one of SOLID’s principles?
Source: Medium
And why do you think that? And what is the problem with that? We also have a source here: https://answall.com/q/178718/101
– Maniero
I think (I’m still learning, so the question) that are totally different functions, so they should be separated, no?
– user152996
As functions they are separate, as organizational unit seems to have a coherence, after all they are all actions of a controller. Can you question that? Can you. Should you use an MVC? Is that what SOLID is all about? https://answall.com/q/336319/101 Do people know what they are saying? Is it simple to define what is cohesive or not? That deep down is what SOLID preaches. Does forgetting OOP no longer help in SRP? And deep down it seems that it’s only about him who is talking and not SOLID. What I’m sure is that memorizing and following rules doesn’t make software any better.
– Maniero
@Rodrigopires This business of sólid in Laravel is shooting on foot program the bang and be happy
– Lucas Antonio
@Rodrigopires da para trabalhar com Aravel working with Solid good, I didn’t understand what the bullshit is...
– Diego Ananias