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.
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.
We welcome contributions from everyone! If you'd like to get involved, here's how you can help:
- Fork this repository to your own GitHub account.
- Clone your fork to your local machine.
- Find an example that interests you and refactor the code following clean code principles.
- Add comments to explain your changes and why they improve the code.
- Commit your changes and push them to your forked repository.
- Submit a pull request to this repository with a clear description of what you have improved.
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".
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.