Giter Site home page Giter Site logo

simpleestore's Introduction

EStore


Author: Sidharth Mishra

Version: 0.0.1


Note: All objects made explicitly by me are Value objects. These include Customer, ShoppingCart, Item, CartState, EStore and EStoreDriver.

Note: This project too follows similar restrictions as FJava but not that strictly. The variables are not active.

Briefing:

In this example, EStore is an e-store maintaining a large collection of shopping carts.

Each shopping cart has a customer, contains items and has a status: BOOKED, PURCHASED, SHIPPED.

The items can be added and removed to/from the shopping cart.

The EStore maintains a hash-map indexed by the shopping carts. Each cart is associated with its state.

Each time the state of the cart changes (items are added/removed, status changes) the old binding is deleted and a new binding is created that associates the same cart to the new state.

Class Summary:

The project has the following classes:

  • Customer: This is the customer. It is a value object.

  • Item: This is an item. It is a value object.

  • CartStatus: This is all the possible statuses of the shopping cart. It is an enum with values BOOKED, PURCHASED, SHIPPED

  • ShoppingCart: This is the shopping cart. It has a cartId and customer. It is a value object. Used as the key in the hash map called shoppingCarts in EStore.java. The hashmap is a mapping between the shopping cart and its state.

  • CartState: This represents the cart's state. The state of a cart is defined as the list of items it holds and it's status. This is a value object.

  • EStore: This represents the e-store. It has the hashmap holding the mapping from the ShoppingCart to the CartState. It also exposes the makeCart, addItem, removeItem and changeStatus functionalities.

  • EStoreDriver: This is the main driver code. It is the running example of this concept.

Tools:

  • Java -- JDK v1.8.0_131
  • Eclipse Neon.3 v4.6.3

simpleestore's People

Contributors

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