-
-
Notifications
You must be signed in to change notification settings - Fork 150
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
Scripts getting long #296
Comments
At the moment, everything is highly coupled. That's why having it in one file is better than having it in more files but still being highly coupled (at least from my point of view). The current "architecture" already contains circular dependencies, which is really bad... I documented the current architecture in the docs folder as a plantuml file. Here's the current rendering: The code is growing with more features, so we need to do something at some point. We need to decouple when we want to have multiple files. For that, we need clear interfaces between the parts, and they should not have circular dependencies. This will be costly, and there might never be a return of investment. Nevertheless, we can try to go forward. The key question for me is, how we can achieve a better structure without circular dependencies and is still easy to understand and maintain. And this boils down to the interfaces between the parts, and what parts we need. We would need some kind of logging/console-output package, a git-cli package, etc. |
We can focus on one leaf at a time, and try to extract that. I would start with a simple thing. |
The PR shows how we could extract leaves without introducing cyclic dependencies. Now we would have
|
I experimentally refactored a little bit this evening as well. There are three things that almost every function uses: git, configuration, and say. We can sometimes mitigate git or configuration by passing in the necessary infos instead of getting them within a package, but probably not always does this lead to better code. I am still not sure which direction to take here ... or if this is currently the way to go. I think having files for every major mob command might be the way forward, with Overall, I think the say package makes sense. We can extract that anyway. I am not convinced about the configuration package, as this does so many things and every new command might need to change this as well. Let's keep this in |
Of all the code of The only reason I pulled out |
I think the PR #297 is a good start. Why not merge it? |
We're close to 2000 lines in mob.go and its getting a little painful to work with it.
I can't find what I'm searching for by scrolling. I use find, and I'm always a little lost.
And it's the same with mob_test.go.
I think it would be a good idea to start and extract cohesive functionality to their own files.
I'm thinking about things like:
Would love to hear your opinions on this.
The text was updated successfully, but these errors were encountered: