Code Monkey home page Code Monkey logo

imdb-database-simulator's Introduction

▀████▀████▄     ▄███▀███▀▀▀██▄ ▀███▀▀▀██▄   
  ██   ████    ████   ██    ▀██▄ ██    ██    
  ██   █ ██   ▄█ ██   ██     ▀██ ██    ██    
  ██   █  ██  █▀ ██   ██      ██ ██▀▀▀█▄▄    
  ██   █  ██▄█▀  ██   ██     ▄██ ██    ▀█    
  ██   █  ▀██▀   ██   ██    ▄██▀ ██    ▄█    
▄████▄███▄ ▀▀  ▄████▄████████▀ ▄████████    

IMDB database simulator

by Daniel Ghindea

Dependencies

This program uses JSON.simple toolkit to save database elements in JSON files. To compile code in IntelliJ add JSON.simple dependency as it follows:

File > Project Structure... > Modules > Dependencies > + > JARs or Directories > json-simple-1.1.1.jar (located in project root)

Description

This Java program simulates simple functionalities of IMDb in a CLI environment, using OOP concepts, JSON files and Design Pattern principles.

Upcoming update

GUI environment created with SWING package is on its way.

How it works

  • Tester.java is the class that contains main() method. Run it to launch program.
  • IMDB is the main class of the program. It is a singleton class that contains arrays that store Production, User, Actor objects. It also has 'run()' method that runs the program.
  • Login, Parser and Actions classes implement methods that perform the functionalities of the program
  • UserFactory and ProductionFactory are classes that define how different user and production types are created by following factory pattern principle.
  • Observable is a class used to implement observer pattern for different objects that suffers state changes : Request, Actor, Production

Program flow

  1. Parsing files to memory

    • In order to keep data consistency from one run of the program to another, the database elements are saved in JSON files.
    • At the beggining of every run Parser.parseDatabaseToMemory() method loads saved data into memory, every object type being added to its corresponding array list located in IMDB
  2. Solving discrepancies

    • Since there are chances to have actors with performances or performances with actors that don't have a corresponding IMDb page, system automatically creates empty pages for them and sends edit requests to Staff members for those pages.
    • To implement notifications functionality every Observable object requires a list of observers that is constructed accordingly to their relation with the subject.
  3. Logging in

    • To know which functionalities are available for a user it has to be logged in the platform. After the credentials are given, Login.start() method searches the user base and returns the User instance that matches the credentials.
  4. Running the aplication

    • Depending on the account type of the logged user different commands are available (see below table).
    • A menu with the available commands is displayed and an index is requested to select a command.
    • Most of these functionalities are based on a loop system, meaning that the user will be able to make these actions until 'exit' or 'done' commands are given.
  5. Running actions

    • Actions class contains static methods that implement all the required functionalities and static String members used for CLI display.
  6. Logging out

    • When 'log out' command is given the main loop is breaked and the user has the option to log in again or to close the aplication.
  7. Parsing memory to files

    • To save changes, before the program is finished, all elements of the database are parsed back into the original JSONs with Parser.parseDatabaseToJSONs() method.

Option Regular Contributor Admin
View all productions X X X
View all actors X X X
View all notifications X X X
Find in database X X X
Add page to favorites X X X
Push/Pull a request X X
Create/Delete a page X
View requests X X
Add a rating for production X
Add/Delete user X
Log out X X X

Bibliography

imdb-database-simulator's People

Contributors

ghindea avatar

Watchers

 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.