Giter VIP home page Giter VIP logo

phase-3-ruby-oo-basics-putting-the-pieces-together-lab's Introduction

Putting It All Together: Object Orientation Basics

Learning Goals

  • Create basic classes using Ruby

Introduction

Object-oriented programming, or OOP, is an extremely useful programming paradigm in which we can organize our code according to how real-world objects might interact with one another. We can wrap properties/data and behavior up in classes, and then create instances, or individual "members", of those classes that can interact with one another.

One common misconception about OOP is that everything MUST model the real world. If we limit our objects to things in the real world, the limitations will start jumping out at us.

Imagine a phone call between 2 people. Sure, the PEOPLE are real, but what about the phone call? If we think about the phone call through OOP, we can model it too! A phone call has a caller and a receiver, a duration, and maybe even a cost_per_minute. In the real world, it's not a real thing, but in OOP IT IS!

In this lab, you will put together everything you've learned so far about Object Orientation in Ruby. You will be building out two classes, a Book class and a Shoe class.

Instructions

This lab is test-driven. You will write your code in lib/book.rb and lib/shoe.rb. Run the tests and work your way through the test errors one by one until you get everything passing.

You're also encouraged to look at the spec files to see what the tests are expecting to be able to do with your models. Use this information to decide when to use the attr_accessor, attr_reader and attr_writer macros in your class definitions.

Note that there are separate spec files for the two classes inside the spec folder. If you'd like to run the tests separately for the two classes, you can specify which spec file to run:

$ learn spec/01_book_spec.rb

or:

$ learn spec/02_shoe_spec.rb

Happy coding!

phase-3-ruby-oo-basics-putting-the-pieces-together-lab's People

Contributors

ahimmelstoss avatar annjohn avatar deniznida avatar dfenjves avatar fislabstest avatar fs-lms-test-bot avatar ga-be avatar ihollander avatar jeffkatzy avatar jmburges avatar jonbf avatar joshuabamboo avatar juliataitz avatar kaylee42 avatar kthffmn avatar lizbur10 avatar loganhasson avatar maxwellbenton avatar octosteve avatar osmentd avatar pletcher avatar sarogers avatar shanisebarona avatar sophiedebenedetto avatar thegands avatar timothylevi avatar victhevenot avatar vinnyalfieri avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.