Skip to content

Instantly share code, notes, and snippets.

@mefarazath
Created September 24, 2017 08:24
Show Gist options
  • Save mefarazath/891b4872482663940651a71bed7e10d5 to your computer and use it in GitHub Desktop.
Save mefarazath/891b4872482663940651a71bed7e10d5 to your computer and use it in GitHub Desktop.
#### Constructor #####
Ask what you need directly
public X(Config config) {
user = config.getUser();
// blah
y = config.getY();
}
# Testable
public X(User user, Y y) {
this.user = user;
// blah
this.y = y;
}
######### Using new constructor within methods ##############
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment