Book description
Explore and crack the OOP code in Python, JavaScript, and C#
In Detail
Learning Object-Oriented Programming is an easy-to-follow guide full of hands-on examples of solutions to common problems with object-oriented code in Python, JavaScript, and C#. It starts by helping you to recognize objects from real-life scenarios and demonstrates that working with them makes it simpler to write code that is easy to understand and reuse. You will learn to protect and hide data with the data encapsulation features of Python, JavaScript, and C#.
You will explore how to maximize code reuse by writing code capable of working with objects of different types, and discover the advantage of duck typing in both Python and JavaScript, while you work with interfaces and generics in C#. With a fair understanding of interfaces, multiple inheritance, and composition, you will move on to refactor existing code and to organize your source for easy maintenance and extension.
Learning Object-Oriented Programming will help you to make better, stronger, and reusable code.
What You Will Learn
- Generate instances in three programming languages: Python, JavaScript, and C#
- Customize constructors and destructors
- Work with a combination of access modifiers, prefixes, properties, fields, attributes, and local variables to encapsulate and hide data
- Take advantage of specialization and the possibility to overload or override members
- Create reusable and easier to maintain code
- Use interfaces, generics, and multiple inheritance when available
Table of contents
-
Learning Object-Oriented Programming
- Table of Contents
- Learning Object-Oriented Programming
- Credits
- About the Author
- Acknowledgments
- About the Reviewers
- www.PacktPub.com
- Preface
- 1. Objects Everywhere
-
2. Classes and Instances
- Understanding classes and instances
- Understanding constructors and destructors
- Declaring classes in Python
- Customizing constructors in Python
- Customizing destructors in Python
- Creating instances of classes in Python
- Declaring classes in C#
- Customizing constructors in C#
- Customizing destructors in C#
- Creating instances of classes in C#
- Understanding that functions are objects in JavaScript
- Working with constructor functions in JavaScript
- Creating instances in JavaScript
- Summary
- 3. Encapsulation of Data
-
4. Inheritance and Specialization
- Using classes to abstract behavior
- Understanding inheritance
- Understanding method overloading and overriding
- Understanding operator overloading
- Taking advantage of polymorphism
- Working with simple inheritance in Python
- Working with simple inheritance in C#
- Working with the prototype-based inheritance in JavaScript
- Summary
- 5. Interfaces, Multiple Inheritance, and Composition
-
6. Duck Typing and Generics
- Understanding parametric polymorphism and duck typing
- Working with duck typing in Python
-
Working with generics in C#
- Declaring an interface to be used as a constraint
- Declaring an abstract base class that implements two interfaces
- Declaring subclasses of an abstract base class
- Declaring a class that works with a constrained generic type
- Using a generic class for multiple types
- Declaring a class that works with two constrained generic types
- Using a generic class with two generic type parameters
- Working with duck typing in JavaScript
- Summary
- 7. Organization of Object-Oriented Code
- 8. Taking Full Advantage of Object-Oriented Programming
- Index
Product information
- Title: Learning Object-Oriented Programming
- Author(s):
- Release date: July 2015
- Publisher(s): Packt Publishing
- ISBN: 9781785289637
You might also like
book
Modern Programming: Object Oriented Programming and Best Practices
Discover the untapped features of object-oriented programming and use it with other software tools to code …
book
Learning React, 2nd Edition
If you want to learn how to build efficient React applications, this is your book. Ideal …
book
Python Object-Oriented Programming - Fourth Edition
A comprehensive guide to exploring modern Python through data structures, design patterns, and effective object-oriented techniques …
book
Programming Rust, 2nd Edition
Systems programming provides the foundation for the world's computation. Writing performance-sensitive code requires a programming language …