Week 2

--Originally published at chozaoop

This class is about researching what an Object, Attribute and Method are.

An Object has 2 main characteristics: State and Behavior; states can be explained as what status the object has, as an example, a car might be “On” and “Off”, these are obvious conditions for that object; and the Behavior might be “Running” or “Standby”, an Object can exist with or without a name, a name just references objects, it isn’t the object itself.

Behavior = Method    —-&—-  State =  Fields

An object might have objects inside, the value of the attribiutes may vary.

A class describes the object, which is an instance

The answer of a method might return a different result depending of which object does it.

“A method always begins with lower case.” -Ken, 2016.

—————————————————————————-

“Methods operate on an object’s internal state and serve as the primary mechanism for object-to-object communication. Hiding internal state and requiring all interaction to be performed through an object’s methods is known as data encapsulation — a fundamental principle of object-oriented programming.”

Taken from: http://docs.oracle.com/javase/tutorial/java/concepts/object.html

A method could be explained as a collection of statements that are grouped together to perform an operation.

—————————————————————————-

In general, an “attribute” is a property or characteristic.

In OOP,  an attribute is a public variable inside the class/object.

 


Week 2