From Zero to Hero: Refactoring for C# Developers

Learn how to refactor C# code using the best refactoring techniques

About This Course

Are you a C# developer keen on enhancing code quality and maintainability? If yes, this "From Zero to Hero" course called "Refactoring for C# Developers" is tailor-made for you! This course will equip you with practical skills and the latest practices to refactor any C# codebase. Starting with an overview of refactoring, its importance, and when it's needed, the course delves into various modern and clean refactoring techniques. The best part? The course uses real-world examples to demonstrate how to transform a codebase to make it more efficient, readable, and extendable. With a focus on hands-on learning, guided examples are provided to demonstrate the refactoring process. But that's not all! The course also covers the implications of refactoring on team collaboration and project scalability. By the end of this course, you'll have a solid grasp of refactoring practices, which you can apply directly to your C# development projects. This course is delivered by Nick Cosentino, a Principal Software Engineering Manager at Microsoft, and is based on years of hands-on experience in the field.

Course Curriculum

5h 6m 10 sections
Welcome
04:42 Free preview
What will you learn in this course?
04:34 Free preview
Who is the course for and prerequisites
04:14 Free preview
Teaching style
03:29
What is refactoring?
08:30
What are the general goals of refactoring?
13:00
Introduction
02:34
Renaming private members
07:05
Renaming public members
07:24
Extract method
06:14
Inline method
06:57
Section recap
01:59
Introduction
02:05
Decompose conditional
18:31
Replace with temp query
09:11
Return early / reduce nesting
10:52
Section recap
01:03
Introduction
01:28
Wrap/isolate dependencies
23:51
Extract and inject
19:39
Section recap
02:12
Introduction
01:43
Parameters to parameter object
09:19
Replace conditional with polymorphism and composition
17:52
Introduction
01:26
Rule of 3 and DRY
11:36
Pull up method
10:54
Form template method
07:26
What is a rewrite vs refactor?
19:41
What are the pros of rewriting?
12:09
What are the cons of rewriting?
16:48
Mitigating risks in large refactors
11:16
Introducing the example
02:03
Conversion routes
03:04
Weather web response
02:24
Rule of three + DRY on DTOs
03:36
Strangler fig + repository facade
11:15
Summary of example
01:28
Conclusion
02:28

Meet Your Instructor

Nick Cosentino

Nick Cosentino

Nick Cosentino is a Principal Software Engineering Manager at Microsoft and a .NET content creator. He manages the teams responsible for deploying the hundreds of services supporting the Microsoft365 suite of products to serve users across the planet. Nick brings his unique experiences to the Big Tech world having worked at a startup that scaled from a handful of employees to hundreds before it went public.

Nick runs a software engineering and dotnet-focused blog as well as a YouTube channel called Dev Leader. While he enjoys solving complex problems with software solutions, Nick is passionate about reducing barriers for people to get started on their software engineering journey.

View all courses by Nick Cosentino

What's New

Getting Started: Building .NET Applications on AWS
course

Getting Started: Building .NET Applications on AWS

Learn how to build and deploy .NET applications on AWS using CDK, Lambda, DynamoDB, S3, and more.

Learn More
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
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