Skip to content

ClaudioNazareth/address-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Address Parser

Click the badges below to see build and coverage information

Build Status codecov

javaversion springboot server swagger googleformater

Scenario for this application:

An address provider returns addresses only with concatenated street names and numbers. Our own system on the other hand has separate fields for street name and street number.

Input: string of address Output: string of street and string of street-number

  1. Write a simple program that does the task for the most simple cases, e.g.
  • a. “Winterallee 3” --> {“ Winterallee”, “3”}
  • b. “Musterstrasse 45” --> { “Musterstrasse”, “45”}
  • c. “Blaufeldweg 123B” --> {“Blaufeldweg”, “123B”}
  1. Consider more complicated cases
  • a. “Am Bächle 23” --> {“Am Bächle”, “23”}
  • b. “Auf der Vogelwiese 23 b” --> {“Auf der Vogelwiese”, “23 b”}
  1. BONUS: Consider other countries (complex cases)
  • a. “4, rue de la revolution” --> {“rue de la revolution” ,"4”}
  • b. “200 Broadway Av” --> “Broadway Av",“200”}
  • c. “Calle Aduana, 29” --> {“Calle Aduana”, “29”}
  • d. “Calle 39 No 1540” --> {“Calle 39”, “No 1540”}

If you have any doubts about the project, please feel free to contact me at chtnazareth@gmail.com

I implemented all the scenarios requested in the test,

The Use Case(Class) that do the job is ParseAddress method execute

Instructions

To compile and run this project you will need:

  • Java 8 (JDK8)
  • Maven 3.0.5 or grater

To start the application use the command bellow

mvn spring-boot:run

The base path for the endpoins is: /v1 -For this application we have: /v1/address-parser/parse

Application port :8080

To run all unit and integration tests use the command bellow

mvn test

You can also test the application at : https://nazareth-address-parser.herokuapp.com/swagger-ui.html

Formatter

The code was formatted using Google Format

APIs - Swagger

To document the APIs I used Swagger.

Swagger is the world’s largest framework of API developer tools for the OpenAPI Specification(OAS), enabling development across the entire API lifecycle, from design and documentation, to test and deployment.

Here you can read more about Swagger

To see and test the APIs go to path /swagger-ui.html (ex: http://localhost:8080/swagger-ui.html)

Clean Architecture and Clean Code

Clean Code

Clean Code is a development style that focuses on the ease of writing, reading and maintaining code.

Robert C. Martin, in his book, "Clean Code: A Handbook of Agile Software Craftsmanship," states that the reading to writing ratio of the code is 10: 1. Therefore, a well-written code that facilitates reading is not only desirable, but necessary in the current scenario.

For this project I've used some clean code principles like :

  • Names are very important :

    • Be precise: we must pass the central idea of ​​our variable or method, without turning, being concise and direct.
    • Do not be afraid of big names: a very descriptive name, even if it is large, will enable a better understanding and subsequent maintenance of the code.
  • Comments only the necessary

    • Comment what is needed and only what is necessary. Codes are constantly modified, while comments rarely. Thus, it is common for a comment to cease to have meaning, or worse, to pass on a false meaning after some time.

Clean Architecture

For this application I choose to use Clean Architecture

The Clean Architecture leverages well-known and not so well-known concepts, rules, and patterns, explaining how to fit them together, to propose a standardised way of building applications.

The core objectives behind Clean Architecture are the same as for Ports & Adapters (Hexagonal) and Onion Architectures:

  • Independence of tools;
  • Independence of delivery mechanisms;
  • Testability in isolation.

In the post about Clean Architecture was published, this was the diagram used to explain the global idea:

cleanarchitecture

The best of clean architecture is its use an software design technique to understand and solve complexity is Domain Driven Design (DDD). Domain Driven Design advocates modeling based on the reality of business as relevant to our use cases.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages