-
Notifications
You must be signed in to change notification settings - Fork 1
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
Refactor affiliate linking. #7
base: main
Are you sure you want to change the base?
Conversation
By using a struct to define the state of our original to affiliated transformation we reveal more about our intentions.
@@ -0,0 +1,9 @@ | |||
defmodule ElloClick.Affiliate.Link do | |||
defstruct [original: nil, affiliated: nil, is_affiliated: false] |
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.
Is it worth expanding out the names of these fields a bit as long as we're trying to be extra-clear (e.g. original_link
, affiliated_link
)? Not sure if it's idiomatic, just a thought.
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.
I don't mind the shorter names. Since they are in a Link
struct the "link" prefix is not needed. Not sure what you think @alanpeabody.
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.
I tend towards brevity in variable names, but happy to update to add them.
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.
We were actually thinking this could even be taken a little further and have those be %URI{} structs so we could match on hostname without schema easier.
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.
Ah nice, that'd be cool.
b7ec6d3
to
14ce02f
Compare
By using a struct to define the state of our original to affiliated
transformation we reveal more about our intentions.