[RUBY] Object-oriented programming terminology

class

・ Data type -Alias: "Object blueprint" "Object template" -If the class is the same, the attributes (data items) held and the methods that can be used are the same.

Objects, instances, receivers

・ A chunk of data created based on a class -When explaining the relationship with a method, it is sometimes called a receiver.

python


food = Food.new('apple', '7:00')
food.name

This code may be described as: "The second line calls the name method of the Food object." "The receiver for the name method here is food."

Method, message

-A group of processes with a name.

python


food = Food.new('apple', '7:00')
food.name

"The second line sends the message name to the receiver called food."

State

-Data held for each object -Data such as "name" and "age" of the Food class is also included in the "Food status".

Attributes (attributes, properties)

-A value that can be obtained from an object

python


food = Food.new('apple', '7:00')
food.name = 'apple'

reference An introduction to Ruby for those who want to become professionals

Recommended Posts

Object-oriented programming terminology
Object-oriented programming
What is object-oriented programming? ~ Beginners ~
Object-oriented programming learned from Dragon Ball
Summary of object-oriented programming using Java
Object-oriented summary
Object-oriented rock-paper-scissors
[Java] Object-oriented
[Processing x Java] Data type and object-oriented programming
Awareness of object-oriented programming for half a year