posted 16 years ago
So I was digging through the code examples for Google Web Toolkit and I came across this example code for the KitchenSink Project. I was looking at the Sink Class and how its structured and initialized and I couldnt help but wonder why they did it the way they did.
Sink Class
1. Abstract... so its meant to be derived from.. fine
2. Derived from another class Composite...fine
3. Now instead of storing 2 fields for name and description for the sink name and description. It has another abstract static class inside it. The abstract static class also contains an instance of the Sink class and is used to return an instance of the Sink object itself.
So Why did they do it this way (example A) and not simpler (example B)
What was the advantage of using an abstract static class inside ?
Example A
Example B.