-
Notifications
You must be signed in to change notification settings - Fork 61
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
Refactor question #131
Comments
If I don't get any feedback by this weekend, I'll revert these changes and close the project/PRs to separate functions out of the SAML class. I just can't see the benefits aside from the function to generate metadata, which one may reasonably want to do without newing up the SAML class, and which is already separated out. Are there any other functions in the SAML class that one may want to use without newing up the SAML class? |
I'm looking at this today. Sorry I missed this earlier, I have trouble keeping up with the mail from this very active project. |
I see a couple related concerns trying to be addressed here. File lengthI don't think there's great virtue in large files or small files. If a file is very long, it could indicate that perhaps a big problem should be broken into smaller problems. A large file might invite over-use of shared state. But neither of those things have to be true. A larger file can be well-organized. It might even contain multiple smaller classes. And it may be easier to navigate with all the code in one place. There's also some risk than any big change introduces some undesirable behavior. On this point, I defer to @cjbarth as the primary maintainer. He mentioned there's some productivity benefits with VS Code to having fewer files. Reducing StateI think this is the more interesting goal raised by @forty in #19. Here's his description of that motivation:
I've heard it say about software that "state is the enemy". The more states that are possible, the more complexity, the more bugs, the more testing that is required. Having a reviewed a lot of code over the years, it's much easier to understand what the former does then the latter:
The compromise for OO code is immutable state. Once the object is created, the state is locked and can't be changed.
As a security-critical project, having correct code that's clear to write and review is important. The proposal in #19 didn't just split things up to files, it simplified some function signatures so that the functions required less state. I think that's a win. But the same benefits could be had by keeping the refactored functions in a larger file. The The The work in those files to simplify function signatures seems worth considering, though. |
Since this project is very much OO with immutable state, it seems reasonable not to break out any functions that depend on that state. I can see your argument for breaking out the functions, but that would mean that each function would need validators for the incoming values. I'm therefor inclined to keep all the functions that depend on the immutable state to continue to be a part of the I'll continue to wait for more feedback before offering my final recommendation. |
@cjbarth given your comment, I've inclined to agree your proposal for how to proceed. |
@markstos I would like your honest opinion on these PRs (#129, #130) before I continue. These PRs are based on the efforts of @forty in #19. Do you think this adds to, or detracts from, the maintainability, debug-ability, comprehensibility, or any other aspect of the code by breaking it up like this?
I note that in VS Code "Find All References..." no longer works as one might expect when the code is refactored into multiple files. I'm not sure if losing that is worth any other gains we might get. After seeing how this looks so far, I'm starting to see how this might not be the 100% win it seemed it might be.
@srd90, @zoellner, @sibelius, @josecolella, @gugu since you also spend a lot of time with this code, I'd value your opinion as well.
The text was updated successfully, but these errors were encountered: