Until the 30th of April, use code BIRTHDAY40 for 40% off any course, BIRTHDAY20 for 20% off any bundle and BIRTHDAY15 for 15% off your first year of Dometrain Pro

From Zero to Hero: Writing Clean Code with C#

Learn how to write elegant C# using modern Clean Code practices

"Clean Code" is one of the most used phrases in software engineering but is also one of the most misused. What does Clean Code mean, and what makes our code dirty or clean? The concept was popularized by Robert C. Martin or "Uncle Bob", and it is a set of practices that will help you write code that is easier to change, read and understand and less prone to mistakes or issues when it comes time to change or expand it. In this course, Gui Ferreira will teach you everything you need to know to start writing excellent C# code using the knowledge he gained after years of writing clean code professionally for big companies.

Curriculum

Welcome

1:31

What will you learn in this course?

2:17

Who is this course for and prerequisites

1:17

Why Clean Code is essential

2:42

The Boy Scout Rule

1:05

The Broken Windows Theory

1:11

The YAGNI principle

0:47

The KISS principle

0:54

The Principle of Least Surprise

1:39

What is Coupling?

2:27

What is Cohesion?

1:06

Readability vs Performance

2:18

Spotting Duplication

2:27

Writing Idiomatic code

1:59

Section Recap

0:34

Introduction

0:33

The impact of Naming

2:30

How long should a Name be

2:25

Naming Variables

3:34

Naming Booleans

2:19

Naming Methods

4:24

Naming Classes

3:18

Using Acronyms and Abbreviations

2:29

Section Recap

0:47

Introduction

0:27

Good and Bad Comments

5:54

Removing Historic Comments

1:13

Converting Comments to Code

2:19

Removing Formatting Comments

4:11

Replacing Comments with Tests

2:02

Section Recap

0:39

Introduction

0:37

Applying Indentation

1:56

Using Braces

2:06

Using Whitespace

2:45

Vertically Ordering a Class

3:12

Section Recap

0:19

Introduction

0:23

Writing Boolean Comparisons

5:00

Removing Double Negatives

1:59

Avoiding short-circuits

2:39

Avoiding Magic Numbers

6:28

Expressive Switch Statements

5:54

Section Recap

0:42

Introduction

0:51

Removing Nesting

4:07

Returning early

3:03

Using Guard Clauses

3:33

Applying the Single Responsibility Principle

6:09

Removing Flag Arguments

4:07

Parameter Order

4:11

Controlling the number of Parameters

3:18

Output Parameters

3:08

Working with collections

1:53

Section Recap

0:44

Introduction

0:32

Exceptions vs Error Codes

3:31

Writing the Try-Catch block

3:51

Providing Context with Exceptions

3:44

Section Recap

0:31

Introduction

0:40

Applying the Single Responsibility Principle

3:37

Segregating Interface

2:37

Writing Constructors

2:31

Removing Nested Classes

1:50

Converting anemic to rich objects

7:25

Primitive Obsession

4:24

Section Recap

0:51

Introduction

0:27

The Problem of Nulls

0:59

Creating Null Objects

5:58

Rewriting Null Returns

3:25

Section Recap

0:27

Introduction

0:36

The importance of Tests to Clean Code

1:32

Writing better assertions

4:17

Using the Act, Arrange, Assert structure

4:49

Replacing Mocks with real Objects

3:09

Using Test Data Builders

5:24

Using realistic test data

2:46

Section Recap

0:45

Introduction

0:54

Measuring code complexity

3:03

Using refactoring tools

3:49

Applying Standards with an editorconfig

4:21

Using a Spell Checker

1:31

Enforcing Code Quality

1:54

Section Recap

0:37

Refactoring Walkthrough

25:16

Conclusion

1:35

Course Info

Level:
From Zero to Hero
Duration:
4h 06m

Lifetime access

Buy Course
Dometrain Pro

Want access to all of our courses? Subscribe to Dometrain Pro!

More info

About the Author

author_img

Gui Ferreira

Guilherme Ferreira, also known as Gui, is a Minimalist Software Craftsman, passionate about simplicity and continuous learning. Gui is a Microsoft MVP for Developer Technologies, a Tech Speaker, a YouTuber, and a .NET content creator. With over 15 years of experience in software development, Gui went from Startups to Tech Giants. Along his journey, he got to know several hats, including Software Engineer, Architect, CTO, and Developer Advocate, gathering a diverse and invaluable skill set.

More courses by Gui Ferreira