View on GitHub

Bearded-android-docs

ParameterizeConstructor

Download this project as a .zip file Download this project as a tar.gz file

Created Sunday 27 April 2014

//Before
public BadConstructor()
{
    this.hiddenDependency = new HiddenDependency();
}

//After
//(don't break existing code)
public BadConstructor()
{
super(new HiddenDependency());
}

@NewConstructor
public BadConstructor(HiddenDependency hd)
{
this.hiddenDependency = new HiddenDependency();
}

Backlinks:

OOP:RefactoringLegacyCode
comments powered by Disqus