Ensure derived classes are substitutable for Base classes with Liskov’s Substitution Principle
T his article, the third of the 5-part article on S.O.L.I.D design principles, is about the “L,” Liskov’s substitution principle made famous by Robert C. Martin (Uncle Bob)in his paper, https://web.archive.org/web/20150924054349/http://www.objectmentor.com/resources/articles/Principles_and_Patterns.pdf . The principle was initially introduced by Barbara Liskov in a 1987 conference keynote address titled Data abstraction and hierarchy . https://dl.acm.org/citation.cfm?id=62141 S — Single-responsibility principle O — Open-closed principle L — Liskov substitution principle I — Interface segregation principle D — Dependency Inversion Principle Contracts, Promises & APIs The public interface , method of an object is its contract with the rest of the world. That API or contract is that objects promise to the world or the client of what service it provides. In the field of Software engineering , modularisation is ...