Amazon OOD [Design Unix File Search API]
60825
May 02, 2020
Aug 05, 2022

Hello Leetcode community.
I plan to collect Amazon OOD questions in one post and provide them solutions.
In particular, i have seen that currently "Design Unix File Search API" question is very popular problem in Amazon interviews, hence it is the first problem in this post.

Problem statement:
Design Unix File Search API to search file with different arguments as "extension", "name", "size" ...
The design should be maintainable to add new contraints.

Which pattern you should use?
Answer: Specification pattern, create for each criteria a specification class

Follow up: How would you handle if some contraints should support AND, OR conditionals.
I did not provided it yet. Even though below solution took 30 minutes. Solution: use Specification pattern.

I skipped some Getters/Setters to keep code simple, because you can do it yourself.
Solution is simple, it is better do not overengineer. Better for you and interviewer to understand.
Please add any suggestions/improvements and i will apply and update my post.
This is my first design post and please be reasonable in your comments.

Solution:

List of others OODs collected by @goCoronaGo

  • Library Management System
  • Parking Lot
  • Amazon (Online Shopping System)
  • Stack Overflow
  • Movie Ticket Booking System (BookMyShow)
  • ATM
  • Airline Management System
  • Blackjack and a Deck of Cards
  • Hotel Management System
  • Restaurant Management System
  • Chess
  • Online Stock Brokerage System
  • Linkedin
  • Crickinfo (Sports Website)
  • Facebook (Social Network)
  • Cab Booking (Uber)
  • Chatting
  • Calendar
  • Blog Site
  • Food Delivery

Another list from @242jainabhi:

  • Vending Machine
  • Traffic Lights
  • Elevator
  • Meeting Scheduler
  • Car Rental
Comments (57)