Object-Oriented Design Class Object Attribute Method

J.E.D.I. 1 Review of Basic Concepts in Java

1.1 Objectives

Before moving on to other interesting features of Java, let us first review some of the things youve learned in your first programming course. This lesson provides a brief discussion of the different object-oriented concepts in Java. After completing this lesson, you should be able to: 1. Explain and use the basic object-oriented concepts in your programs • class • object • attribute • method • constructor 2. Describe advanced object-oriented concepts and apply them in programming as well • package • encapsulation • abstraction • inheritance • polymorphism • interface 3. Describe and use this, super, final and static keywords 4. Differentiate between method overloading and method overriding

1.2 Object-Oriented Concepts

1.2.1 Object-Oriented Design

Object-oriented design is a technique that focuses design on objects and classes based on real world scenarios. It emphasizes state, behavior and interaction of objects. It provides the benefits of faster development, increased quality, easier maintenance, enhanced modifiability and increase software reuse.

1.2.2 Class

A class allows you to define new data types. It serves as a blueprint, which is a model for the objects you create based on this new data type. The template student is an example of a class. We can define every student to have a set of qualities such as name, student number and school level. We can also define students Introduction to Programming II Page 9 J.E.D.I. to have the ability to enroll and to attend school.

1.2.3 Object

An object is an entity that has a state, behavior and identity with a well-defined role in problem space. It is an actual instance of a class. Thus, it is also known as an instance. It is created everytime you instantiate a class using the new keyword. In a student registration system, an example of an object would be a student entity, say Anna. Anna is an object of the class student. Thus, the qualities and abilities defined in the student template are all applicable to Anna. For simplicity, you can think of a class as a more general term compared to an object.

1.2.4 Attribute

An attribute refers to the data element of an object. It stores information about the object. It is also known as a data member, an instance variable, a property or a data field. Going back to the student registration system example, some attributes of a student entity include name, student number and school level.

1.2.5 Method

A method describes the behavior of an object. It is also called a function or a procedure. For example, possible methods available for a student entity are enroll and attend school.

1.2.6 Constructor