API in C#: The Best Practices of Design and Implementation
4.3 (44 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
429 students enrolled
Wishlisted Wishlist

Please confirm that you want to add API in C#: The Best Practices of Design and Implementation to your Wishlist.

Add to Wishlist

API in C#: The Best Practices of Design and Implementation

Learn how to design and implement API based on the best practices developed by the .NET community.
Bestselling
4.3 (44 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
429 students enrolled
Created by Elias Fofanov
Last updated 6/2017
English
English
Current price: $15 Original price: $35 Discount: 57% off
30-Day Money-Back Guarantee
Includes:
  • 3.5 hours on-demand video
  • 2 Articles
  • 2 Supplemental Resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Design and implement a type or an API taking care of it's users.
  • Encapsulate types so the other programmers would not hate you.
  • Code in a good style making the code clearer in its intent.
  • Refactor the code making it much better to read and understand.
  • Throw and handle exceptions properly.
  • Decide whether to comment a particular part of the code is a good idea or not. By the way, which comments are helpful and which are not?
  • Dealing with Null values
View Curriculum
Requirements
  • You should already be familiar with the basics of C#.
  • You should already have some practice working with Visual Studio.
Description

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.

Teaching Approach

No fluff, no ranting, no beating the air. I esteem your time. The course material is succinct, yet comprehensive. All important concepts are covered. Particularly important topics are covered in-depth. For absolute beginners I offer my help on Skype absolutely free, if requested. Don't forget that this course has English subtitles, so if you don't understand my accent, feel free to turn them on.

Take this course and you will be satisfied.

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

  • Understand the characteristics of a well-designed type
  • Grasp the principles of the convenient API development
  • Write clean code, get rid of unpleasant smells
  • Learn about what exceptions are intended for and how to throw and catch them properly
  • Protect your types from the incorrect usage making them properly encapsulated.

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.

Starting with characteristics and principles of a well-designed type you will go further, learning how to give names for different members, how many parameters a method should take, is it a good idea to take a Boolean as a parameter of a method and much more than that.

Then you will learn what encapsulation really means. How to encapsulate a type? There are some trade-offs we will deal with encapsulating our types. There are many experienced programmers who don't know what encapsulation is in essence. Investigating this topic together we will see how to build a consistent and reliable type.

After mastering the topic of types encapsulating you will face the great problem of exceptions handling. Yep, it's a hard nut to crack. We will start from discussing a question of why do we use exceptions as a mechanism of errors handling. And why C# team didn't invent any other mechanisms?

In the end, we will look at how to fight with null values. As you may know, Tony Hoar said that the invention of a null value was his billion-dollar mistake.

To sum up, the course covers the following topics:

  • API development principles
  • 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, abstract classes vs interfaces, creational patterns vs constructors, how to implement dispose pattern (are you sure you understand this allegedly simple case?)
  • Common implementation smells such as 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.
  • How to deal with errors. It is surprisingly hard to develop robust software where errors handling is based on exceptions. We will find out why this is so and how to struggle with problems of error handling.
  • How to deal with Nulls. Null Vales have always been a pain the ass. NullReferenceException is a well-known and popular guest in our software. We will look at the possible ways of diminishing the disrupting power of null-values.

How long is this course: The course is around 3.5 hours. All are video lectures. You will be able to download all the slides and code samples used in the course.

------------------------------------------------------------

Keywords related to the course:

  • C# Clean Code
  • C# Best Practices
  • API in C#
  • Building API in C#
  • Clean Code in C# tutorial
  • Refactoring
Who is the target audience?
  • This course is primarily oriented on programmers who have at least basic knowledge of C# and looking for practical guidelines concentrated on the improving of code qualities.
Curriculum For This Course
62 Lectures
03:23:58
+
Introduction to API
6 Lectures 19:32

Outline of the course "API in C#: The Best Practices of Design and Implementation".

Preview 03:20

In this lecture you'll learn what characteristics of API are important.

API's Characteristics
09:09

In this lecture you'll learn the difference between public API and private API.

Public API VS Private API
01:33

In this lecture you'll learn the main development principles of API.

API Development Principles
04:07

The conclusion for the introduction into the course "API in C#: The Best Practices of Design and Implementation".

Conclusion
01:01
+
Names
4 Lectures 20:45

The outline of the module about naming of API members.

Outline
01:28

You'll learn abour intention-revealing names, disinformative names, easily readable names, encodings, domain names, scope and length rule and other.

General Principles of Naming
10:30

Learn about standard .NET naming conventions.

Naming Conventions in .NET
07:26

Conclusion for the module about naming API members.

Conclusion
01:21
+
Designing and Implementing Types and their Members
12 Lectures 45:06

The outline of the module where you'll learn how to design and implement types and their members in C#.

Outline
01:15

You'll learn the difference between class and structure in C#.

Preview 04:01

You'll learn the difference between an abstract class and an interface in C#.

Abstract Class VS Interface
05:11

You'll learn the caveats of abstract classes implementation in C#.

Implementing Abstract Classes
02:41

You'll learn how to choose between property and method in C#.

Property VS Method
06:41

You'll learn the caveats of constructors implementation in C#.

Implementing Constructors
01:30

You'll learn when to prefer a creational pattern over a constructor in C#.

Creational Patterns VS Constructors
03:11

You'll learn about the "Tester-Doer" pattern in C#.

Tester-Doer Pattern
01:26

You'll learn how to choose between implementing either a conversion operator or casting operator in C#.

Conversion VS Casting Operator
01:38

You'll learn about the caveats of implementing method's parameters in C#.

Implementing Parameters
03:20

You'll learn about the caveats of implementing the "Dispose" pattern in C#.

Implementing "Dispose" Pattern
11:41

The conclusion for the module where you learned how to design and implement types (API) and their members in C#.

Conclusion
02:31
+
Implementation Smells
11 Lectures 28:26

The outline of the module where you'll learn the typical implementation smells of API in C#.

Outline
01:03

You'll learn about mysterious, meaningless, shortened, ambiguous names and other naming smells.

Poor Naming
06:23

You'll learn about the violation of naming conventions. How to impose the rules of naming by harnessing the power of modern tools.

Violating Naming Conventions
01:29

You'll learn about the smell of declaring variable on top of methods.

Variable Declarations on the Top
01:04

You'll learn about the smell of magic numbers. You'll see how to refactor them.

Magic Numbers
00:48

You'll learn abou the technique "Extract Till You Drop" which was introduced by Robert Martin (aka Uncle Bob). You'll learn the pros and cons of that technique.

Too Long Method
06:20

You'll learn about the right using of ternary operators and how to avoid abusing them.

Poor Conditional Clauses
02:10

You'll learn about the smell of out-parameters and how refactor them out.

Preview 03:00

You'll learn about the smell of silly comments.

Comments
03:13

You'll learn about the smell of double negative if-statements.

Prefer Positive if-statements
01:02

The conclusion for the module where you learned the common smells of API implementation in C#.

Conclusion
01:54
+
Common Architectural Smells
8 Lectures 29:30

The outline of the module where you'll learn about common architectural smells in C#.

Outline
01:00

You'll learn about the primitives obsession, when developers inappropriately use primitive types for representing higher-level concepts.

Primitives Obsession
02:50

You'll learn about hidden dependencies by the example of inappropriate use of the Service Locator pattern.

Hidden Dependencies
04:19

You'll learn the Law of Demeter and you'll see the example of the violation of that law in C#.

Preview 06:49

You'll learn about the smell of temporal coupling and how to avoid it.

Temporal Coupling
01:36

In this lecture, you'll learn the functional style of building functions, without side effects.

Temporal Coupling and Immutability
05:26

You'll learn about the pros and cons of using switch-statements. You'll see how to refactor them into an object-oriented form.

Switch Statements
05:49

The conclusion for the module where you learned common architectural smells in C#.

Conclusion
01:41
+
Dealing with Errors
12 Lectures 36:15

The outline of the module where you'll learn about the approaches to errors handling. How to handle exceptions in C# and how to avoid them.

Outline
01:11

Learn the meaning of the "error" term. What categories of errors exist in C#.

Preview 03:31

Learn deeply what the problems accompany exceptions in C#.

Problems with Exceptions
06:50

Look at the common misconceptions concerning exceptions handling in C#.

Common Misconceptions
03:47

Learn what strategies of exceptions handling exist in C#.

Exception Handling Strategies
05:00

Learn about the Command-Query Separation principle.

CQS Principle
02:47

Learns about the interconnection between errors and functional programming.

Errors and Functional Programming
02:58

Learn what is pipelining and how to implement it via methods chaining in C#.

Pipelining by Method Chaining
04:54

A sub-conclusion about exceptions handling in C#.

Conclusion on Exceptions Handling
00:51

Learn about the built-in exception types in C#. Use them properly!

BCL Exceptions Types
01:58

Learn the rules of implementing custom exceptions types in C#.

Custom Exception Types
01:14

The conclusion for the module where you learned all nitty-gritty abour errors and exceptions handling C#.

Conclusion
01:14
+
Dealing with Nulls
9 Lectures 23:48

The outline of the module where you'll learn the approaches to dealing with nulls in C#.

Outline
01:54

You'll learn what the problems accompany null values.

Preview 02:34

Learn the Null Object pattern in C#.

Preview 02:51

Learn what is the Maybe monad and how to implement it in C#.

Maybe monad in C#
03:47

Learn how to automate null checks using the NullGuard.Fody.

Automating Null Checks
05:24

Learn how the static analysis can help to struggle with nulls.

Static Analysis
02:50

Learn about the special case (regarding null values) of returning null values.

Returning IEnumerables
01:46

The conclusion for the module where you learned the approaches to dealing with null values in C#.

Conclusion
01:24

Final Test
25 questions

BONUS LECTURE
01:18
About the Instructor
Elias Fofanov
4.3 Average rating
622 Reviews
3,996 Students
7 Courses
Software Engineer

I'm thankful enough for that I love what I do.

I began my career as a postgraduate student participating in Microsoft ImagineCup contest.

I've been working with .NET platform since 2003. I've been professionally architecting and implementing software for nearly 7 years, primarily based on .NET platform. I'm passionate about building rich and powerful applications using modern technologies. I'm a certified specialist in Windows Applications and Service Communication Applications by Microsoft.

"If it's work, we try to do less. If it's art, we try to do more." - Seth Godin.

What I can say is that software is my art.