Skip to content

tuan3572000/execirse-carparkinglot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

execirse-carparkinglot

An execirse for finding nearest available car park locations

Coding approach

There are 2 approaches

- Query/Write in same database
    Pros 
        Easy to implement
    Cons
        Limitted in number of databases that support geospatial query
        Bottleneck in DB when high volume of query

- CQRS pattern, Write in DB and Query in other place
    Pros
        Optimize for query
        Flexible in choosing database
    Cons
        More efforts to implement

Decision:

Follow the Clean Architecture guideline

Apply CQRS pattern

  • Postgresql for Command
  • Redis for Query

All data will be stored in Postgresql, whenever a task to get car parks availability is done, populate data to Redis for querying

  • Pros

    • High throughput
    • Redis could be leveraged to cache other data
  • Cons

    • Resource for Redis server
    • Data in cache have to be populated periodically

Local setup

Java 17 , Maven 3.9.2

How to run

1. Clean and package project (make sure carparking-0.0.1-SNAPSHOT.jar exists in target folder)
2. Navigate to docker folder
3. Run command 'docker-compose up --build'

APIs

Testing

Conducted manual test by myself

Does not have enough time to write unit test (spend too much time on design and clean code)

About

An execirse for finding a nearest car parking location

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published