9
I was watching this the other day video lesson on Laracasts, where there is an explanation that teaches to avoid accumulating too much code in one method, separating into several methods with specific responsibilities and thus reducing the size of the indentation - at least that’s what I understood, correct me if I’m wrong.
I also realized that there is the same "teaching" at that link, which I think is the Microsoft blog.
What is curious is that in these videos lessons of Laracast, usually the subjects dealt with are the framework in PHP called Laravel. I don’t know if it’s just a coincidence, but I saw that the link above is from Microsoft, and the creator of Laravel, Taylor Otwell, said in a video class that, before programming in PHP, he was programming in ASP - which is from Microsoft.
This last statement may seem irrelevant, but it is important to my question:
This is a specific pattern to ASP development (or anything else from Microsoft, like C# and so on), or actually this "One Level of Indentation" is a design standard or an encoding standard?
Note: I don’t know much about the "things" of Microsoft, so forgive me if I said something silly.
Object calisthenics, falls into the category of good practice or if you preface recommendations here has some others, this serves for any language.
– rray
Great @rray. Precious information :D
– Wallace Maxters
You could have that in English, huh :D
– Wallace Maxters
Repositories and Service Layers help with this. Instead of the Controller having direct contact with the Model, these repositories and service layers do all the work. What helps in a little code in Controller, in Identation and prevents the accumulation of repeated codes.
– Diego Souza
@rray after your reference, I could "learn" how to research on the subject. I think it’s worth seeing this here Object Calisthenics - English
– Wallace Maxters
It’s a "good practice", I mean, something that if you follow just by following, will screw you.
– Bacco
For practice to be good, you have to have practice. There are people who leave using the design standards and "good practices" just because they find it cute, without understanding the meaning :D
– Wallace Maxters
I don’t know if the microsoft and Laravel tags fit this question ...
– gmsantos
How I lost the timing I’m not going to answer the question, but this is one of those crazy rules that someone makes up and a lot of fools follow. There is no advantage in forcing this. If something should only have a level of indent It must be because it makes sense there, not because some silly rule dictates it. Just as it is bad to put several responsibilities together in a single method, separating responsibilities that are closely related can also be bad. Complication without gain.
– Maniero