Challenges
I've set a goal to be as follows:
- Instances will have proper class names and not some generated names
- Declarations will present themselves in the code exactly the same way regardless of the base type
- The code will look understandable
The template
First we need a namespace so that the global one doesn't get polluted:Then we need to define the constructor (this will give the actual name for the class later on:
And finally we'll implement some public methods:
This way the actual class is "Namespace.ClassName" and not some wierdo, public methods are cleanly separated and default configuration is in one place.
As a bonus this pattern works for every single class - no matter if it is a component (GridPanel, Window) or not (ie. Store)
I hope this will make someone's coding adventure a little bit less messy :)
Have a nice day!
No comments:
Post a Comment