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

UserManager instance attribute #1

Closed
Tyler-CY opened this issue Oct 8, 2021 · 2 comments
Closed

UserManager instance attribute #1

Tyler-CY opened this issue Oct 8, 2021 · 2 comments

Comments

@Tyler-CY
Copy link
Contributor

Tyler-CY commented Oct 8, 2021

What should the instance attribute of UserManager be?

Should it be a Map<String, User> or Map<String, String>?

The former makes the most sense as it stores the username as key and User datatype as value.

The latter makes some sense if we want to have addUser(String username, String password), or else we need to create an entity (User) for the second argument.

@maxBridgewater
Copy link
Contributor

I think it should be the first one. What we can do is have a controller class that when it tells teh userManager to add a user, all the user manager needs to do is return the type User. Then the controller class can take that user entity and write it out to the .json file. I am a little confused as well, so we'll see what other people think too.

@Tyler-CY
Copy link
Contributor Author

Conclusion: Map<String, User> is the final decision. The first argument is the username (String) and the second argument is a User entity.

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

2 participants