Book Image

Learning Java by Building Android Games

By : John Horton
Book Image

Learning Java by Building Android Games

By: John Horton

Overview of this book

Table of Contents (17 chapters)
Learning Java by Building Android Games
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

What is OOP?


OOP is a way of programming that involves breaking our requirements down into chunks that are more manageable than the whole.

Each chunk is self-contained yet potentially reusable by other programs while working together as a whole with the other chunks.

These chunks are what we have been referring to as objects. When we plan an object, we do so with a class. A class can be thought of as the blueprint of an object.

We implement an object of a class. This is called an instance of a class. Think about a house blueprint. You can't live in it, but you can build a house from it, which means you build an instance of it. However, OOP is more than this. It is also a methodology that defines best practices such as the following:

  • Encapsulation: This means keeping the internal workings of your code safe from interference from the programs that use it, and allowing only the variables and methods you choose to be accessed. This means your code can always be updated, extended, or improved without...