Object Oriented Programming

  • web applications
  • ios apps
  • android apps
  • A Browser
  • A table w/ list of product names, price and availability.
  • Products that can be part of a store.
  • Product Reviews that have Title of Review and Body of Review.
  • Option to submit the review.
  • Customers associated with the reviews
  • The reviews themselves

“Thing”

An object created from a class like a “copy or blueprint” lets you interact with

  • Take this copy and create an object of an individual student & then work with that students attributes.
  • First name
  • Last name
  • Email
  • Username
  • Password
class Student
attributes: First_name. Last_name, Email, Username, Password

How to create a class in Ruby?

I currently use VSCode to do my coding. So, you would want to create the project folder. You would want to create a file like: product.rb, book.rb, student.rb, or whatever you want to call it .rb.

class Productend
class Product (copy or blueprint)
product_name
product_description
product_size
end
#you want to work with an "Instance of that class" so you use the @ symbol.It then looks like this:class Product
@product_name
@product_size
@product_description
end

How do you create an Object of this class?

you can use .new

# Say I want to create a new product called Brightening cleanser.class Product
@product_name
@product_size
@product_description
end
brightening_cleanser = Product.new

Puts

Now you can print out the product.

class Product
@product_name
@product_size
@product_description
end
brightening cleanser = Product.new
puts brightening cleanser
#<Product:0x0003738eth466sj8> (something similar to this)

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store