Sorry, your browser is not supported
To have the best experience using Skillshare, we recommend that you use one of these supported browsers.

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

Elias Spock, Chance favors the prepared mind.

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
61 Videos (3h 27m)
    • 00 Promo

      4:44
    • 01 Outline

      1:54
    • 02 API's Characteristics

      9:09
    • 03 Public API vs Private API

      1:33
    • 04 API Development Principles

      4:07
    • 05 Conclusion

      1:01
    • 01 Outline

      1:54
    • 02 General Principles of Naming

      10:30
    • 03 Naming Conventions in

      7:26
    • 04 Conclusion

      1:21
    • 01 Outline

      1:54
    • 02 Class vs Structure

      4:01
    • 03 Abstract Class vs Interface

      5:11
    • 04 Implementing Abstract Classes

      2:41
    • 05 Property vs Method

      6:41
    • 06 Implementing Constructors

      1:30
    • 07 Creational Patterns VS Constructors

      3:11
    • 08 Tester Doer Pattern

      1:26
    • 09 Conversion vs Casting Operator

      1:38
    • 10 Implementing Parameters

      3:20
    • 11 Implenenting 'Dispose' Pattern

      11:41
    • 12 Conclusion

      1:14
    • 01 Outline

      1:54
    • 02 Poor Naming

      6:23
    • 03 Violating Naming Conventions

      1:29
    • 04 Variable Declarations on the Top

      1:04
    • 05 Magic Numbers

      0:48
    • 06 Too Long Methods

      6:20
    • 07 Poor Conditional Clauses

      2:10
    • 08 Output Parameters

      3:00
    • 09 Comments

      3:13
    • 10 Prefer Positive if statements

      1:02
    • 11 Conclusion

      1:54
    • 01 Outline

      1:54
    • 02 Primitives Obsession

      2:50
    • 03 Hidden Dependencies

      4:19
    • 04 Violation of Law of Demeter

      6:49
    • 05 Temporal Coupling

      1:36
    • 06 Temporal Coupling and Immutability

      5:26
    • 07 Switch Statements

      5:49
    • 08 Conclusion

      1:24
    • 01 Outline

      1:54
    • 02 What Does an 'Error' Mean

      3:31
    • 03 Problems with Exceptions

      6:50
    • 04 Common Misconceptions

      3:47
    • 05 Exception Handling Strategies

      5:00
    • 06 CQS Principle

      2:47
    • 07 Errors and Functional Programming

      2:58
    • 08 Pipelining by Method Chaining

      4:54
    • 09 Conclusion on Exceptions Handling

      0:51
    • 10 BCL Exception Types

      1:58
    • 11 Custom Exception Types

      1:14
    • 12 Conclusion

      1:14
    • 01 Outline

      1:54
    • 02 Problems with Nulls

      2:34
    • 03 Null Object Pattern

      2:51
    • 04 Maybe Monad in C#

      3:47
    • 05 Automating Null Checks

      5:24
    • 06 Static Analysis

      2:50
    • 07 Returning IEnumerables

      1:46
    • 08 Conclusion

      1:24

About This Class

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