Develpreneur: Become a Better Developer and Entrepreneur
Is A and Has A Concepts in Object-Oriented Design
12 Mar 2021
The ideas of "is a" and "has a" are often discussed as part of object-oriented design. These concepts may seem simple and obvious. However, they can often be confused, and complex systems can blur the lines between them. We start a multi-part episode going over these concepts focused on how "is a" relationships work. Is A and Has A Defined These concepts boil down to simple grammar. For two objects, A and B, here are the options. A is a B if A has all of the traits of B. For example, a poodle is a dog because a poodle has the traits we equate to a dog. A dog is not a poodle, as some dogs have traits that are not shared with a poodle. A has a B when the entirety of B exists within A. A dog has a tail. The tail does not exist on its own away from the dog. More simply, a car has a color. In these relationships, multiple things can have the B part of the relationship. One Way Relationships For our purposes, these are one-way relationships. When A is a B, B is not an A. Likewise, when A has a B, B does not have an A. The color does not have a car; the tail does not have a dog. These definitions can seem to break when we replace names with instances. A father can have a son, and a son can have a father, but that is not a definition of contained properties. This example would be a relationship or pointers and not attributes that are contained. You have a height no matter what. You may not have a father if he passes away or something like that. As you can see already, grammar can confuse the situation, so we will continue to dig into these concepts and applying them.
No persons identified in this episode.
This episode hasn't been transcribed yet
Help us prioritize this episode for transcription by upvoting it.
Popular episodes get transcribed faster
Other recent transcribed episodes
Transcribed and ready to explore now
3ª PARTE | 17 DIC 2025 | EL PARTIDAZO DE COPE
01 Jan 1970
El Partidazo de COPE
13:00H | 21 DIC 2025 | Fin de Semana
01 Jan 1970
Fin de Semana
12:00H | 21 DIC 2025 | Fin de Semana
01 Jan 1970
Fin de Semana
10:00H | 21 DIC 2025 | Fin de Semana
01 Jan 1970
Fin de Semana
13:00H | 20 DIC 2025 | Fin de Semana
01 Jan 1970
Fin de Semana
12:00H | 20 DIC 2025 | Fin de Semana
01 Jan 1970
Fin de Semana