Clean Code
Learn how to write readable, understandable and therefore maintainable code - step by step, in an example-driven way
Start courseAs 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.
Course content
Section 1Getting Started
- Welcome to the Course!2:27
- What is "Clean Code"?5:57
- Clean Code - Key Pain Points & How To Write Clean Code3:31
- How Is This Course Structured?1:22
- Course Prerequisites3:16
- Clean Code & Strongly Typed Languages2:31
- About The Course Code Examples2:04
- Functional, OOP, Procedural: The Course Concepts Always Apply!1:29
- Clean Code, Principles & Patterns & Clean Architecture3:17
- Clean Code vs Quick Code5:01
- Module & Course Resources1:00
Section 2Naming - Assigning Names to Variables, Functions, Classes & More
- Module IntroductionPremium1:01
- Why Good Names MatterPremium3:23
- Choosing Good NamesPremium4:03
- Casing Conventions & Programming LanguagesPremium3:07
- Naming Variables & Properties - TheoryPremium3:48
- Naming Variables & Properties - ExamplesPremium4:44
- Naming Functions & Methods - TheoryPremium2:36
- Naming Functions & Methods - ExamplesPremium3:10
- Naming Classes - TheoryPremium1:56
- Naming Classes - ExamplesPremium2:34
- Exceptions You Should Be Aware OfPremium6:24
- Common Errors & PitfallsPremium7:50
- Demo Time!Premium10:29
- Your Challenge - ProblemPremium1:11
- Your Challenge - SolutionPremium10:01
- Module ResourcesPremium1:00
Section 3Code Structure, Comments & Formatting
- Module IntroductionPremium1:06
- Bad CommentsPremium3:52
- Good CommentsPremium3:50
- What is "Code Formatting" Really About?Premium2:26
- Vertical FormattingPremium8:03
- Formatting: Language-specific ConsiderationsPremium2:03
- Horizontal FormattingPremium3:36
- Your Challenge - ProblemPremium1:01
- Your Challenge - SolutionPremium6:19
- Module ResourcesPremium1:00
Section 4Functions & Methods
- Module IntroductionPremium1:12
- Analyzing Key Function PartsPremium1:38
- Keep The Number Of Parameters Low!Premium6:38
- Refactoring Function Parameters - Ideas & ConceptsPremium3:43
- When One Parameter Is Just RightPremium2:12
- Two Parameters & When To RefactorPremium4:07
- Dealing With Too Many ValuesPremium4:26
- Functions With A Dynamic Number Of ParametersPremium2:41
- Beware Of "Output Parameters"Premium4:19
- Functions Should Do One Thing!Premium9:51
- Why "Levels of Abstraction" MatterPremium6:11
- When Should You Split?Premium2:51
- Demo & ChallengePremium13:09
- Stay DRY - Don't Repeat YourselfPremium2:03
- Splitting Functions To Stay DRYPremium5:41
- Don't Overdo It - Avoid Useless ExtractionsPremium6:51
- Understanding & Avoiding (Unexpected) Side EffectsPremium12:01
- Side Effects - A ChallengePremium9:21
- Why Unit Tests Matter & Help A Lot!Premium6:15
- Module ResourcesPremium1:00
Section 5Control Structures & Errors
- Module IntroductionPremium2:52
- Useful Concepts - An OverviewPremium1:22
- Introducing "Guards"Premium2:53
- Guards In ActionPremium6:33
- Extracting Control Structures & Preferring Positive PhrasingPremium3:17
- Extracting Control Structures Into FunctionsPremium4:03
- Writing Clean Functions With Control StructuresPremium7:32
- Inverting Conditional LogicPremium8:07
- Embrace Errors & Error HandlingPremium6:57
- Creating More Error GuardsPremium4:27
- Extracting Validation CodePremium4:10
- Error Handling Is One Thing!Premium3:35
- Using Factory Functions & PolymorphismPremium8:56
- Working with Default ParametersPremium1:14
- Avoid Magic Numbers & StringsPremium1:00
- Module SummaryPremium3:37
- Module ResourcesPremium1:00
Section 6Objects, Classes & Data Containers / Structures
- Module IntroductionPremium1:42
- Important: This is NOT an OOP or "Patterns & Principles" Course!Premium2:14
- Objects vs Data Containers / Data StructuresPremium4:10
- Why The Differentiation MattersPremium3:57
- Classes & PolymorphismPremium12:54
- Classes Should Be Small!Premium6:20
- Understanding "Cohesion"Premium4:49
- The "Law Of Demeter" And Why You Should "Tell, Not Ask"Premium11:40
- The SOLID PrinciplesPremium2:05
- The Single-Responsibility-Principle (SRP) & Why It MattersPremium7:04
- The Open-Closed Principle (OCP) & Why It MattersPremium5:43
- The Liskov Substitution PrinciplePremium5:56
- The Interface Segregation PrinciplePremium4:18
- The Dependency Inversion PrinciplePremium7:00
- Module ResourcesPremium1:00
Section 7Summary & Checklist
- Concepts Summary & ChecklistPremium9:05
Section 8Course Roundup
- Staying Clean!Premium2:56
- Possible Next StepsPremium2:43
- Thanks & Goodbye!Premium1:14
- Bonus!Premium1:00
Course instructor
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.