Inheritance is a good way to give objects common functionality while changing key pieces to suit different purposes. For example, you can define an interface that describes how data flows through your application. Then you can write an abstract class with the database plumbing. Then maybe you’d create a posts class to represent a collection of posts, and that class is where you’d store the logic specific to posts. In this model, there is no code duplication, and you’re using interference to share code across multiple objects that largely work the same.