
Master the art of writing clean, maintainable C# code by identifying code smells, refactoring without changing behavior, and embracing Resharper to boost productivity.
Discover a seasoned instructor with 12 years of C# development experience and Microsoft certification, sharing his lifelong coding journey and commitment to clean code.
Identify mysterious, meaningless, and ambiguous names and replace them with intention revealing ones, such as check availability and view customer page. Use refactoring tools like Resharper to rename safely.
Discover dotnet naming conventions: use Pascalcase for classes, properties, and methods, and Camelcase for private fields, parameters, and locals with underscores.
Address poor method signatures by aligning parameter types and return values, avoid boolean flags, and use extract method with safe delete to refactor login and get user logic.
Learn how long parameter lists hinder understanding and how to refactor safely by encapsulating related parameters into date range and reservations query classes, targeting a maximum of three parameters.
Avoid output parameters by refactoring methods to return a tuple, then replace with a meaningful result class, using Resharper to inline variables and improve clarity.
Declare variables close to where they are used, not at the top of the method. Use refactoring to join declaration and assignment and remove redundant initializers.
Identify and eliminate magic numbers in code by replacing them with meaningful constants and a reusable enumeration, refactoring method signatures to use document status instead of raw integers or strings.
Learn practical techniques to simplify nested conditionals in C#, using ternary operators, boolean simplifications, guard clauses, and combining conditions, demonstrated with a cancel reservation refactor guided by unit tests.
Refactor switch statements by applying polymorphism, moving cost logic into pay-as-you-go and unlimited customer classes. Follow open-closed principle, use resharper-assisted refactoring, and verify with unit tests.
Learn to eliminate duplicated code by applying the dry principle, extract methods, and perform step-by-step refactoring with resharper to create a reusable Time class with a parse method.
Understand how many comments are useless or outdated, and learn to write self-descriptive code; refactor to remove noise, use to-do notes for constraints, and explain why rather than what.
Spot long methods and code smells, and refactor with extract method or extract class to enforce cohesion and the single responsibility principle.
Learn to refactor a web forms user control by extracting methods, introducing a post repository, and moving data access into a dedicated class—improving srp, initialization, and readability.
Refactor a web forms post editor by extracting fields, moving initialization to constructor, and making it read-only to improve testability and cohesion, while extracting error display helpers and improving naming.
Concludes the course on writing clean code for C# developers by thanking learners, and inviting reviews and feedback via email to improve future content.
These days, anyone can code. But if you want to get a job as an intermediate or senior-level C# developer, you must know how to write clean, maintainable code.
As Martin Fowler said:
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." - Martin Fowler
Poorly written code is hard to understand, maintain and test. But what does separate poorly written code (aka code that smells) from beautiful code that talks?
In this course, Mosh, author of several best selling C# courses on Udemy, walks you through common code smells found in C# programs and shows you how to refactor them using ReSharper. Refactoring is changing the design of the existing code without changing its external behaviour.
In every lecture, you'll see an example of a popular code smell with Mosh's commentary about what is wrong with that code and more importantly, why. You'll then learn how to change the code in a safe and step-by-step fashion while minimising breaking changes. All the source codes presented in the lectures are available for download so you can practice these techniques on your own.
By the end of this course, you'll be able to
Understanding and using these techniques are absolutely essential skills that every C# developer must have.
WHAT OTHER STUDENTS WHO HAVE TAKEN THIS COURSE SAY:
"This is a must have tutorial for every programmer. It includes the most valuable tips I have received for 5 years. Thank you Mosh you helped me a lot." -Se He
"Just Love It! Its the 4th course i bought from Mosh, and i do not regret spending any money. I'm working as a developer for 2-3 years now but keep loosing myself in code written by me / others. I can finally understand why and what to change. Thanks Mosh!" -Klaus Prünster
"This course was really great at explaining clean coding practices in a way which is easy to follow and understand. Highly recommended!" -Edin Livnjak
"Another fantastic course from Mosh. I have't seen another course that explains these essential concepts so clearly. In my opinion all Developers should be taught this type of thing before being let loose within a work environment." -Mark Baker
"This course is awesome! It's highly detailed (but easy to understand nonetheless). It has, for me personally, the right amount of information density; Mosh picked exactly the right speed of teaching and progressively intensifies the content, which is great! It is definitively worth the time and money, and one can clearly see the passionate effort the author has put in the creation of these materials. Big respects!!" -Raphael Beck
100% MONEY-BACK GUARANTEE
This course comes with a 30-day money back guarantee. If you're not happy, ask for a refund, all your money back, no questions asked.
So, do you want to take your C# skills to the next level?
Enrol in the course now and you'll see the difference between clean and smelly code within a few minutes.