Skip to main content

Clean Code

6h 41m 15s
English
Free

Course description

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!

Read more about the course

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.

What are the course prerequisites?

  • Basic programming knowledge (no matter which language) is required!
  • You don't need to know any specific programming language or programming paradigm to follow along
  • NO prior experience with writing clean code is required

Watch Online

0:00 0:00
#Lesson TitleDuration
1Welcome to the Course!02:28
2What is "Clean Code"?05:58
3Clean Code - Key Pain Points & How To Write Clean Code03:33
4How Is This Course Structured?01:23
5Course Prerequisites03:17
6Clean Code & Strongly Typed Languages02:32
7About The Course Code Examples02:05
8Functional, OOP, Procedural: The Course Concepts Always Apply!01:30
9Clean Code, Principles & Patterns & Clean Architecture03:18
10Clean Code vs Quick Code05:02
11Module Introduction01:02
12Why Good Names Matter03:24
13Choosing Good Names04:04
14Casing Conventions & Programming Languages03:08
15Naming Variables & Properties - Theory03:49
16Naming Variables & Properties - Examples04:45
17Naming Functions & Methods - Theory02:37
18Naming Functions & Methods - Examples03:11
19Naming Classes - Theory01:57
20Naming Classes - Examples02:35
21Exceptions You Should Be Aware Of06:25
22Common Errors & Pitfalls07:51
23Demo Time!10:30
24Your Challenge - Problem01:12
25Your Challenge - Solution10:02
26Module Introduction01:07
27Bad Comments03:53
28Good Comments03:51
29What is "Code Formatting" Really About?02:27
30Vertical Formatting08:04
31Formatting: Language-specific Considerations02:04
32Horizontal Formatting03:37
33Your Challenge - Problem01:02
34Your Challenge - Solution06:20
35Module Introduction01:13
36Analyzing Key Function Parts01:39
37Keep The Number Of Parameters Low!06:39
38Refactoring Function Parameters - Ideas & Concepts03:44
39When One Parameter Is Just Right02:13
40Two Parameters & When To Refactor04:08
41Dealing With Too Many Values04:27
42Functions With A Dynamic Number Of Parameters02:42
43Beware Of "Output Parameters"04:20
44Functions Should Be Small & Do One Thing!09:52
45Why "Levels of Abstraction" Matter06:12
46When Should You Split?02:52
47Demo & Challenge13:10
48Stay DRY - Don't Repeat Yourself02:05
49Splitting Functions To Stay DRY05:42
50Don't Overdo It - Avoid Useless Extractions06:52
51Understanding & Avoiding (Unexpected) Side Effects12:02
52Side Effects - A Challenge09:22
53Why Unit Tests Matter & Help A Lot!06:16
54Module Introduction02:53
55Useful Concepts - An Overview01:23
56Introducing "Guards"02:54
57Guards In Action06:34
58Extracting Control Structures & Preferring Positive Phrasing03:18
59Extracting Control Structures Into Functions04:04
60Writing Clean Functions With Control Structures07:33
61Inverting Conditional Logic08:09
62Embrace Errors & Error Handling06:58
63Creating More Error Guards04:28
64Extracting Validation Code04:11
65Error Handling Is One Thing!03:36
66Using Factory Functions & Polymorphism08:57
67Working with Default Parameters01:15
68Module Summary03:38
69Module Introduction01:43
70Important: This is NOT an OOP or "Patterns & Principles" Course!02:15
71Objects vs Data Containers / Data Structures04:11
72Why The Differentiation Matters03:58
73Classes & Polymorphism12:55
74Classes Should Be Small!06:21
75Understanding "Cohesion"04:50
76The "Law Of Demeter" And Why You Should "Tell, Not Ask"11:41
77The SOLID Principles02:06
78The Single-Responsibility-Principle (SRP) & Why It Matters07:05
79The Open-Closed Principle (OCP) & Why It Matters05:44
80The Liskov Substitution Principle05:57
81The Interface Segregation Principle04:19
82The Dependency Inversion Principle07:01
83Concepts Summary & Checklist09:06
84Staying Clean!02:58
85Possible Next Steps02:45
86Course Roundup00:56

Comments

0 comments

Want to join the conversation?

Sign in to comment

Similar courses

Grow From Mid-Level To Senior Engineer: L4 To L5

Grow From Mid-Level To Senior Engineer: L4 To L5

Sources: Alex Chiou
"Senior Software Engineer" is a title that sounds prestigious and is coveted by every engineer. Top-notch senior engineers are in high demand...
3 hours 50 seconds
Fundamentals of Operating Systems

Fundamentals of Operating Systems

Sources: udemy
Operating systems orchestrate many processes, allow access to memory, disk and network and execute the process by scheduling them to the CPU. Sounds simple...
21 hours 41 minutes 1 second
Python for Financial Analysis and Algorithmic Trading

Python for Financial Analysis and Algorithmic Trading

Sources: udemy
Welcome to Python for Financial Analysis and Algorithmic Trading! Are you interested in how people use Python to conduct rigorous financial analysis and pursue algorithmic tradi...
16 hours 54 minutes 20 seconds
Build & Launch Your SaaS in Under 7 Days

Build & Launch Your SaaS in Under 7 Days

Sources: jsmastery.pro, Adrian Hajdin
A comprehensive master class that will help you quickly design, develop, deploy, and monetize your own SaaS application using modern...
Ethical Hacking: Penetration Testing

Ethical Hacking: Penetration Testing

Sources: pluralsight
Pluralsight is not an official partner or accredited training center of EC-Council. What's penetration testing? Well it's simple, as security professionals our
4 hours 43 minutes 59 seconds