Tuesday, July 21, 2015

thought-works: Object oriented design for a library to store books, movie dvds



thought-works: Object oriented design for a library to store books, movie dvds

Question: Design a library shelf which can store books or digital media also like CD/DVD. The design should be accommodate features so that  responding to user queries would be easy and the library has the ability to store new content types in a easy way.

Lets attempt to describe the library we want to design. Our library can store books, movie dvds to start with. Books and DVDs are different content types. Each content type can have different genres. For e.g in books we have fiction, romance, non fiction etc. Similarly in DVDS we have action, drama, documentary etc. Lets assume for simplicity that the books and DVDs the library gets are already tagged with that genre information.

Now i can visualize the library as one that contains different sections(one for content type). Each section has different genres, and each genre has a stand where the items(books, dvds) are stored.

Typical user queries would be 
 * search books by author xxx
 * search books with title containing certain words 
 * search movies with title containing certain words
 * search movies directed by yyy

User searches for the contents by specifying details about what is it he is looking for. Like which genre, which content type, author details, or any keywords to search in title etc. All these details are specified via SearchFilter. Based on the above description, below is the design for the library




This design extends itself to be able to support new content types, new genre types easily
Given that we have been asked to design a library to just store the items above design should work.
(If you want to add the feature of renting the items, we should store information about how many items we have, available/lent status for each item etc. The design for library where users can borrow books is discussed in Object oriented design for a library to borrow and renew books)

Read full article from thought-works: Object oriented design for a library to store books, movie dvds

Labels

Review (572) System Design (334) System Design - Review (198) Java (189) Coding (75) Interview-System Design (65) Interview (63) Book Notes (59) Coding - Review (59) to-do (45) Linux (43) Knowledge (39) Interview-Java (35) Knowledge - Review (32) Database (31) Design Patterns (31) Big Data (29) Product Architecture (28) MultiThread (27) Soft Skills (27) Concurrency (26) Cracking Code Interview (26) Miscs (25) Distributed (24) OOD Design (24) Google (23) Career (22) Interview - Review (21) Java - Code (21) Operating System (21) Interview Q&A (20) System Design - Practice (20) Tips (19) Algorithm (17) Company - Facebook (17) Security (17) How to Ace Interview (16) Brain Teaser (14) Linux - Shell (14) Redis (14) Testing (14) Tools (14) Code Quality (13) Search (13) Spark (13) Spring (13) Company - LinkedIn (12) How to (12) Interview-Database (12) Interview-Operating System (12) Solr (12) Architecture Principles (11) Resource (10) Amazon (9) Cache (9) Git (9) Interview - MultiThread (9) Scalability (9) Trouble Shooting (9) Web Dev (9) Architecture Model (8) Better Programmer (8) Cassandra (8) Company - Uber (8) Java67 (8) Math (8) OO Design principles (8) SOLID (8) Design (7) Interview Corner (7) JVM (7) Java Basics (7) Kafka (7) Mac (7) Machine Learning (7) NoSQL (7) C++ (6) Chrome (6) File System (6) Highscalability (6) How to Better (6) Network (6) Restful (6) CareerCup (5) Code Review (5) Hash (5) How to Interview (5) JDK Source Code (5) JavaScript (5) Leetcode (5) Must Known (5) Python (5)

Popular Posts