Giter Site home page Giter Site logo

itp-w3-oop-bookstore's Introduction

OOP Bookstore

Today, we're in charge of migrating our Bookstore project into an Object Oriented approach. The functionality will remain similar, but we'll use OOP to model our system.

For this project we have identified 3 key classes: Bookstore, Author and Book.

A Bookstore will be the starting point. You'll be able to add books and search from books in a bookstore object. In the following example, we'll create a bookstore and assign a book to it:

store = Bookstore("Rmotr's bookstore")
# No books yet
store.get_books() == []

# We create an author and book
borges = Author("Jorge Luis Borges", "Argentina")
ficciones = Book("Ficciones", author=borges)

# We add the book to the bookstore
store.add_book(ficciones)

store.get_books() == [<Object Book('ficciones')>]

The bookstore also has a "search" functionality. It works a little bit different than the previous one. In this case, you can search by book title or book author, or both title and author. The search method is the same one search_books, but you'll have to make it dynamic enough to support the three scenarios. Example:

# Searching *just* by title:
store.search_books(title='raven')

# Searching *just* by author:
poe = Author('Edgar Allan Poe', 'US')
store.search_books(author=poe)

# Searching by both title *and* author:
poe = Author('Edgar Allan Poe', 'US')
store.search_books(title='raven', author=poe)

Finally, the Book and Author classes have special relationships between them, and we want you to pay special attention to it.

itp-w3-oop-bookstore's People

Contributors

fabricalado avatar ivanzugnoni avatar martinzugnoni avatar santiagobasulto avatar

Watchers

 avatar  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.