Clean Code

Learn how to write readable, understandable and therefore maintainable code - step by step, in an example-driven way

Start
  1. Courses
  2. Clean Code

As a developer, you should be able to write code which works - of course!

Unfortunately, a lot of developers write bad code nonetheless - even though the code works. Because "working code" is not the same as "clean code"!

This course teaches you how to write clean code - code which is easy to read and understand by humans, not just computers!

In this course, you'll learn what exactly clean code is and, more importantly, how you can write clean code. Because if your code is written in a clean way, it's easier to read and understand and therefore easier to maintain.

Because it's NOT just the computer who needs to understand your code - your colleagues and your future self needs to be able to understand it as well!

In this course, we'll dive into all the main "pain points" related to clean code (or bad code - depending on how you look at it) and you will not just learn what makes up bad code but of course also how to turn it into clean code.

Specifically, you will learn about:

  • Naming "things" (variables, properties, classes, functions, ...) properly and in a clean way
  • Common pitfalls and mistakes you should avoid when naming things
  • Comments and that most of them are bad
  • Good comments you might consider adding to your code
  • Code formatting - both horizontal and vertical formatting
  • Functions and how to limit the number of function parameters
  • How to write clean functions by focusing on "one thing"
  • How levels of abstraction help you split functions and keep them small
  • How to write DRY functions and avoid unexpected side effects
  • Avoiding deeply nested control structures with guards and by extracting functionality into functions
  • Errors and error handling as a replacement for if-statements
  • Objects & data containers/ data structures and why that differentiation could matter
  • Cohesion and how to write good (small!) classes
  • The Law of Demeter and why it matters for clean code
  • What the SOLID principles are and why they matter when it comes to writing clean code
  • Much more!

This course is a compilation of common patterns, best practices, principles and rules related to writing clean code.

In this course, you'll learn about a broad variety of concepts, rules, ideas, thoughts and principles and by the end of course, you'll have a good idea of what to keep in mind when it comes to writing clean code.

This is not a design patterns or general patterns course though - we will entirely focus on patterns, rules and concepts that help with writing clean code specifically.

All these concepts and rules are backed up by examples, code snippets and demos. And to ensure that you get the most out of this course, and you don't just learn a bunch of theory which you forget soon after, there also are plenty of challenges for you to apply what you learned!

This course uses Python, JavaScript and TypeScript for code examples but you don't need to know these languages to follow along and get a lot out of the course. In addition, the course does not focus on a specific programming style or paradigm (like functional programming, object-oriented programming etc) but instead covers general concepts and techniques which will always apply.

Section: Getting Started

1. Welcome to the Course! (2:27)
2. What is "Clean Code"? (5:57)
3. Clean Code - Key Pain Points & How To Write Clean Code (3:31)
4. How Is This Course Structured? (1:22)
5. Course Prerequisites (3:16)
6. Clean Code & Strongly Typed Languages (2:31)
7. About The Course Code Examples (2:04)
8. Functional, OOP, Procedural: The Course Concepts Always Apply! (1:29)
9. Clean Code, Principles & Patterns & Clean Architecture (3:17)
10. Clean Code vs Quick Code (5:01)
11. Module & Course Resources (1:00)

Section: Naming - Assigning Names to Variables, Functions, Classes & More

12. Module Introduction (1:01)
13. Why Good Names Matter (3:23)
14. Choosing Good Names (4:03)
15. Casing Conventions & Programming Languages (3:07)
16. Naming Variables & Properties - Theory (3:48)
17. Naming Variables & Properties - Examples (4:44)
18. Naming Functions & Methods - Theory (2:36)
19. Naming Functions & Methods - Examples (3:10)
20. Naming Classes - Theory (1:56)
21. Naming Classes - Examples (2:34)
22. Exceptions You Should Be Aware Of (6:24)
23. Common Errors & Pitfalls (7:50)
24. Demo Time! (10:29)
25. Your Challenge - Problem (1:11)
26. Your Challenge - Solution (10:01)
27. Module Resources (1:00)

Section: Code Structure, Comments & Formatting

