Giter Club home page Giter Club logo

oo-many-practice-members's Introduction

oo-many-practice-members

(after @aalexander3/oo-many-many-practice)

Here's our domain:

  • Member
  • Institution
  • Membership

How is this modeled?

  • A membership belongs_to a member
  • A membership belongs_to a institution
  • A member has_many memberships
  • An institution has_many memberships
  • A member has_many many institutions through memberships
  • An institution has_many members through memberships

==============================================================

OBJECTIVES

  • Draw this domain on a whiteboard or http://awwapp.com/
  • Build out the three classes and files from scratch (keep in mind the relationships)
  • Think about how the classes will interact -- how does a doctor know about their patients?
  • Use attr_reader, attr_writer, & attr_accessor
  • Create a run file with a single point of entry
  • Maintain single source of truth for all classes

==============================================================

DELIVERABLES

  • INSTITUTION
    • #initialize an institution is initialized with a name and a kind (e.g., gym, salon, etc.)
    • an institution cannot change its name, but can change its kind
    • Institution.all returns all instances of the institution class
    • #memberships returns an array of all the membership instances that belong_to an institution
    • #members return an array of all the members that are associated with an institution
    • #member names return an array of just the names of said members (First and Last), not the full object ====== BONUS ======
    • Institution.find_by_kind takes in a kind (e.g., "gym") as an argument and finds an institution by a given kind
    • #upgrade_membership takes in a membership and a new tier ("free" => "premium") and changes the membership's tier

==============================================================

  • MEMBER
    • #initialize a member is initialized with a first_name and last_name
    • a member cannot change their name
    • Member.all returns all instances of the member class
    • #member_name converts a member's first and last name to member_name (e.g., "John Smith => "jsmith")
    • #memberships returns an array of all the memberships associated with an instance of member
    • #buy_membership creates a new membership instance taking in an institution and a tier (e.g., free", "premium") ====== BONUS ======
    • Member.find_by_name takes in member_name (e.g., "jsmith", not "John Smith") as an argument and finds a member's full name by a member_name
    • #find_institution finds an institution by kind (e.g., "gym", "salon") -- utilizing the Institution.find_by_kind class method

==============================================================

  • MEMBERSHIP
    • #initialize a membership is initialized with a tier ("free", "premium", etc.), a member and an institution
    • an membership has corresponding methods for all three attributes
    • Membership.all returns all instances of the membership class

==============================================================

oo-many-practice-members's People

Contributors

rscheiwe avatar

Watchers

James Cloos avatar Daniel Micher 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.