Giter VIP home page Giter VIP logo

golang-clean-code-exercise's Introduction

Introduction

This repo is used to practice creating clean code using golang. Created as hands on for my presentation at COMPFEST 2021.

Requirement

  • docker > 20.10.7

How to Run

# to run app
docker-compose run app

# to run test
docker-compose run test

How to Use

Clone or fork this repo. Then you can try to refactor on your own. Easy to follow walkthough is available. And the solution is there too if you want to cheat ;) Follow git version to walk through refactoring process and eliminate code smell. Happy refactoring ;)

Walkthrough

In general, this walkthough is implemented using TDD fashion. Your job is only 2: make test pass and make sure the app is running fine. There are several branch for each code smell. You should implement in in correct order.

  1. Code smell: duplicate code.
    Checkout using git checkout code-smell/duplicate-code. You will find TODO. Your job is to implement those TODO.
  2. (optional) Solution is at git checkout code-smell-refactored/duplicate-code.
  3. Code smell: long method.
    Checkout using git checkout code-smell/long-method. You will find TODO. Your job is to implement those TODO.
  4. (optional) Solution is at git checkout code-smell-refactored/long-method.

golang-clean-code-exercise's People

Contributors

hezbymuhammad 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.