Skip to content

Rename solution to exercise metadata#693

Closed
kytrinyx wants to merge 1 commit intomasterfrom
rename-solution
Closed

Rename solution to exercise metadata#693
kytrinyx wants to merge 1 commit intomasterfrom
rename-solution

Conversation

@kytrinyx
Copy link
Copy Markdown
Member

@kytrinyx kytrinyx commented Aug 4, 2018

This is a pure rename, so while the diff is quite big, the change is small:

  • workspace.Solution is now workspace.ExerciseMetadata
  • workspace.Solutions is now workspace.MetadataCollection

What we previously called Solution is actually the exercise metadata, which also
includes the user's solution UUID.

In order to keep things as clear as possible, this also renames the Solutions
type to MetadataCollection. ExerciseMetadataCollection seemed to long,
and I couldn't think of anything better than collection to deal with the
multiples of a multiple.

@kytrinyx kytrinyx requested a review from nywilken August 4, 2018 16:31
@nywilken
Copy link
Copy Markdown
Contributor

nywilken commented Aug 5, 2018

In order to keep things as clear as possible, this also renames the Solutions
type to MetadataCollection. ExerciseMetadataCollection seemed to long,
and I couldn't think of anything better than collection to deal with the
multiples of a multiple.

ExerciseMetadataCollection makes sense to me.

Comment thread cmd/download.go Outdated
}

solution := workspace.Solution{
solution := workspace.ExerciseMetadata{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be too much of a change, confusion, if we renamed this to metadata? If we can't change the name with out changing a ton of code right now what do you think about adding a TODO?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went back and forth on Metadata vs ExerciseMetadata and was worried that Metadata was too unspecific. I like the shorter name better, though, so I'll go with that.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for not being explicit when I mentioned renaming this. I meant just changing solution to metadata. I'm on the fence about the name. ExerciseMetadata is clearer, but longer.

Comment thread cmd/submit.go Outdated
}

sx, err := workspace.NewSolutions(dirs)
sx, err := workspace.NewMetadataCollection(dirs)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets call this one collection like you do in the tests.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yes! I agree.

Copy link
Copy Markdown
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kytrinyx I left a couple of comments around renames, but otherwise this is good with me. It makes things clearer for sure. I will try and work with @jdsutherland to get his PR in to avoid having to make too many changes in the future.

What we previously called Solution is actually the exercise metadata, which also
includes the user's solution UUID.

In order to keep things as clear as possible, this also renames the Solutions
type to MetadataCollection. I couldn't think of anything better than collection to deal with the
multiples of a multiple.
@kytrinyx
Copy link
Copy Markdown
Member Author

kytrinyx commented Aug 5, 2018

@nywilken I changed the name to Metadata instead of ExerciseMetadata. I also updated the local variables to match (including the sx that you found, and a couple of stray ones that were solution instead of metadata).

@jdsutherland
Copy link
Copy Markdown
Contributor

jdsutherland commented Aug 7, 2018

@nywilken I'm happy to adapt #630 to fruition. Having glanced at #696 and #693, it seems like the most sensible path forward would be to wait until they get merged and start a new PR off master because so much of #630 will be stale due to refactoring.

Is that what you would suggest?

@kytrinyx
Copy link
Copy Markdown
Member Author

kytrinyx commented Aug 7, 2018

@jdsutherland I think that's probably the easiest way forward. I actually think that with the recent changes, and what you already figured out in #630 it should be easier this second time around. (I'm sorry for the extra work, though!)

@jdsutherland
Copy link
Copy Markdown
Contributor

@kytrinyx No problem at all - it's useful to learn from how you improved things.

Comment thread cmd/download.go
}

solution := workspace.Solution{
metadata := workspace.Metadata{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something about this type is off to me , but I can't put my finger on why. It may have to do with the two properties IsRequester and `Team.

Copy link
Copy Markdown
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kytrinyx not to make this review longer, but what do you think about holding off on the rename for now. I get the rationale for the change, but I'm just not sure if Metadata minimizes the confusion. I think ExerciseMetadata as the name reads better, but it is still a little confusing since the metadata file is .solution.json

I know that we will eventually refactor so if renaming to Metadata makes sense for now. Then we can roll with it. FYI I didn't leave any comments on the non rename changes made to open because #696 gets rid of it.

@kytrinyx
Copy link
Copy Markdown
Member Author

kytrinyx commented Aug 7, 2018

@nywilken I don't feel strongly either way. I'll close this and we can re-evaluate after the file gets moved.

@kytrinyx kytrinyx closed this Aug 7, 2018
@kytrinyx kytrinyx deleted the rename-solution branch August 7, 2018 21:28
@nywilken
Copy link
Copy Markdown
Contributor

nywilken commented Aug 7, 2018

Awesome. 🙌🏽

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.

3 participants