Skip to main content

Clean Code

6h 41m 15s
English
Free

As a developer, the ability to write code that works is fundamental. However, there's a distinction between merely functional code and clean code—the latter being a hallmark of professional developers. This course is designed to teach you how to write clean code that is easy for humans to read and understand, not just computers.

Why Clean Code Matters

In this course, you'll discover what clean code truly means and how you can apply clean coding principles. Clean code is not just easier to read and understand; it’s also simpler to maintain. It's not only the computer that needs to understand your code—your colleagues, as well as your future self, will thank you for writing clean, comprehensible code.

Course Overview

This course delves into the main "pain points" associated with bad code and teaches you to transform it into clean code. Here's what you will specifically learn:

Naming Things Correctly

  • Naming variables, properties, classes, and functions appropriately
  • Avoiding common pitfalls and mistakes in naming

Effective Use of Comments

  • Understanding why most comments are unnecessary
  • Identifying good comments to enhance code understanding

Code Formatting

  • Horizontal and vertical code formatting techniques

Function Design

  • Limiting the number of function parameters
  • Writing clean functions focusing on a single task
  • Using levels of abstraction to keep functions small
  • Writing DRY (Don't Repeat Yourself) functions and avoiding side effects

Control Structures and Error Handling

  • Using guards and extracting functionality to avoid nested structures
  • Applying error handling as a smart alternative to if-statements

Object-Oriented Principles

  • Understanding objects, data containers, and data structures
  • Writing cohesive and small classes
  • Applying the Law of Demeter for cleaner code

SOLID Principles

  • Mastering the SOLID principles and their importance in clean code

Course Richness

This course is a comprehensive compilation of common patterns, best practices, principles, and rules for writing clean code. You'll engage with a broad spectrum of concepts, enhancing your understanding by course end.

Methodology

This is not a design patterns course, but rather a focus on rules and concepts crucial for writing clean code. You'll find examples, code snippets, and demos backed by challenges, ensuring practical application of the theory.

Flexibility in Programming Languages

The course examples use Python, JavaScript, and TypeScript, yet no prior knowledge of these languages is required. The concepts are universally applicable, irrespective of specific programming paradigms or styles.

Prerequisites

  • Basic programming knowledge in any language
  • No need for prior clean code experience

About the Authors

Academind Pro

Academind Pro thumbnail
Academind offers the most comprehensive and up-to-date learning resources on Web Development. From the very basics up to advanced topics and real projects - we got you covered! And we'll give you course completion certificates to prove your progress to others!

udemy

udemy thumbnail
By connecting students all over the world to the best instructors, Udemy is helping individuals reach their goals and pursue their dreams. Udemy is the leading global marketplace for teaching and learning, connecting millions of students to the skills they need to succeed. Udemy helps organizations of all kinds prepare for the ever-evolving future of work. Our curated collection of top-rated business and technical courses gives companies, governments, and nonprofits the power to develop in-house expertise and satisfy employees’ hunger for learning and development.

Watch Online 86 lessons

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