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
Added primary key to Person as our first internal state field to track and save #80
Conversation
… track of, and implemented save functionality for it as well.
7095f4f
to
59fcd01
Compare
59fcd01
to
c189b49
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly ok, but we should at least do this before merging:
- Update test helper classes
PersonBuilder
. Add in a method to setprimaryKey
. - Change the naming of the
primaryKeyCounter
to be more specific towardsPerson
class.
These should be future sprint enhancements:
- Tests for
InternalStorage
and related classes (low priority) - Validation to check if
primaryKeyCounter
forInternalStorage
is valid upon file load. (Higher priority)
help la
also small bugfixes and added other minor tests
primarykey being exposed is quite contentious. Some points about the behavior now:
So it is quite messy. I will add some tests for other behavior, but I don't think I will ever want to change the
Done
Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job for catching those edge cases regarding .equal
method for Person
class. Should document it in the Developer guide in the future.
Personally I think your equal
method is ok - it should be comparing the content of the Person
object, and I would argue that primaryKey
isn't really a content , but an identity of that object and hence shouldn't be used for .equal
comparison (similar to how hashcode doesn't get compared)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
The UserPrefs now store one more path, that is the path of the internal state save file. By default it is
data/state.json
.The only things that need to be touched when adding more fields in is the
{update, apply}InternalState
functions. Be sure to update them!