Closed rrgayhart closed 8 years ago
Does this need to be a gist? I'm just gonna leave this here....
I think the hardest rules to follow are: Methods can be no longer than five lines of code. The way my brain works, I want to put everything in one method and switch around using a bunch of cases or if/else statements. I've learned over the last 3 modules though, that this is a huge "smell" for me, and that it usually means I haven't broken the logic up enough and my method is doing too many things.
Controllers can instantiate only one object. What!?!? I never heard this one before. I guess it makes sense, because you only want your class focusing on one object i.e have a single responsibility, but looking back on past projects, I pass a lot of stuff in. I'll have to start being more careful, and probably set up more classes, to make this work.
I think the hardest one to follow is the 5 lines, I get that clean code is nice but I think it's arbitrary. I was at React meetup this week and the guys speaking said they could care less about the lines of code which is much more my opinion so although its great having concise code, I will probably never be a stickler about it.
Discuss Sandi Metz's Rules for Developers here.
Which of Sandi's rules do you feel like might be the hardest to follow—why?