不说其他的没用的开场白了，直接给大家分享三个小故事，都来自于我的读者粉丝（我厚着脸皮称为粉丝吧 ）：问题一：半年前开始学 netcore，现在学东西还是有些吃力，老是报错，比如Autofac，而且还老是找不到解决办法，找到了吧，可能下次还是出错，学习也是断断续续的，但是公司还是用 .net ，心累。问题二：说自己跟着我的文章还有项目，学了 NetCore 也有一段时间了，基本都能看懂，但是学到了 DDD 以后，自己动手搭建，发现一直品不出来味道，仿佛又回到了当时用动软代码生成器生成三层代码的时代了，心慌；问题三：现在啥基本都会点儿，但是不是很懂原理，比如 Autofac 现在我基本都...
The Prototype Design Pattern is one of the Creational Design Patterns defined by the Gang Of Four (GOF) published their book Design Patterns: Elements of Reusable Object-Oriented Software in which they presented a catalog of simple and succinct solutions to commonly occurring design problems.
I have previously blogged about command pattern and composite pattern. I had some projects where I succesfully mixed these two together to compose a composite command. It’s a construct to have a commands hierarchy we can execute with one shot.
OOP is considered by many to be the crown jewel of computer science. The ultimate solution to code organization. The end to all our problems. The only true way to write our programs. Bestowed upon us by the one true God of programming himself…
A strategy design pattern is the most commonly used design pattern in computer programming. In this post, we’ll refactor a switch case into a strategy design pattern. We’ll start with a basic switch case statement and then we’ll gradually refactor the code into strategy design pattern.
The Strategy design pattern is a behavioral design pattern which allows us to define different functionalities, put each functionality in a separate class and make their objects interchangeable. In other words, we have a main Context object that holds a reference towards a Strategy object and delegates it by executing its functionality. If we want to change the way the Context performs its work, we can just replace the current Strategy object with another one.
The Command pattern is a behavioural design pattern that we can use to turn a request into an object which contains all the information about the request. The Command design pattern is quite popular in C#, especially when we want to delay or queue a request’s execution or when we want to keep track of our operations. Furthermore, this possibility to keep track of our operations gives us the opportunity to undo them as well.
In this article, we are going to talk about another structural C# design pattern, the Decorator Design Pattern. We are going to learn, how to implement this pattern in our project and what we can get by doing that. The source code is available at the Decorator Design Pattern – Source Code.
Let's look at some different ways you could implement the strategy pattern in C#. First, I'd like to briefly mention why we care about design patterns and where the strategy pattern fits in. Why Should I Know The Strategy Pattern? Understanding design patterns is a vital skill to possess as a software developer and/or software architect. If you don't, then you end up