Giter VIP home page Giter VIP logo

billing's Introduction

Coding Exercise

High Level Description

Code Organization

The code has been organized in one module with three main packages:

  • Business:

    Contains the business logic for building orders and receipts. It has no knowledge of the Data package.

  • Data:

    Contains the Data Storage mechanism.

  • Entities

    Contains the entities (POJOs). Entities are known both in the upper Business layer and in the lower Data layer.

Design Principles

####Composition Composition has been widely used in the exercise.

In order to follow the Single Responsability Principle, and as a way of a very simple Dependency Injection mechanism, a design with constructors receiving the dependencies has been chosen.

####Interfaces The Design Principle of Code Against Interfaces And Not Implementations has not been fully followed to preserve simplicity when only one implementor was planned, and when classes are not used for decoupling or inversion of control purposes.

For instance, for the DataStorage abstraction, even when only one implementation is provided, I understood that for the test it would be enough with a HashMap as storage, but in a real life implementation, only a new implementor of Data Storage would be provided being for example DataBaseStorage.

####TDD The code has been created with TDD approach testing all business logic. The coverage is 100% except for the boilerplate code in POJOs such as hashcode, equals or toString methods

How to Run

An application as such (java executable) is not being provided, instead, the execution could be done using the Unit Tests.

To compile and test use maven as in mvn clean install. This should execute the tests and show the output in the console.

If preferred, from the IDE execute the test ReceiptGeneratorTest.testReceiptCreation to see the expected output.

Note: A WIP investigation branch with an application reading the configuration from a JSON file is in the repo, but not yet a real implementation with TDD, just a POC.

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.