Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

10
  • 5
    It does violate the LSP, but you're wrong about why. It inherits all of its parent's methods, you don't write them out again in UML. Commented Nov 17, 2018 at 21:11
  • 1
    If the ebooks method was renamed "ship" and moved to Book.. Commented Nov 17, 2018 at 21:21
  • 3
    Yes, the idea of "stock" makes no sense for an ebook. Commented Nov 17, 2018 at 21:41
  • 1
    @jonrsharpe If I think about your first comment, I believe that the Single Responsibility Principle is hurt as well because the class E-book can send mail as its function but can also do replenish stocks as it's inherited to the class Book. So we have a class (E-book) that does not only have one responsibility (it has 2) which clearly hurts this principle? Commented Nov 17, 2018 at 21:49
  • 1
    SOLID principles more about implementation then design. You will know is Liskov Substitution Principle violated only when you see implementation of overridden methods. Single Responsibility Principle is about that class should have only one reason to change. So if you want change how emails sends then you will change EBook class, if you want to change how replenish stocks is done, you will change Book class, so for me both classes have single responsibility. Commented Nov 17, 2018 at 22:53