Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Suggestion: Implement Builder Pattern for SaveManager Initialization #825

Open
km19809 opened this issue Jan 17, 2025 · 1 comment
Open

Comments

@km19809
Copy link

km19809 commented Jan 17, 2025

Hi team,

I’m new here and have a question regarding the documentation. The docs mention that some functions of the SaveManager struct should not be called twice and that it must be initialized before any access.

Would it be possible to introduce a builder pattern for this?

Here’s a suggestion:

  1. SaveManagerBuilder could have init_* functions, with each function returning a specific type of SaveManager.
  2. Only types implementing the SaveManager trait would have access and access_with_timer methods, ensuring the save manager is properly initialized.

I would love to hear your thoughts on this.

@gwilymk
Copy link
Member

gwilymk commented Feb 1, 2025

It would probably make sense to. I don't think I've personally been able to get saving correct first try yet 😂.

I'm wondering if we want a higher level API to be the one that's exposed eventually. Maybe it even abstracts away everything and you just ask it to save something Serializable and load something Deserializable and that's it.

Our current focus is on objects and backgrounds, but we'll probably take a look at saving after that since we've gotten it wrong many times.

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

No branches or pull requests

2 participants