-
Notifications
You must be signed in to change notification settings - Fork 78
Refactor MakeMaker.pm #189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
681a138
to
d9d5c90
Compare
Aside from a couple small nits, this looks pretty good to me. |
0492511
to
5b6d25c
Compare
dc6f4c1
to
a2c2fe6
Compare
7fec702
to
2e535db
Compare
To quote @ribasushi
This whole breaking up the new method is superficial at best. Whether we use one big method or a dozen smaller ones, we're still setting up a god object with unpredictable action at a distance. This is the kind of refactor that makes us feel good because wise men have told us that methods should be small, but doesn't address any of the fundamental design mistakes. All it does is distributing the crap for the sake of dogma. I'm not convinced that this makes the codebase any better. |
I went through the 400-line "new" method (which isn't an accurate description of what it does), and couldn't understand what it did. I now understand what the various parts of it do, and claim it is far easier for others to do so as well. We may be stuck with the poor design of it doing too much, because of back-compat (I found modules that rely on current behaviour), but I didn't think we were stuck with incomprehensibe code? |
The I don't oppose refactoring this (in fact I like some of it), but I don't think it should be approached this mechanically.
You're missing my point entirely. First of all, its length may be ugly but that's not the same as incomprehensible. I don't believe it is made more comprehensible by moving it around, even if it may be prettier. It's far from being the most difficult part of MakeMaker anyway. Secondly, after your refactoring it is still poorly designed. IME, having short methods is not a goal by itself, but a typical result of good architecture. This is even more the case for constructors. But my real point is this: is there anything that is made possible or even easier after this? Is there any concrete advantage to this? This has more costs than your effort in writing it, I'd like to know the benefits. |
FWIW, refactoring new() is something I approve, even if it doesn't immediately offer any direct benefits other than increasing the understandability/obviousness of the code. Refactoring code just to make it easier to understand does IMO not have to be defended, so please accept this pull request! We need more PRs like this. |
Mainly breaking MM->new up from being nearly 400 lines, to 40ish. Done as part of effort to implement extensions but turns out best way forward on that is orthogonal.