Develpreneur: Become a Better Developer and Entrepreneur
Polymorphism Overview - Reducing code size and a better user experience
24 Feb 2021
We start the next series of episodes with a polymorphism overview. This is a core concept for proper object-oriented design. Likewise, we will dig into several practical ways to use this. Polymorphism Overview - A Definition As with many topics, it seems best to start with a definition from Wikipedia. In programming languages and type theory, polymorphism is the provision of a single interface to entities of different types or the use of a single symbol to represent multiple different types. For our purposes, that symbol that is referred to can be considered a name. The name can be a method, class, or property name. Class Vs. Object It is worth clarifying the difference between a class and an object. We will be talking about these two terms a lot from here on out. Therefore, let's remove any confusion. A Class is the definition of a class. Think of it as a set of rules or a template. A simple pseudo-code example is below. Class MyExample { String name; String value; public whoAmI() { return this.name; } } An object or instance is an occurrence of a class. In the example below, myPointer is an object (or instance) of the class MyExample. These are simple examples. However, the concept is simple. In the real world, an example would be that there is a class called Mother, and your mom is an instance of that class. myPointer = new MyExample(); The General Concept And Examples Since this is a polymorphism overview, we now need to talk about examples. In general, polymorphism allows us to provide commands to objects they can follow for their specific case. We have examples of this throughout the real world via commands we give and questions we ask. We can look at the request "tell me about yourself" as an example. The response may be a name, a profession, a season of life, an entire life story, or countless other responses. In this case, the object the person you are talking to will take that request and polymorphically respond. It is polymorphic because the same command is understandable by each of us. However, we will have different responses due to our personality (or class). In the code world, a command like this may be "save" or "print" or myriad other commands. These allow us to "tell" a group of objects the same command and have each respond in a pertinent way.
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