• Courses
  • TutorialsFree
  • Learning Paths
  • Blogs
  • Authors
  • Dometrain Pro
  • Shopping Basket

    Your basket is empty

  • Business Portal
  • From Zero to Hero: Writing Clean Code with C#

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

    About This Course

    "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.

    Course Curriculum

    4h 06m 14 sections
    Welcome
    1:31 Free preview
    What will you learn in this course?
    2:17 Free preview
    Who is this course for and prerequisites
    1:17 Free preview
    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

    Meet Your Instructor

    Gui Ferreira

    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.

    View all courses by Gui Ferreira

    What's New

    What's new in C# 14
    blog

    What's new in C# 14

    This guide covers every new C# 14 feature, explains its benefits, and provides practical code examples to help you navigate how you can use them.

    Learn More
    Let's Build It: AI Chatbot with RAG in .NET Using Your Data
    course

    Let's Build It: AI Chatbot with RAG in .NET Using Your Data

    Build a Retrieval-Augmented Generation (RAG) chatbot that can answer questions using your data.

    Learn More
    Working with Large Language Models
    tutorial

    Working with Large Language Models

    Learn how to work with Large Language Models (LLMs). Understand the fundamentals of how GPT works, the transformer architecture, and master prompt engineering techniques to build AI agents.

    Learn More
    From Zero to Hero: SignalR in .NET
    course

    From Zero to Hero: SignalR in .NET

    Enable enterprise-grade real-time communication for your web apps with SignalR.

    Learn More
    Deep Dive: Solution Architecture
    course

    Deep Dive: Solution Architecture

    Master solution architecture and turn business needs into scalable, maintainable systems.

    Learn More
    Migrating: ASP.NET Web APIs to ASP.NET Core
    course

    Migrating: ASP.NET Web APIs to ASP.NET Core

    A step-by-step process to migrate ASP.NET Web APIs from .NET Framework to ASP.NET Core.

    Learn More
    Getting Started: Caching in .NET
    course

    Getting Started: Caching in .NET

    Let's make the hardest thing in programming easy for .NET software engineers.

    Learn More
    From Zero to Hero: Testing with xUnit in C#
    course

    From Zero to Hero: Testing with xUnit in C#

    Learn how to test any codebase in .NET with the latest version of xUnit, the industry-standard testing library.

    Learn More
    Create a ChatGPT Console AI Chatbot in C#
    blog

    Create a ChatGPT Console AI Chatbot in C#

    This walkthrough is your hands-on entry point to create a basic C# console application that talks to ChatGPT using the OpenAI API.

    Learn More