Created
November 16, 2011 19:00
-
-
Save martinusso/1370983 to your computer and use it in GitHub Desktop.
Refactoring #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Improving the reading and understanding of your code | |
{ Before } | |
Utils = class | |
public | |
class property MessageUtils: TMessageUtils read FMessageUtils; | |
TMessageUtils = class | |
public | |
class procedure ShowWarning(const message: string); | |
class procedure ShowError(const message: string); | |
// using | |
Utils.MessageUtils.ShowWarning('Hello World!'); // ugly | |
{ After } | |
Utils = class | |
public | |
class property ShowMessage: TMessageUtils read FShowMessage; | |
TMessageUtils = class | |
public | |
class procedure Warning(const message: string); | |
class procedure Error(const message: string); | |
// using | |
Utils.ShowMessage.Warning('Hello World!'); // cool |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment