Ruby Objects and Classes Course (How To)
Offered By: Treehouse
Course Description
Overview
Ruby is known as an "Object Oriented" programming language. But what does object oriented mean? In this course, we'll cover the basics of Ruby Classes. We'll learn what classes are, how they are used, and how to write our own.
What you'll learn
- Ruby Objects
- Ruby Classes
- Scope
- Methods
Syllabus
Ruby Objects and Classes
Objects and Classes are the blueprints and building blocks of the Ruby language. In this stage, we'll learn what classes are, where objects come from, and write our own class.
Chevron 8 steps-
Ruby Classes
1:27
-
Ruby Classes
3 questions
-
Instantiation
3:49
-
Instantiation
2 objectives
-
Ruby Objects
3:42
-
Asking Objects Questions
1 objective
-
Creating a Class
3:56
-
Creating and Instantiating a Class
3 objectives
Variables and Methods
Classes and objects become much more useful when we keep our program's logic in them. In this stage, we'll learn how to use variables in our classes and where variables can and can't be used. We'll also learn to write methods in our classes, which make them more robust.
Chevron 12 steps-
Variables
4:48
-
Variables and Methods
4 objectives
-
Attribute Readers
1:46
-
Attribute Readers
1 objective
-
Attribute Writers and Accessors
5:20
-
Attribute Writers and Accessors
2 objectives
-
Methods
3:31
-
Methods
1 objective
-
Instance Variables and Local Variables
4:54
-
Instance Variables and Local Variables
4 questions
-
The to_s method
2:16
-
The to_s Method
1 objective
Build a Bank Account Class
Using our knowledge of writing classes, we're going to create a simple bank account class. The class will keep track of whom it belongs to as well as the account's transactions and its ongoing balance.
Chevron 8 steps-
Part 1: Create the Class
4:01
-
Create a BankAccount Class
3 objectives
-
Part 2: Transactions, credits, and debits
5:06
-
Adding Transactions
2 objectives
-
Part 3: Keeping Our Balance
4:20
-
Implement the balance Method
1 objective
-
Part 4: Printing the register
6:26
-
Printing The BankAccount
1 objective
-
Extra Credit
Try using the inject method to calculate the bank account balance.
Related Courses
Introduction à la programmation orientée objet (en Java)École Polytechnique Fédérale de Lausanne via Coursera C++ For C Programmers, Part A
University of California, Santa Cruz via Coursera Introduction to Programming for Musicians and Digital Artists
California Institute of the Arts via Coursera Beginning Game Programming with C#
University of Colorado System via Coursera Paradigms of Computer Programming
Université catholique de Louvain via edX