28. Module Introduction (1:06)
29. Bad Comments (3:52)
30. Good Comments (3:50)
31. What is "Code Formatting" Really About? (2:26)
32. Vertical Formatting (8:03)
33. Formatting: Language-specific Considerations (2:03)
34. Horizontal Formatting (3:36)
35. Your Challenge - Problem (1:01)
36. Your Challenge - Solution (6:19)
37. Module Resources (1:00)

Section: Functions & Methods

38. Module Introduction (1:12)
39. Analyzing Key Function Parts (1:38)
40. Keep The Number Of Parameters Low! (6:38)
41. Refactoring Function Parameters - Ideas & Concepts (3:43)
42. When One Parameter Is Just Right (2:12)
43. Two Parameters & When To Refactor (4:07)
44. Dealing With Too Many Values (4:26)
45. Functions With A Dynamic Number Of Parameters (2:41)
46. Beware Of "Output Parameters" (4:19)
47. Functions Should Do One Thing! (9:51)
48. Why "Levels of Abstraction" Matter (6:11)
49. When Should You Split? (2:51)
50. Demo & Challenge (13:09)
51. Stay DRY - Don't Repeat Yourself (2:03)
52. Splitting Functions To Stay DRY (5:41)
53. Don't Overdo It - Avoid Useless Extractions (6:51)
54. Understanding & Avoiding (Unexpected) Side Effects (12:01)
55. Side Effects - A Challenge (9:21)
56. Why Unit Tests Matter & Help A Lot! (6:15)
57. Module Resources (1:00)

Section: Control Structures & Errors

58. Module Introduction (2:52)
59. Useful Concepts - An Overview (1:22)
60. Introducing "Guards" (2:53)
61. Guards In Action (6:33)
62. Extracting Control Structures & Preferring Positive Phrasing (3:17)
63. Extracting Control Structures Into Functions (4:03)
64. Writing Clean Functions With Control Structures (7:32)
65. Inverting Conditional Logic (8:07)
66. Embrace Errors & Error Handling (6:57)
67. Creating More Error Guards (4:27)
68. Extracting Validation Code (4:10)
69. Error Handling Is One Thing! (3:35)
70. Using Factory Functions & Polymorphism (8:56)
71. Working with Default Parameters (1:14)
72. Avoid Magic Numbers & Strings (1:00)
73. Module Summary (3:37)
74. Module Resources (1:00)

Section: Objects, Classes & Data Containers / Structures

75. Module Introduction (1:42)
76. Important: This is NOT an OOP or "Patterns & Principles" Course! (2:14)
77. Objects vs Data Containers / Data Structures (4:10)
78. Why The Differentiation Matters (3:57)
79. Classes & Polymorphism (12:54)
80. Classes Should Be Small! (6:20)
81. Understanding "Cohesion" (4:49)
82. The "Law Of Demeter" And Why You Should "Tell, Not Ask" (11:40)
83. The SOLID Principles (2:05)
84. The Single-Responsibility-Principle (SRP) & Why It Matters (7:04)
85. The Open-Closed Principle (OCP) & Why It Matters (5:43)
86. The Liskov Substitution Principle (5:56)
87. The Interface Segregation Principle (4:18)
88. The Dependency Inversion Principle (7:00)
89. Module Resources (1:00)

Section: Summary & Checklist

90. Concepts Summary & Checklist (9:05)

Section: Course Roundup

91. Staying Clean! (2:56)
92. Possible Next Steps (2:43)
93. Thanks & Goodbye! (1:14)
94. Bonus! (1:00)

Course Instructor

Image

Maximilian Schwarzmüller

As a self-taught professional I really know the hard parts and the difficult topics when learning new or improving on already-known languages. This background and experience enable me to focus on the most relevant key concepts and topics. My track record of many 5-star rated courses, more than 1,000,000 students worldwide as well as a successful YouTube channel is the best proof for that.

The most rewarding experience for me is to see how people find new, better jobs, build awesome web applications, work on amazing projects or simply enjoy their hobby with the help of my content. That's why, together with Manuel Lorenz, I founded Academind to offer the best possible learning experience and to share the pleasure of learning with our students.