Giter Site home page Giter Site logo

cargrid's Introduction

CarGrid

This is a sample multi-module spring boot application, driven in a TDD methodology. Cars are placed on a grid at particular co-ordinates heading north, and the simple commands Left, right and forward are transmitted to them. The commands is executed and the final position calculated.

1 Overview

This is a test project for the sake of a Java technical interview. This application resembles a very simple multi-moduled spring boot application, and to demonstrate TDD knowledge & skills. Simply the application represents a car grid (with configurable dimensions), upon which the user inputs current position (cartesian coordinates) and a set of navigation commands (R: Right, L: Left, F: Forward). Accordingly the application calculates the target position and returns it to the user.

2 Architecture

  • The application is divided into 3 main layers:
    • Domain -> CarGrid-models-module: contains the main building blocks of the application; Domain objects
    • Service-> CarGrid-service-modules: represents the business layer, with business logic encapsulated into reusable services. This layer is responsible for:
      1. Validating user inputs.
      2. Mapping between DTOs (String) & Domain objects
      3. Calculating the target position after applying navigation
    • Integration/Interface-> CarGrid-rest-api-module : This layer represents a presentation/integration layer, taking the form of a RESTful API to interact with the user and present results. It relies on the service layer for performing the actual navigation logic and corresponding validations. Basically, this is a RESTful interface exposing only a single API (/navigate).

3 Technologies

  • Java 1.8
  • Spring Core
  • Spring REST with Spring Boot
  • Mocking
  • Swagger-ui
  • Jackson
  • Maven

4 How to start

  • To run from command line, I've added a maven wrapper around the project to facilitate builds without the need to install maven:

    1. After cloning/downloading the project, navigate to open a shell terminal and navigate to CarGrid root directory
    2. Depending on your operating system, choose the appropriate "mvnw" script, and execute:
     	mvnw.cmd clean install
    
    1. Execute:
     	mvnw.cmd -pl CarGrid-rest-api-module spring-boot:run 
    
      (this will boot up an embedded tomcat server hosting the API layer)
    
    1. Open a browser, and navigate to: http://localhost:8080 (this will load the generated Swagger API documentation UI, which also provides a test client to use)

    Alternatively, you can import this project in the IDE you wish, and utlize the same maven commands.

cargrid's People

Contributors

amr-fathi 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.