Skip to content

Stephanie-Yi/clean-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

clean-code

Welcome to the Clean Code Demo Repository! This project is designed to illustrate examples of "bad code" and encourage contributors to refactor and beautify the code following clean code principles.

Table of Contents

Introduction

Clean code is a reader-focused development style that produces software that's easy to write, read, and maintain. This repository contains a few examples of bad code that demonstrate common pitfalls and practices we should avoid.

The goal of this repository is to provide a hands-on experience in transforming "bad code" into clean, readable, and maintainable code.

Contributing

We welcome contributions from everyone! If you'd like to get involved, here's how you can help:

  1. Fork this repository to your own GitHub account.
  2. Clone your fork to your local machine.
  3. Find an example that interests you and refactor the code following clean code principles.
  4. Add comments to explain your changes and why they improve the code.
  5. Commit your changes and push them to your forked repository.
  6. Submit a pull request to this repository with a clear description of what you have improved.

Clean Code Principles

Some key principles to keep in mind while refactoring:

  • Meaningful Names: Variables, functions, classes, and other entities should have meaningful names that describe their purpose.
  • Single Responsibility Principle (SRP): Each function or class should have one responsibility or reason to change.
  • DRY (Don't Repeat Yourself): Avoid duplicating code by abstracting common functionality.
  • Readability: Write code that is easy to read and understand, even for someone who did not write it.
  • Comment Judiciously: Use comments to explain "why" rather than "what". The code itself should reveal the "what".

For more principles, you can refer to Robert C. Martin's book "Clean Code: A Handbook of Agile Software Craftsmanship".

License

This project is licensed under the MIT License - see the LICENSE file for details.


Happy coding and refactoring! Let's make code cleaner and more maintainable together.

About

Clean code exercise

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages