Skip to main content

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 34.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 49.95
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 44.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 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. 2.

    To make things more complicated, some authors use the word ‘object’ as a synonym for the ‘instance of a class’.

  3. 3.

    The example is extremely simplified, and we excluded the amphibian subcategory.

  4. 4.

    The war god of Mayas.

  5. 5.

    Another war god of Mayas.

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics