
Clean Code
Writing Organized Error-Free Code
What you'll learn
- Understand the idea of clean and bad code
- Set horizontal and vertical spacing in code
- Follow the PEP guidelines
- Get rid of duplicated code
- Avoid magic numbers
- Spot dead code
- Debug with log files
- Write comments and documentation
- Write effective functions
About this course
The Clean Code course explains how to write code that is organized and easy to read and change. It starts by introducing the idea of clean and bad code, then horizontal spacing and vertical spacing, and the PEP guidelines for writing code in Python. After that it covers consecutive numeric suffixes, duplicated code and what it signals and how to get rid of it, magic numbers, the idea of dead code, and debugging with log files. Then it moves to comments and documentation, the twenty guiding principles, and writing effective functions, and it ends with downloading the workbook. The course suits programmers of any level who have written some code and want to improve its quality, and it helps anyone who works on software development in a team. The learner only needs basic knowledge of programming. By the end you will be able to spot bad code and fix it, get rid of repetition and dead code, and write clear functions and comments that make your program easier to maintain. The course also includes a workbook you can practice with and apply to your own code.
Expected outcomes
- Understand how to write clean and professional code.
- Commit to global programming standards and improve code quality.
- Eliminate errors resulting from duplicated or unorganized code.
- Develop software that is efficient and easy to maintain.
- Acquire skills for professional code documentation.
Learner reviews
- ★★★★★مصطفى أ.·منذ 5 شهرشاهد 100٪
استفدت من هذه الدوره من خلال فهم كيفيه كتابه كود واضح ومفهوم ومنظم
- ★★★☆☆Ausama B.·منذ 3 شهرشاهد 85٪
دورة جيدة كل الشكر والتقدير للأستاذ المحاضر
تم عرض كل التقييمات (2)
Course content
1Clean Code
12 lectures
- Understanding Clean and Dirty CodeDefines clean versus bad code and why it matters: programming is a team activity, and working code is not enough, it must be formatted by conventions and guides such as PEP8 so it is easy to understand and review.20:44
- Horizontal SpacingExplains horizontal spacing rules in code: one space between operators and identifiers, no space before commas or inside brackets, and using spaces rather than the Tab key for indentation.25:08
- Vertical SpacingExplains vertical spacing by adding blank lines to split code into related blocks, putting each import on its own line per PEP8, and the Black tool for automatic code formatting.17:43
- PEP8 GuidelinesExplains choosing understandable programming names: naming styles such as camelCase, avoiding short names and cryptic abbreviations, preferring descriptive names, prefixes, with the Mars probe unit mix-up as an example.27:23
- Consecutive Numeric SuffixesContinues on naming identifiers: avoiding sequential numeric suffixes like num1 and num2 in favor of descriptive names, choosing searchable names, avoiding vague names, and not reusing Python reserved names.24:25
- Duplicate Codes: Their Implications and How to Get Rid of ThemExplains the Code Smells concept, why duplicated code signals likely bugs, and how to remove duplication by placing the repeated part in a function, method or loop that is called when needed.16:39
- Magic NumbersExplains magic numbers in code and how they confuse readers, with the fix of using constants with meaningful names instead of raw numbers and strings, for easier reading, editing and fewer typo errors.22:43
- Dead Code ConceptExplains dead code, meaning lines disabled by turning them into comments or code that execution never reaches, why it raises questions and signals bugs, plus the pass statement in Python.13:51
- Debugging with Log FilesExplains debugging with print statements and its drawbacks compared with a debugger that steps through code line by line, stresses meaningful variable names, and recaps the code smells.24:04
- Comments and DocumentationExplains why comments and documentation matter in code and covers their types and good practice, such as multi-line comments, explaining links, not stating variable types, and explanatory and summary comments.22:35
- The Twenty GuidelinesExplains lessons-learned comments through a real programmer's story, tags like to do and fix me for searching code, then starts the clean-code guiding principles such as simplicity, flat structure and blank lines for readability.17:52
- Writing Effective FunctionsContinues the clean-code guiding principles, then covers writing functions: avoiding blind trial-and-error fixes, one clear way to do things, namespaces, long understandable names, and function size and parameter count.19:39
2Extensions
1 attachments
- Downloading the Workbook
Instructor

Dr. Eng. Mohamed Al-Khodour
This course is part of the diploma




