Skip to content

Conversation

anttimaki
Copy link
Collaborator

This is part of a larger refactoring effort aiming to remove the
business logic from components so it can eventually be exported to be
a responsibility of a CLI tool.

This is part of a larger refactoring effort aiming to remove the
business login from components so it can eventually be exported to be
a responsibility of a CLI tool.

Instead of inheritance, both classes only implement an interface
defining the common methods. This was done so that when a function
expects one of the classes, it won't accept the other. Being strict
about this makes it easier to see which part of the code base depend on
the active profile, and might reduce cases where passing wrong type of
object results in unexpected behaviour. The code duplication caused by
this within the classes seems like a small price to pay.

The static method for accessing the root dir of all profiles was
renamed to getRootDir() to make it clearer what directory it actually
returns. The method is not available on ImmutableProfile, since it
depends on the state of the app (active game) via PathResolver. We'll
likely add a non-static method to ImmutableProfile in a later commit
to reduce the dependency to app state where it's not required.
In retrospect IDK if this cleaned up the code as I thought it would.
These can be used to take an immutable snapshot of the currently active
profile.
@anttimaki anttimaki merged commit 6015233 into develop Oct 14, 2024
5 checks passed
@anttimaki anttimaki deleted the immutable-profile branch October 14, 2024 11:57
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

Successfully merging this pull request may close these issues.

2 participants