Composition vs. Inheritance [duplicate]
This question already has answers here: Designing a library that is easy to use: composition or inheritance (2 answers) Closed 11 years ago. Here’s what is given: public interface Request {} // there are 20 subclasses of Request public class CreateUserRequest implements Request { @NotEmpty public String userName; } // request processor is a thing […]
Inheritance using non-abstract base class
This post is based on the question https://stackoverflow.com/questions/49002/prefer-composition-over-inheritance/11758048#comment15634305_11758048.
What is the best way to use inheritance with ORMs?
If I have a People table and those people can be at different addresses, and each address can have more than one person, thats a many-to-many relationship.
How to create a common interface for classes with different subsets of members
Don’t know how to put it, But I’ll try to be as clear as possible
How do inheritance and composition differ?
I’m wondering about the differences between inheritance and composition examined with concrete code relevant arguments.
How to verify the Liskov substitution principle in an inheritance hierarchy?
Inspired by this answer:
JavaScript objects and Crockford’s The Good Parts
I’ve been thinking quite a bit about how to do OOP in JS, especially when it comes to encapsulation and inheritance, recently.
How do you handle objects that need custom behavior, and need to exist as an entity in the database?
For a simple example, assume your application sends out notifications to users when various events happen. So in the database I might have the following tables:
REST API wrapper – class design for ‘lite’ object responses
I am writing a class library to serve as a managed .NET wrapper over a REST API. I’m very new to OOP, and this task is an ideal opportunity for me to learn some OOP concepts in a real-life situation that makes sense to me.
Naming methods that do the same thing but return different types
Let’s assume that I’m extending a graphical file chooser class (JFileChooser
).