Encapsulation

In this chapter, we will begin to discuss the concepts of Object-oriented programming (OOP). OOP is a style of programming that is very common in our industry today. OOP is built on the concept of 4 fundamental principles to help organize your code and projects. These are called the 4 Pillars of OOP. They are Encapsulation, Inheritance, Polymorphism and Abstraction. We will begin by learning about Encapsulation.

Updated

Working with Objects

  1. Working with Objects: an overview (Novice): Object-oriented programming models a program on real things: objects that each have a job to do.
  2. What is an Object (Novice): Every object has a responsibility, and modeling a program starts with listing the objects and what each one is for.
  3. Defining an Object (Apprentice): An object's responsibilities split into what it knows (its variables) and what it can do (its methods), and a class is the blueprint that describes both.
  4. Writing the Class in Java (Apprentice): Turn a class design into Java with private variables, getters and setters, and methods, then create an object from it with new.
  5. What is a Constructor (Apprentice): A constructor gives a new object the starting values it needs, and `this` tells the object's own variable apart from a parameter with the same name.

Objects from a Database

  1. Objects from a Database: an overview (Journeyman): Most Java applications work with data from a database, so many of their classes model a table, with one object for each row.
  2. Creating Data Models (Journeyman): A data model class mirrors a database table, with a private variable and a getter and setter for each column.