Abstract
In the first chapters of the book, while implementing a solution to a world problem, data was separated from action. In this chapter, based on the analogy to objects in the real-world, data and action are combined in single representational entities that are called objects. This brings into the scene a new programming paradigm known as “object-oriented programming”. This chapter talks about the ideas and principles that govern object-oriented programming; namely, encapsulation, inheritance and polymorphism. Encapsulation means grouping actions and data together as objects for hiding the internal details of the objects from the outside world, i.e., other objects. Inheritance is the ability to define new objects based on already defined objects. Through inheritance, objects can share actions and data that help the programmer in organizing the solution in a modular and structured manner. Polymorphism, on the other hand, pertains to objects’ behaving differently (either as itself or as the object that it has inherited from) based on context and usage. Finally, how objects are defined in Python is presented and the properties of object-oriented programming are analyzed in Python with illustrative examples.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
This is certainly not the only solution to information processing. Our brain (i.e., a connectionist machine, where every function is handled in the connections of identical self-functioning units), for example, does not make this black and white distinction; you can hardly pinpoint a neuron (nor a group of them) and claim that item stores the age of your grandmother (and nothing else).
- 2.
To make things more complicated, some authors use the word ‘object’ as a synonym for the ‘instance of a class’.
- 3.
The example is extremely simplified, and we excluded the amphibian subcategory.
- 4.
The war god of Mayas.
- 5.
Another war god of Mayas.
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2012 Springer-Verlag Wien
About this chapter
Cite this chapter
Üçoluk, G., Kalkan, S. (2012). Objects: Reunion of Data and Action. In: Introduction to Programming Concepts with Case Studies in Python. Springer, Vienna. https://doi.org/10.1007/978-3-7091-1343-1_7
Download citation
DOI: https://doi.org/10.1007/978-3-7091-1343-1_7
Publisher Name: Springer, Vienna
Print ISBN: 978-3-7091-1342-4
Online ISBN: 978-3-7091-1343-1
eBook Packages: Computer ScienceComputer Science (R0)