Skip to content
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

Remove / refactor BSFormatter (tracking issue) #3240

Closed
bodymindarts opened this issue Sep 11, 2019 · 4 comments
Closed

Remove / refactor BSFormatter (tracking issue) #3240

bodymindarts opened this issue Sep 11, 2019 · 4 comments

Comments

@bodymindarts
Copy link

bodymindarts commented Sep 11, 2019

While making myself familiar with the code and thinking about improvements I kept seeing complexities connected to the BSFormatter class.

The code base is quite tangled up and that class is one of the places that contributes because:

  • it is bucket class with many many unrelated functions
  • it has a huge public interface even though most functions don't depend on instance state
  • it depends on globals
  • it is depended on by many classes
  • it is part of a type hierarchy

This led me to refactor it out of existence. The final state of the code is here but it is too much to review and merge in 1 step.
To get the code changes in I can break it down into 5-6 trivial commits / PRs, but don't want to do this work unless other ppl agree that removing this class makes sense.
Please give 👍 or 👎 as feedback on wether I should go ahead. Perhaps I am the only one who has seen these issues, or they aren't hurting anyone and the code can stay as is. In that case I don't want to make the effort.

@bodymindarts
Copy link
Author

If you do think this should be taken care of please review the first (trivial) PR #3239.

@bodymindarts
Copy link
Author

Reposting the design principles that led me to this refactoring:

  • Minimize dependencies on all levels. ie. small public interfaces for classes and libraries.
  • Prefer static functions for stateless helpers that don't contain domain logic
  • Prefer composition over inheritance for code reuse
  • Prefer interfaces over inheritance for polymorphism
  • Don't depend on global state in regular classes, better to inject it via constructor

I assume these are not contentious and am omitting justification. Happy to discuss these points if there is dissent.

@bodymindarts
Copy link
Author

Here is step 2. Extract 2 classes #3244

@bodymindarts
Copy link
Author

Completed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant