5 ms·
Someone has to say it: Damn, this looks fucking ridiculous! First we have the false modularity. You see a bunch of separate stuff (classes, methods, whatever)
by judofyr 14y ago
Someone has to say it: Damn, this looks fucking ridiculous!
First we have the false modularity. You see a bunch of separate stuff (classes, methods, whatever) and think "Wow, nice, now we can reuse this all over the place!" The truth is that these policies/services/renderers are going to be complected; you're going to create them in triplets as you implement your application. Moving things around doesn't make them modular. They can only be modular if the author actually implements them in a modular way (and you can do that in Rails today).
The DI-framework can't handle change at all:
class CurrentUserResolver
def initialize(user_finder = User)
@user_finder = user_finder
end
# note that resolvers themselves get injected
def call(session)
@user_finder.find_by_id(session[:current_user_id])
end
end
What if I later need the cookies/params to detect user session? If I changes the #call method, every single test breaks.
And then there's the added complexity. Now I need to keep track of the route-mapping, default policy, route policies, the route service and the route renderer. Which are now in several different files. And there's not even a clean class-to-file mapping to help me locate it.
Oh, and the premise of testability. Well, this makes it very easy to test units itself, but the more you split your projects into smaller units, the more bugs occur when you mix the units. Sure, you can get your precious fast test runs (and a nice green test), but in reality you're only testing a single unit of a complected app.
EDIT: This reminds my of Rick Hickey's quote from keynote at RailsConf2012:
""We can make the same exact software we are making today with dramatically simpler stuff—dramatically simpler languages, tools, techniques, approaches. Like really radically simpler—radically simpler than Ruby which seems simple.""
- nicholasjhenry 14y agoWhen you start a comment off with a sentence like that, you lose all credibility.
- primatology 14y agoI don't necessarily think so. He draws you in with said outrageous remark and proceeds to raise some good points.
- nicholasjhenry 14y agoIt doesn't really invite discussion. If you were the original author of the blog post would you engage with the author of the comment?
- primatology 14y agoGood point. There are friendlier (better?) ways to discuss flaws.
- jamesbritt 14y agojudofyr is about as credible about Ruby as they come.
- nicholasjhenry 14y agoIf that's the case, why does he need to start a discussion with that kind of statement?
- jamesbritt 14y agoBecause maybe it's fucking ridiculous? You'll have to decide if he made his case or not, but if that's what he thinks then better he just come right out with it instead of dancing around. Note that he did not call James ridiculous, he criticized the idea. Which is how it should go (if there's going to be criticism). You can debate whether his assertion is justified, but some (many, perhaps) ideas really are fucking ridiculous and it's better to just cut to the chase.