Git Product home page Git Product logo

qualitycode-csvimport-sample's Introduction

qualitycode

Simple scenario written in an anti-pattern is re-written in quality way.

This program exposes a simple REST API to upload a csv file containing user information in the following pattern.

"Chamil", "83, Quality Road, Sri Lanka",36

The program will then validate the file, each record and convert them into User objects. The user objects will be stored in a database.

The code contains many packages named as com.chamil.qualitycode.v0 and com.chamil.qualitycode.v1

V0 Package

The package "v0" contains the traditional code and the v1 and above are steps towards the final quality code.

V1 Package

the package v1 contains a decoupled code with unit tests covering each class separately. The classes are SOLID by the design.

The ImportCommand class can be used to import any other data type into another destination storage as well. The only thing to do is writing the right mapper, validator and the store classes.

Just implement a new DataSource class if you want to change from CSV to excel or any other data type.

Disclaimer

This code is purely a demonstration of clean code. It is not well tested. You are invited to test it for all possible unhappy paths.

qualitycode-csvimport-sample's People

Contributors

kdchamil avatar

Stargazers

Lochana Marasinghe avatar Dhammika Marasinghe avatar

Watchers

James Cloos avatar Dhammika Marasinghe avatar  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.