SlideShare a Scribd company logo
Object-oriented
programing in Ruby
Ngoc Nguyen
Overview
❖ Introduction
❖ Class
❖ Object
❖ Inheritance
❖ Super method
OOP in Ruby
❖ Uses Object and their interactions to design application
and computer programs
❖ Basic Concepts
➢ Abstraction
➢ Polymorphism
➢ Encapsulation
➢ Inheritance
Basic Concepts
❖ Abstraction
➢ simplifying complex reality by modeling class appropriate to the
problem.
❖ Polymorphism
➢ process of using a operator or function in different ways for different
data input.
Basic Concepts
● Encapsulation
o hides the implementation of a class from other object
● Inheritance
o a way to form new classes using classes that have already been
define
Class
❖ is used to specify the form of an object
❖ combines data representation and methods for
manipulating that data into one packet
❖ data and methods in class are members of class
Object
❖ are basic building blocks of OOP program
❖ combination of data and methods
❖ communicate together throught methods
❖ can receive, send message, process data
Object
❖ Two steps in creating object
➢ define a class
➢ run a instance of that particular class
The constructor
❖ special kind of method
❖ automatically called when object is created
❖ initiate the state of an object
❖ called is `initialize`
The Constructor
❖ object’s attributes - instance variables or member fields
➢ data items into that object
❖ `allocate` method
➢ create object without constructor
Constructor Overloading
❖ has no constructor overloading
➢ object is created with default parameter values
Methods
❖ are functions defined inside the body of class
❖ used to perform operations with object’s attributes
Methods
❖ instance methods
➢ the method that the object contains
❖ class methods
➢ the method that created by self class
➢ define: “self.method_name”
Accessor & Setter methods
❖ to make variables available from outsite class
❖ define variables (set values)
Inheritance
❖ newly formed classed are called derived classes
❖ the classes that we derive from are called base classes
❖ the devired classes override or extend the functionality
of base classes
Inheritance
❖ use `<` operator to create inheritance relations
❖ `super` method to call parent function
❖ `ancestors` method to show lists of ancestors
The super method
❖ call a method of the same name in the parent’s class
❖ super
➢ passed all arguments to parent’s classes
❖ super()
➢ no arguments passed to perent’s classes
References
❖ Object oriented Ruby
➢ http://www.tutorialspoint.com/ruby/ruby_object_oriented.htm
❖ Object-oriented programming in Ruby
➢ http://zetcode.com/lang/rubytutorial/oop/

More Related Content

What's hot

INTRODUCTION TO JAVA
INTRODUCTION TO JAVAINTRODUCTION TO JAVA
INTRODUCTION TO JAVA
Pintu Dasaundhi (Rahul)
 
Pythonclass
PythonclassPythonclass
Class and object in c++
Class and object in c++Class and object in c++
Class and object in c++
NainaKhan28
 
Oops in java
Oops in javaOops in java
Introduction to OOP with java
Introduction to OOP with javaIntroduction to OOP with java
Introduction to OOP with java
Sujit Kumar
 
Java serialization
Java serializationJava serialization
Java serialization
Sujit Kumar
 
09 Object Oriented Programming in PHP #burningkeyboards
09 Object Oriented Programming in PHP #burningkeyboards09 Object Oriented Programming in PHP #burningkeyboards
09 Object Oriented Programming in PHP #burningkeyboards
Denis Ristic
 
object oriented programming using c++
 object oriented programming using c++ object oriented programming using c++
object oriented programming using c++
fasalsial1fasalsial1
 
Object oriented programming in php
Object oriented programming in phpObject oriented programming in php
Object oriented programming in php
Aashiq Kuchey
 
PHP - Introduction to Object Oriented Programming with PHP
PHP -  Introduction to  Object Oriented Programming with PHPPHP -  Introduction to  Object Oriented Programming with PHP
PHP - Introduction to Object Oriented Programming with PHP
Vibrant Technologies & Computers
 
Introduction to OOP(in java) BY Govind Singh
Introduction to OOP(in java)  BY Govind SinghIntroduction to OOP(in java)  BY Govind Singh
Introduction to OOP(in java) BY Govind Singh
prabhat engineering college
 
Java class,object,method introduction
Java class,object,method introductionJava class,object,method introduction
Java class,object,method introduction
Sohanur63
 
Java tutorial for beginners-tibacademy.in
Java tutorial for beginners-tibacademy.inJava tutorial for beginners-tibacademy.in
Java tutorial for beginners-tibacademy.in
TIB Academy
 
Packages namespace instance
Packages namespace instancePackages namespace instance
Packages namespace instance
Chenglin Lee
 
Chapter3 bag2
Chapter3 bag2Chapter3 bag2
Chapter3 bag2
teknik komputer ui
 
2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++
Jeff TUYISHIME
 
Introduction to php oop
Introduction to php oopIntroduction to php oop
Oops Concept Java
Oops Concept JavaOops Concept Java
Oops Concept Java
Kamlesh Singh
 
Dr. Rajeshree Khande : Java Inheritance
Dr. Rajeshree Khande : Java InheritanceDr. Rajeshree Khande : Java Inheritance
Dr. Rajeshree Khande : Java Inheritance
jalinder123
 
PHP- Introduction to Object Oriented PHP
PHP-  Introduction to Object Oriented PHPPHP-  Introduction to Object Oriented PHP
PHP- Introduction to Object Oriented PHP
Vibrant Technologies & Computers
 

What's hot (20)

INTRODUCTION TO JAVA
INTRODUCTION TO JAVAINTRODUCTION TO JAVA
INTRODUCTION TO JAVA
 
Pythonclass
PythonclassPythonclass
Pythonclass
 
Class and object in c++
Class and object in c++Class and object in c++
Class and object in c++
 
Oops in java
Oops in javaOops in java
Oops in java
 
Introduction to OOP with java
Introduction to OOP with javaIntroduction to OOP with java
Introduction to OOP with java
 
Java serialization
Java serializationJava serialization
Java serialization
 
09 Object Oriented Programming in PHP #burningkeyboards
09 Object Oriented Programming in PHP #burningkeyboards09 Object Oriented Programming in PHP #burningkeyboards
09 Object Oriented Programming in PHP #burningkeyboards
 
object oriented programming using c++
 object oriented programming using c++ object oriented programming using c++
object oriented programming using c++
 
Object oriented programming in php
Object oriented programming in phpObject oriented programming in php
Object oriented programming in php
 
PHP - Introduction to Object Oriented Programming with PHP
PHP -  Introduction to  Object Oriented Programming with PHPPHP -  Introduction to  Object Oriented Programming with PHP
PHP - Introduction to Object Oriented Programming with PHP
 
Introduction to OOP(in java) BY Govind Singh
Introduction to OOP(in java)  BY Govind SinghIntroduction to OOP(in java)  BY Govind Singh
Introduction to OOP(in java) BY Govind Singh
 
Java class,object,method introduction
Java class,object,method introductionJava class,object,method introduction
Java class,object,method introduction
 
Java tutorial for beginners-tibacademy.in
Java tutorial for beginners-tibacademy.inJava tutorial for beginners-tibacademy.in
Java tutorial for beginners-tibacademy.in
 
Packages namespace instance
Packages namespace instancePackages namespace instance
Packages namespace instance
 
Chapter3 bag2
Chapter3 bag2Chapter3 bag2
Chapter3 bag2
 
2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++
 
Introduction to php oop
Introduction to php oopIntroduction to php oop
Introduction to php oop
 
Oops Concept Java
Oops Concept JavaOops Concept Java
Oops Concept Java
 
Dr. Rajeshree Khande : Java Inheritance
Dr. Rajeshree Khande : Java InheritanceDr. Rajeshree Khande : Java Inheritance
Dr. Rajeshree Khande : Java Inheritance
 
PHP- Introduction to Object Oriented PHP
PHP-  Introduction to Object Oriented PHPPHP-  Introduction to Object Oriented PHP
PHP- Introduction to Object Oriented PHP
 

Similar to Object-oriented in ruby

JAVA PPT -2 BY ADI.pdf
JAVA PPT -2 BY ADI.pdfJAVA PPT -2 BY ADI.pdf
JAVA PPT -2 BY ADI.pdf
Prof. Dr. K. Adisesha
 
Lecture 5.pptx
Lecture 5.pptxLecture 5.pptx
Lecture 5.pptx
AshutoshTrivedi30
 
SystemVerilog_Classes.pdf
SystemVerilog_Classes.pdfSystemVerilog_Classes.pdf
SystemVerilog_Classes.pdf
ssusere9cd04
 
OOPS Characteristics
OOPS CharacteristicsOOPS Characteristics
Object oriented programming
Object oriented programmingObject oriented programming
java part 1 computer science.pptx
java part 1 computer science.pptxjava part 1 computer science.pptx
java part 1 computer science.pptx
MUHAMMED MASHAHIL PUKKUNNUMMAL
 
Object oriented programming in java
Object oriented programming in javaObject oriented programming in java
Object oriented programming in java
Elizabeth alexander
 
UNIT - IIInew.pptx
UNIT - IIInew.pptxUNIT - IIInew.pptx
UNIT - IIInew.pptx
akila m
 
object oriented programming(PYTHON)
object oriented programming(PYTHON)object oriented programming(PYTHON)
object oriented programming(PYTHON)
Jyoti shukla
 
U2 JAVA.pptx
U2 JAVA.pptxU2 JAVA.pptx
U2 JAVA.pptx
madan r
 
Problem solving with python programming OOP's Concept
Problem solving with python programming OOP's ConceptProblem solving with python programming OOP's Concept
Problem solving with python programming OOP's Concept
rohitsharma24121
 
Lecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptxLecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptx
ShaownRoy1
 
Java defining classes
Java defining classes Java defining classes
Java defining classes
Mehdi Ali Soltani
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
Vasilios Kuznos
 
Java chapter 5
Java chapter 5Java chapter 5
Java chapter 5
Abdii Rashid
 
JAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptxJAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptx
KunalYadav65140
 
JAVA-PPT'S.pptx
JAVA-PPT'S.pptxJAVA-PPT'S.pptx
JAVA-PPT'S.pptx
RaazIndia
 
Oop in php lecture 2
Oop in  php lecture 2Oop in  php lecture 2
Oop in php lecture 2
Mudasir Syed
 
JAVA PPT -3 BY ADI.pdf
JAVA PPT -3 BY ADI.pdfJAVA PPT -3 BY ADI.pdf
JAVA PPT -3 BY ADI.pdf
Prof. Dr. K. Adisesha
 
(An Extended) Beginners Guide to Object Orientation in PHP
(An Extended) Beginners Guide to Object Orientation in PHP(An Extended) Beginners Guide to Object Orientation in PHP
(An Extended) Beginners Guide to Object Orientation in PHP
Rick Ogden
 

Similar to Object-oriented in ruby (20)

JAVA PPT -2 BY ADI.pdf
JAVA PPT -2 BY ADI.pdfJAVA PPT -2 BY ADI.pdf
JAVA PPT -2 BY ADI.pdf
 
Lecture 5.pptx
Lecture 5.pptxLecture 5.pptx
Lecture 5.pptx
 
SystemVerilog_Classes.pdf
SystemVerilog_Classes.pdfSystemVerilog_Classes.pdf
SystemVerilog_Classes.pdf
 
OOPS Characteristics
OOPS CharacteristicsOOPS Characteristics
OOPS Characteristics
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
java part 1 computer science.pptx
java part 1 computer science.pptxjava part 1 computer science.pptx
java part 1 computer science.pptx
 
Object oriented programming in java
Object oriented programming in javaObject oriented programming in java
Object oriented programming in java
 
UNIT - IIInew.pptx
UNIT - IIInew.pptxUNIT - IIInew.pptx
UNIT - IIInew.pptx
 
object oriented programming(PYTHON)
object oriented programming(PYTHON)object oriented programming(PYTHON)
object oriented programming(PYTHON)
 
U2 JAVA.pptx
U2 JAVA.pptxU2 JAVA.pptx
U2 JAVA.pptx
 
Problem solving with python programming OOP's Concept
Problem solving with python programming OOP's ConceptProblem solving with python programming OOP's Concept
Problem solving with python programming OOP's Concept
 
Lecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptxLecture-10_PHP-OOP.pptx
Lecture-10_PHP-OOP.pptx
 
Java defining classes
Java defining classes Java defining classes
Java defining classes
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Java chapter 5
Java chapter 5Java chapter 5
Java chapter 5
 
JAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptxJAVA-PPT'S-complete-chrome.pptx
JAVA-PPT'S-complete-chrome.pptx
 
JAVA-PPT'S.pptx
JAVA-PPT'S.pptxJAVA-PPT'S.pptx
JAVA-PPT'S.pptx
 
Oop in php lecture 2
Oop in  php lecture 2Oop in  php lecture 2
Oop in php lecture 2
 
JAVA PPT -3 BY ADI.pdf
JAVA PPT -3 BY ADI.pdfJAVA PPT -3 BY ADI.pdf
JAVA PPT -3 BY ADI.pdf
 
(An Extended) Beginners Guide to Object Orientation in PHP
(An Extended) Beginners Guide to Object Orientation in PHP(An Extended) Beginners Guide to Object Orientation in PHP
(An Extended) Beginners Guide to Object Orientation in PHP
 

Recently uploaded

Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
Zilliz
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
David Brossard
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
Quotidiano Piemontese
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
tolgahangng
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
akankshawande
 

Recently uploaded (20)

Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
Building Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and MilvusBuilding Production Ready Search Pipelines with Spark and Milvus
Building Production Ready Search Pipelines with Spark and Milvus
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
OpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - AuthorizationOpenID AuthZEN Interop Read Out - Authorization
OpenID AuthZEN Interop Read Out - Authorization
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
National Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practicesNational Security Agency - NSA mobile device best practices
National Security Agency - NSA mobile device best practices
 
Serial Arm Control in Real Time Presentation
Serial Arm Control in Real Time PresentationSerial Arm Control in Real Time Presentation
Serial Arm Control in Real Time Presentation
 
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development ProvidersYour One-Stop Shop for Python Success: Top 10 US Python Development Providers
Your One-Stop Shop for Python Success: Top 10 US Python Development Providers
 

Object-oriented in ruby

  • 2. Overview ❖ Introduction ❖ Class ❖ Object ❖ Inheritance ❖ Super method
  • 3. OOP in Ruby ❖ Uses Object and their interactions to design application and computer programs ❖ Basic Concepts ➢ Abstraction ➢ Polymorphism ➢ Encapsulation ➢ Inheritance
  • 4. Basic Concepts ❖ Abstraction ➢ simplifying complex reality by modeling class appropriate to the problem. ❖ Polymorphism ➢ process of using a operator or function in different ways for different data input.
  • 5. Basic Concepts ● Encapsulation o hides the implementation of a class from other object ● Inheritance o a way to form new classes using classes that have already been define
  • 6. Class ❖ is used to specify the form of an object ❖ combines data representation and methods for manipulating that data into one packet ❖ data and methods in class are members of class
  • 7. Object ❖ are basic building blocks of OOP program ❖ combination of data and methods ❖ communicate together throught methods ❖ can receive, send message, process data
  • 8. Object ❖ Two steps in creating object ➢ define a class ➢ run a instance of that particular class
  • 9. The constructor ❖ special kind of method ❖ automatically called when object is created ❖ initiate the state of an object ❖ called is `initialize`
  • 10. The Constructor ❖ object’s attributes - instance variables or member fields ➢ data items into that object ❖ `allocate` method ➢ create object without constructor
  • 11. Constructor Overloading ❖ has no constructor overloading ➢ object is created with default parameter values
  • 12. Methods ❖ are functions defined inside the body of class ❖ used to perform operations with object’s attributes
  • 13. Methods ❖ instance methods ➢ the method that the object contains ❖ class methods ➢ the method that created by self class ➢ define: “self.method_name”
  • 14. Accessor & Setter methods ❖ to make variables available from outsite class ❖ define variables (set values)
  • 15. Inheritance ❖ newly formed classed are called derived classes ❖ the classes that we derive from are called base classes ❖ the devired classes override or extend the functionality of base classes
  • 16. Inheritance ❖ use `<` operator to create inheritance relations ❖ `super` method to call parent function ❖ `ancestors` method to show lists of ancestors
  • 17. The super method ❖ call a method of the same name in the parent’s class ❖ super ➢ passed all arguments to parent’s classes ❖ super() ➢ no arguments passed to perent’s classes
  • 18. References ❖ Object oriented Ruby ➢ http://www.tutorialspoint.com/ruby/ruby_object_oriented.htm ❖ Object-oriented programming in Ruby ➢ http://zetcode.com/lang/rubytutorial/oop/

Editor's Notes

  1. oop là một mô hình lập trình sử dụng object và các tương tác đẻ design app và chương trình máy tính khác Các khái niệm cơ bản: (Basic concepts):
  2. sự trừu tượng được thể hiện: mỗi đối tượng có thể hoàn thành cong việc của mình, báo cáo thay đổi trạng thái hay liên lạc với các đối tượng khác mà không cần biết làm thế nào đẻ các đối tượng đó thực thi được thao tác (nó chỉ quan tâm đến cốt lõi bên trong mà không cần để ý đến thực tế.). Hay nó còn được thể hiện thông qua việc, ban đầu có 1 đối tượng gồm các thuộc tính chung chung, cho nhiều đối tượng khác như là một thuộc tính mở rộng của nó, nhưng mà bản thân đối tượng này có thể không có biện pháp thi hành. Tính đa hình thể hiện bởi các thuật toán, chức năng khác nhau đối với các input khác nhau cho mỗi đối tượng, ví dụ hình tròn, hình vuông gọi tính chu vi nhưng đối với mỗi đối tượng có các cách tính khác nhau or động vật có tiếng kêu khác nhau.
  3. Tính đóng gói, các đối tượng khác không thể thay đổi trạng thái nội tại của nó, mà chỉ có phương thức nội tại của nó mới có thể làm được điều đó. Tính kế thừa, cho phép mở rộng, kế thừa thông tin của một lớp cha có sẵn mà kô cần định nghĩa lại.
  4. object attributes là những thuộc tính đóng gói trong đối tượng đó, hay còn được gọi là instance variables, hay member fields
  5. ancestors: tổ tiên, nguồn gốc.