βAny fool can write code that a computer can understand. Good programmers write code that humans can understand.β
β Martin Fowler
Welcome to my Clean Code Tutorial . With inspiration from Maximillian Schwarzmuller's Udemy Course on Clean Codes, this repo shows badly written code alongside its clean code equivalent. This is a practical, example-driven guide to writing better, more maintainable, and readable code. This repository is designed for developers who want to move beyond just "working code" and start writing professional-grade code that is clean, understandable, and easy to maintain.
- Clean coding practices and naming conventions
- Writing readable functions and modular code
- Refactoring techniques
- Writing self-documenting code
- Real-world before & after code examples
clean-code-tutorial/
βββ py/ # Sample of bad and clean python codes
βββ js/ # Sample of bad and clean javascript codes
βββ cpp/ # Sample of bad and clean C++ codes
βββ c/ # Sample of bad and clean C codes
βββ rust/
βββ matlab/
βββ README.md # This file (apparently)
- Clone the repo:
git clone https://github.com/bakel-bakel/clean-code-tutorial.git
cd clean-code-tutorial
- Explore examples:
cd py/
- PEP 8 for Python formatting
- Clear, descriptive variable and function names
- Functions with single responsibilities
- Minimal comments (code should be self-explanatory)
- No magic numbers β constants used instead
- DRY (Don't Repeat Yourself)
- KISS (Keep It Simple, Stupid)
- Junior developers who want to write professional code
- Students learning software development best practices
- Professionals trying to improve code quality and readability
- Anyone tired of messy legacy codebases
Please, contributions are welcome! If you want to add new examples, improve existing ones, or share clean code tips:
- Fork the repo
- Create a new branch
- Submit a pull request
This project is licensed under the MIT License.
Happy cleaning! β¨