Giter Club home page Giter Club logo

clean-code's Introduction

I created this repository because I feel I'm not a genious coder and rarely have a lightbulb pop over my head after reading pages of dry theory.

Hence, examples is how I learn best. I believe this stands true for many others as well.

This repo is inspired from the books "Refactoring" by Martin Fowler and "Clean Code" by Robert C. Martin.

This is a WIP repo 🦐

Structure πŸ€”

Folder Content
code-smells Contains .md files containing the description of the smell, bad and good examples, reasons for change, etc
refactoring Folders named after refactoring techniques containing numbered example folders with before, after examples and tests. Usage examples of a particular block of code can be best seen in the test files.
clean-code Contains .md files with examples of applying clean code principles on comments, functions, etc
quotes.txt Contains quotes on programming gathered from different resources

Content πŸŽ‰

Here you should be able to find most code smells covered, most refactoring techniques and clean code principles applied in action.

The refactoring techniques have example folders in no particular order. In them you'll have before, after and test files written in Typescript.

Part of the examples are from the books mentioned above while the other part comes from real life code examples.

Contributions ❀️

If you have an example code that you refactored, feel free to contribute to the appropriate refactoring technique used.

Most often there will be more than 1 technique used at the same time, but you need to distinguish the main one and mention others as bonus refactorings. You can also split the refactored code into even smaller parts and contribute to several refactoring techniques at once.

Contribution should follow the same guideline as other examples:

  • Name the folder as the next example number e.g. 2
  • Add before.ts and after.ts files
    • OPTIONAL: Add any additional files you need for the example e.g. types.ts, utils.ts, etc
  • Add a test file with the after example used. This will serve as a usage example and to prove that the refactoring code is functioning as intended
  • Add an entry to the approprate readme e.g. extract-class/readme.md
  • Describe the source of the before and after code, add concrete benefits of this particular code refactoring

Disclaimer πŸ™‰

πŸ•ΊThis is not a definitive guide. Refactoring is always about compromising. Whether you agree with an approach or not depends on a multitude of factors - teams styleguide, how often a particular piece of code is changed, team sizes, roadmaps, etc.

πŸ‘‰Some of the refactoring techniques and examples can be considered as intermediate steps in a bigger refactoring process.

πŸ™Œ With this said, this repo is meant to be as a guide and not a judge.

πŸ“šFor more information on these topics please read the fantastic books mentioned above.

clean-code's People

Contributors

rolandisimo avatar dependabot[bot] avatar

Watchers

James Cloos 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.