4 out of 5
4
77 reviews on Udemy

Master the Art of Writing Clean Code in C#

Learn how to write clean and maintainable code in C# as bequeathed by Uncle Bob. Learn how to perform refactoring in C#.
Instructor:
Engineer Spock
784 students enrolled
English [Auto-generated]
Give best names for functions, variables and other API members
Understand and rely on programming metaprinciples such as DRY, YAGNI, KISS and others
Write clean functions
Detect common architectural smells and refactor the problems
Apply principles of functional programming
Apply Dependency Injection and avoid common DI-related smells
Write clean unit tests
Practice Test-Driven Development

Learn how to design and implement types in C# so that the other developers won’t hate you when using one of the types developed by you. It means you are going to learn how to write code of the high quality: readable, understandable and reliable.

Improve your knowledge in object-oriented programming in the context of clean coding and building types of high quality.

  • Learn how to give the best names for API members 
  • Learn all the tricks related to writing clean functions
  • Avoid common architectural smells. Get rid of unpleasant smells
  • Apply principles of functional programming: achieve immutability, remove side effects, extend types
  • Avoid smells related to dependency injection
  • Write cleaner unit tests
  • Practice Test-Driven Development

Foundations of building object-oriented infrastructures

Despite the fact that C# is a very rich on features language, it’s very common to see poorly designed and implemented types in a real world. In fact, C# is one of the richest on features language among object-oriented languages in the world nowadays. But with great power comes great responsibility. It’s challenging  to use all those features in a right way.

You probably have already heard the following well-known statement: most code sucks. Well, this course is all about how to produce code which doesn’t suck.

Owning skills of producing a well-designed and well-implemented types is the prerequisite for the other developers to treat you as a real professional.

Content and Overview

This course is aimed at all the C# developers, from beginners to seniors. Topics which are covered in the course are relevant for all kinds of C# developers since all developers design and implement APIs. The topics complexity is very different. There are plenty of very simple topics, and at the same time, there are topics which require from you a solid C# background. There are plenty of code examples throughout this course, so you will learn both theoretical and practical material.

The course covers the following topics:

  • Meta Principles: DRY, KISS, YAGNI, SoC, CQS, PoLA, Encapsulation
  • How to give better names for API members and what naming conventions exist in the .NET platform and suited for C#
  • Common problems encountered by C# developers in the process of designing and implementing APIs: classes vs structures, creational patterns vs constructors,  poor naming, excessively long methods, output parameters and so on.
  • Common Architectural Design Smells such as Primitive Obsession, Hidden Dependencies, Violation of Law of Demeter and other.
  • Functional Programming: immutability, temporal coupling, pipelining, extending IDisposable, Builder Design Pattern, abusing extension methods, dealing with errors
  • DI-related anti-patterns: control freak, hidden dependencies, temporal coupling, ambient context, facade service, bastard injection, cyclic dependencies
  • Clean Unit Tests: singletons and static classes, excessive number of interfaces, testing trivial code, testing of a single concern, different best practices
  • Practicing TDD: definition, 3 laws, parsing roman numerals, continuous testing, implementing Tic-Tac-Toe

The list is far from being complete. The course covers a great number of topics. Enroll and start Mastering the Art of Writing Clean Code in C#!

————————————————————

Keywords related to the course:

  • C# Clean Code
  • C# Best Practices
  • API in C#
  • Building API in C#
  • Clean Code in C# tutorial
  • Refactoring

Before Taking the Course

1
How to Ask Questions
2
Motivation for Writing Clean Code

Programming Metaprinciples

1
Outline
2
DRY - Don't Repeat Yourself
3
KISS - Keep it Simple, Stupid
4
YAGNI - You Ain't Gonna Need It
5
Separation of Concerns (SoC)
6
Command-Query Separation Principle (CQS)
7
Principle of Least Astonishment
8
Encapsulation and Information Hiding
9
Conclusion

Naming API Members

1
Outline
2
General Principles of Naming
3
About Naming Once Again
4
Naming Conventions in .NET
5
Conclusion

Writing Clean Functions

1
Outline
2
Variable Declaration on the Top
3
Magic Numbers
4
"Stringly" Typed Smell
5
Property VS Method
6
Implementing Parameters
7
Too Many Parameters
8
Too Long Methods
9
Creational Patterns VS Constructors
10
"Extract Method" Refactoring
11
Simplifying Complex Logic
12
Sequence of Arguments
13
Guard Clauses and Early Returns
14
Poor Conditional Clauses
15
Output Parameters
16
Comments
17
Prefer Positive if-Statements
18
Conclusion

Common Architectural Design Smells

1
Outline
2
Primitives Obsession
3
Violation of Law of Demeter
4
Temporal Coupling
5
Refactoring to "Template Method" Design Pattern
6
Refactoring to "Strategy" Design Pattern
7
Refactoring to "State" Design Pattern
8
Conclusion

Functional Programming: Extendibility and Immutability

1
Outline
2
Programming Paradigms
3
Defining Functional Programming
4
Functions, Functions, and Functions Again
5
Why Functional Programming?
6
Immutability. Intro
7
Immutability of Structures
8
Temporal Coupling and Immutability
9
Pipelining
10
Extending IDisposable
11
General Extensions
12
Extending StringBuilder
13
Abusing Extension Methods
14
Builder Design Pattern. Immutability and Testability
15
Errors and Functional Programming
16
Errors Handling: Pipelining by Method Chaining
17
Conclusion

DI-Related Anti-Patterns & Refactorings

1
Outline
2
Control Freak
3
Hidden Dependencies and Service Locator
4
Temporal Coupling and Constructor Injection
5
Constructor Over-Injection
6
Ambient Context
7
Facade Service
8
Property Injection Means Bastard Injection?
9
Cyclic Dependencies
10
Conclusion

Clean Unit Tests

1
Outline
2
Singletons and Static Classes
3
Too Many Interfaces
4
Removing Interfaces
5
Testing Trivial Code
6
Test Single Concern
7
More Unit Testing Best Practices
8
Conclusion

Clean Code and TDD

1
Outline
2
What is TDD?
3
Red / Green / Refactor
4
Three Laws of TDD
5
Reading Roman Numerals
6
Continuous Testing
7
Tic-Tac-Toe (Crosses and Noughts)
8
Conclusion
9
BONUS Lecture
You can view and review the lecture materials indefinitely, like an on-demand channel.
Definitely! If you have an internet connection, courses on Udemy are available on any device at any time. If you don't have an internet connection, some instructors also let their students download course lectures. That's up to the instructor though, so make sure you get on their good side!
4
4 out of 5
77 Ratings

Detailed Rating

Stars 5
31
Stars 4
30
Stars 3
12
Stars 2
3
Stars 1
1
b1ea82eaf78a73bf2f94b9d835d03145
30-Day Money-Back Guarantee

Includes

7 hours on-demand video
1 article
Full lifetime access
Access on mobile and TV
Certificate of Completion