Timeline for Does calling a virtual protected method from a base class violate the LSP?
Current License: CC BY-SA 3.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 17, 2011 at 13:41 | history | edited | Péter Török | CC BY-SA 3.0 | added 154 characters in body |
| Nov 17, 2011 at 13:14 | comment | added | Péter Török | I can only second @deadalnix's response to your comment. IMO you are overcomplicating your design in search for some high ideal which usually turns out impractical in real life. The overhead doesn't seem big with a single abstract method - but just try to imagine how would your solution scale with ten abstract methods, of which various subclasses require the default behaviour of different ones? | |
| Nov 17, 2011 at 13:04 | history | edited | Péter Török | CC BY-SA 3.0 | added 1 characters in body |
| Nov 17, 2011 at 12:55 | comment | added | Scott Whitlock | As I commented on @deadalnix's answer, I believe for this to be the Template Method pattern, then ExtraDescriptions must be declared abstract, and then that certainly doesn't violate the LSP. It looks to me like the answer should be to create an abstract base class that implements the Template Method pattern, and then have a Default implementation that returns an empty list for ExtraDescriptions, and another implementation that returns other lists. | |
| Nov 17, 2011 at 12:50 | history | answered | Péter Török | CC BY-SA 3.0 |