Insight UBC: Deliverable 2

parse5

let document = parse5.parse(data);
let table = document.childNodes[0].childNodes[1].childNodes[2].......

let roomname = table.childNodes[0].childNodes[1].childNodes[2].......

Image taken from: http://interactivepython.org/runestone/static/pythonds/Trees/ExamplesofTrees.html

Hardcoding like this will cause you problems

Activity: Bookstore

Your client wants you to design a website for its bookstore. The requirements are simple: It must be able to sell a book, and add new books to the library of books available to sell.

  • We are going to design the backend for this website.
  • Assume a book can be represented using its ISBN and its title.
  • sell() takes the ISBN and returns the title of the book sold.

Clone repo here:

https://github.ugrad.cs.ubc.ca/CPSC310-2018W-T1/tutorial_solid

Activity: Bookstore

It turns out users want to know more about the books they buy than just the title. Our client wants us to add functionality to allow users to see the author, and the abstract of the book.

  • Lets add a few more methods to our class.

Activity: Bookstore

Since we have so much information about the books being sold now, our client wants us to implement some kind of search functionality

  • Search all the books we have to see if they match a keyword, return all the ones that do.

Activity: Bookstore

Our client loves the new website we've created for him, so much that he wants to be able to do other things with it now (like inventory management).

  • Want to keep track of the quantity of each book that we have.
  • New method: restock()

Activity: Bookstore

Our clients website has been wildly successful. Now he wants to expand the website to be able to sell clothing as well.

  • How can we accomplish this without rewriting all of our code?
Made with Slides.com