Lecture thumbnail 0:02 / 7:12 Hi, my name is Dmitri and I’m here to take you on a journey through the implementation of design

patterns using the C# programming language and .NET framework.

So before we get started talking about the structure of the course I want to talk a bit about myself

So… my name is Demitri.

Here is a rather official-looking picture of me.

I work in an area called Quant Finance, which is an interesting blend of math, finance and computing including

some really cool applications of high-performance computing (HPC).

I am a frequent conference speaker, a blogger, a podcast and generally involved in the developer community

as well.

I’ve been a Microsoft MVP for a very long time now, focusing primarily on the C# programming language

and this is a course on design patterns with C# and .NET.

So what are design patterns exactly?

Well, put simply, Design Patterns are a common architectural approaches that have been observed in software

engineering practices, and these common approaches are expressed in the form of so-called Design Patterns.

Now, a pattern is nothing more than a description of the approach, how it is expressed in a programming

language and what it’s actually used for.

Now, the notion of Design Patterns was, of course, popularized in 1994 by the immortal Gang of Four book

and this book effectively spun off an entire industry devoted to expressing design patterns in the various

settings.

Now, the original book was written using Smalltalk and C++, and these languages are not exactly alive

and kicking.

Smalltalk is almost dead and C++, even though it’s continually evolving, doesn’t offer the same amount

of flexibility as .NET, so we are very lucky in that the way in some of the patterns that have been expressed

in this book were actually incorporated right into this programming language (C#).

But essentially the notion of design patterns has been translated to just about every object-oriented

programming language that’s out there. You can find books on Design Patterns in C#, Java, Ruby

and lots of other languages — even languages which are not properly object-oriented like JavaScript, for

example.

The reason why this course you’re watching right now exists is the fact that we’re living in an object-

oriented paradigm and the Design Patterns in the object oriented paradigm has become universally relevant.

So, in other words, the patterns have not become outdated or obsolete, and they are unlikely to go out

of fashion anytime soon.

And, furthermore, what happened is some programming languages and C# is one such language —

— they actually made design patterns

part of the language, making the use of certain patterns a lot easier by baking them right into the

syntax of the language.

And, in addition, some of the design patterns are now available as libraries so you can download the

library and that library actually gives you a design pattern implementation by itself; and of course

what you’re going to see as you program in the real world is you’re going to see yourself implementing

design patterns in your own code even if you don’t realize. It’s going to be building things and then

later on you might realize: “aha this is actually a design pattern that I’ve seen in this particular course”.

So let’s talk about the course!

What is the structure of the course? So we’re going to begin by discussing the SOLID design principles

and these are design principles of object-oriented design that we’re going to be referring to in some

of the discussions of the design patterns themselves. And, after we talk about the solid design principles,

we are going to jump in and actually discuss the different design patterns. So we’ll go through the typical

“Gamma categorisation”, as it’s known, so we’ll go through Creational patterns, Structural patterns and Behavioral

patterns as well.

Now, if you’re wondering what exactly are the patterns, well,

it’s a standard approach; so it’s a standard set of patterns taken from the original Gang of Four book.

So we’re going to look at all the Creational patterns, and the only thing I’ve changed here is: I’ve kind

of grouped together the Abstract Factory and Factory Method patterns inside a single section of the

course called “Factories” because it seems to make more sense that way. Then, we’re going to look at Structural

patterns.

Once again, no changes to the Gang of Four book’s: a standard list of patterns.

And we’re going to look at Behavioral patterns.

And this is a pretty standard list.

The only thing that I’ve added here is the Null Object pattern, which is a known pattern — a known behavior

pattern that is relevant today and so we’re going to incorporate this as part of the overall list.

So, the organization of this course goes as follows The course is a 100% practical.

So I’m going to be basically typing in Visual Studio and explaining the scenarios and most of the demos —

— like, 99% of the demos, are single file C# files.

So what this means is: you can download the file and you can run it in Visual Studio or Visual Studio Code

or (JetBrains) Rider or any kind of IDE that you want.

I’ve also added end-of-section coding exercises and, typically, those exercises relate to design patterns

and they — most of them — are of the “implement this pattern” variety. So I give you a scenario and I ask

you to implement this. Now, because I’ve been programming for a very long time what you’re going to

see in this course is you’re going to see very heavy use of ReSharper.

So I’m going to be using ReSharper to generate things all over the place.

There’s also going to be a liberal use of public fields — this is not a coding recommendation!

I’m simply trying to save time in terms of explaining certain concepts because, strictly speaking, you

have to think about encapsulation and you have to think about how to best expose your data, but in certain

cases, I’m going to be cutting corners by using public fields.

You’re also going to see me in some of the examples use dependency injection.

I’m going to be using Autofac — fact I have a separate coarse on Autofac, if you’re interested. But I’m going

to be using it like, you know, like it’s normal — because it IS normal, it’s normal to use dependency injection.

And, indeed, one of the key points about this course is that instead of ignoring the existence of this

concept of dependency injection, we’re going to talk about how it interacts with the different design

patterns. And finally you’re going to see lots of use of third party Nuget packages.

So, if I need something like, for example, if I need a dynamic proxy, I’m just going to go onto the Nuget store

and I’m going to download the appropriate package.

So, once again, this is a very normal practice for any .NET developer.

So let’s talk about some of the prerequisites for this course. Obviously, you have to have a good understanding

of C# and, generally, you have to have an understanding of object-oriented programming principles

because design patterns are object-oriented patterns ;)

If you wanted Monads (those are the functional patterns) — that would be a different course. But this course

is on object-oriented constructs.

Now, the kind of topics that are going to be mentioned in the course in addition to just general C#

are the following and I’m not going to focus on them and their knowledge is not critical by the way.

So, at some point, I will mention sequence processing some things like LINQ or Reactive Extensions and

we are going to talk about concurrency concerns or multi-threading concerns.

And, in this case, I might mention the task parallel library.

In addition, we’re going to mention dependency injection in many places, because it’s always interesting

to find out how the design pattern behaves if you actually use it in the context of a dependency injection

container.

So if you’re ready to jump in and learn about Design Patterns then let’s go and I will see you on the

other side!

Stop

0 items under this folder.