
Explore the principles of design patterns in C# to create simpler, readable, and maintainable code by focusing on interactions between classes and applying MVC concepts.
Explore design patterns from the Gang of Four as proven building blocks for reusable object-oriented software, focusing on problems, solutions, and consequences with C# examples like builder and abstract factory.
Access and use the working files by downloading them as a zip, extracting to your desktop, and opening them from the player as you work along.
Explore the abstract factory pattern to isolate the data source via an abstract class database with connection and command, enabling multiple databases such as sequel server and OleDb for reports.
Explore the abstract factory pattern to decouple the application from database technology by providing sequel server and old lady database implementations through lazy loading and configuration-driven connections.
Master the builder pattern to construct complex database objects with many properties and subobjects, using builder interfaces, concrete builders, and a director to hide construction details.
Explore how the builder pattern isolates complex object construction from application code by pairing a builder with an abstract factory to create database objects, coordinated by a director.
Explore the factory method pattern that creates database objects behind a single interface, isolating construction from the application and enabling flexible config with abstract factory and builder patterns.
Explore how the factory method and abstract factory patterns create database objects via interfaces, enabling lazy loading of connections and commands for sequel server and Lady B databases.
Discover how the prototype pattern creates objects by cloning a prototype, and implement clone methods in .NET to create shallow or deep copies of complex objects like users with addresses.
Explore the prototype pattern by implementing shallow and deep clones in a user and admin class, illustrating how address references differ from newly copied address objects.
The singleton pattern provides one instance across the app, using a private constructor and a static instance, with a thread-safe public access property and a single exception log file.
Demonstrate the singleton pattern with a thread-safe exception handler that uses a private constructor, lazily creates a single instance with a lock, and writes logs to a file.
Utilize the adapter pattern to convert data transfer objects into business objects, unifying third-party data via a defined interface and methods like get customers and add customer.
Apply the adapter pattern to convert a customer DTL from a web service into a business object, using a customer list interface to add and retrieve customers.
Learn how the bridge pattern decouples an abstraction from its implementation, using an I message interface and a message controller to keep application code independent of SMS and email providers.
This bridge pattern example shows isolating messaging details behind a message controller, using an IMessage interface with email and SMS implementors to decouple app logic.
Explore the composite pattern for part–whole hierarchies, with tree structures and uniform treatment of assemblies and parts, including add, remove, and write parts list.
Demonstrate the composite design pattern by building a computer assembly tree with base assembly, assembly and part nodes, and implementing add, remove, write parts list.
Explore the decorator pattern to add memory and storage options to a base object dynamically, using a decorator that wraps a component and overrides get price and get option code.
Explore the decorator pattern by building a computer ordering system, where base computer and decorators add RAM, storage, and a discount to update option codes, prices, and the model number.
Explore the facade pattern to simplify complex operations with a unified interface. Implement a facade to coordinate multistep tasks, such as user registration, purchases, and notifications, through a single method.
Discover how the facade pattern streamlines social app actions by unifying follow operations under a single method, encapsulating database updates, notifications, and posts.
Explore the flyweight pattern by sharing lightweight objects via a dictionary to reduce memory usage. Use lazy loading and a factory to cache and reuse users.
demonstrates how the flyweight pattern reduces memory footprint by sharing user objects through a factory and dictionary, lowering database queries and object creation.
Explore the proxy pattern, a structural pattern that uses a placeholder to keep the application responsive during long-running tasks such as payment processing and remote web service calls.
Apply the proxy pattern to defer credit card approval, returning a placeholder receipt while a long-running get receipt process runs asynchronously. Compare polling with event-driven callbacks for responsiveness.
Explore the chain of responsibility pattern for back-office workflows, enabling multi-step approvals to pass requests along from engineering to purchasing and finance, with parallel handling and sequential checks.
Demonstrates the chain of responsibility by building a three-stage approver chain (engineering, purchasing, finance) to approve material based on drawing and part numbers and budget, with next links and reasons.
Explore the command pattern to decouple the application from method calls by using a common command interface, an invoker, and concrete commands that set properties such as color.
Explore the command pattern with a simple Windows Forms example, using an I command interface and a color invoker to update color commands on UI controls.
Master the interpreter pattern by defining grammar and expressions to translate input into output, using terminals, non-terminals, and a parser to interpret complex logic trees.
Explore the interpreter pattern by building a parser that constructs an expression tree from an input string, interpreting numbers, strings, and boolean logic with and/or operators.
Explore the iterator pattern that provides sequential access to an aggregate's raw collection while hiding its underlying representation and preventing random access.
Explore the iterator design pattern by implementing an aggregate and its get iterator to sequentially traverse a user collection with first, next, current, and is done.
Learn how the mediator pattern isolates object communication by centralizing messaging with a mediator that registers colleagues, posts messages to all, and enables them to receive messages.
Demonstrates the mediator pattern with a messaging app, shows registration of colleagues and posting and receiving messages, and explains isolation of colleagues for broader use.
Explore the memento design pattern to enable undo and transaction rollback by capturing an object's internal state while preserving encapsulation, using originator, memento, and caretaker.
Master the memento design pattern to implement undo for a simple user object, using originator, caretaker, and save state and restore state to preserve id, name, username, and password.
Explore the observer pattern that notifies multiple observers automatically when a subject's data changes, with subscribe, unsubscribe, and notify mechanisms for price or data view updates.
Explore the observer pattern with a price tracker that notifies observers when a price changes. Subscribe and unsubscribe observers, and handle updates through a price changed event.
Explore how the state pattern uses a context, an abstract state, and concrete states to implement a state machine guiding navigation, login, and validation.
Apply the state pattern to manage user login state and type, routing to login, standard, or premium pages, with log in, log out, and upgrade handled via encapsulated state transitions.
Explore the strategy pattern by encapsulating interchangeable algorithms under a common interface, enabling the client to choose at run time which strategy to apply, such as discount or sorting.
Demonstrate the strategy pattern by applying different discount strategies to a customer, keeping the customer unchanged while discounts vary (no, student, loyalty, loyal student).
Explore the template pattern, an abstract class-driven skeleton method that defers steps to subclasses; see a data logger example with file and Windows event log implementations.
Explore the template pattern by implementing an abstract data logger template with concrete file and Windows Event Log loggers, and override log data for each destination.
Explore the visitor pattern, which decouples operations from objects to add functions dynamically, keep base classes lean, and enable maintainable, expandable behavior through credits and expiration updates.
Use the visitor pattern to separate credit and expiration logic from user data. Attach users to a collection and apply credit and expiration visitors to update credits and dates.
Explore the mvc design pattern as an architectural model, detailing model, view, and controller roles, routing, and the separation of concerns that improves maintainability in asp.net.
Explore MVC terminology and C# syntax, including object initializers, var usage, anonymous types, and LINQ queries, to understand data context, models, and select statements.
Build an ASP.NET MVC project in Visual Studio, exploring models, views, and controllers. Learn to implement read/write actions, routing, and razor views with a demo customer data flow.
Model the Northwind database in a data driven MVC app using Entity Framework. Use EF designer from database to create and update the model, with a proper connection string.
Create and scaffold an orders controller in an mvc app using entity framework, generate index, details, create, edit, and delete views, and bind data with related tables and view bags.
Explore how ASP.NET MVC renders the orders view set, featuring index, create, edit, details, and delete pages that use Razor, view bag data, and model binding with validation.
Explore the Gang of Four’s 23 design patterns and solid principles to write simpler, more readable, and maintainable code with architecture considerations and resources for ASP.NET, MVC, and coding conventions.
In this Learning C# Design Patterns training course, expert author Keith Welch will teach you about design patterns, and how to use them to create reusable, maintainable code. This course is designed for users that already have experience with C#, as well as basic object-oriented programming principles.
You will start by learning about creational patterns, including abstract factory, builder, prototype, and singleton. From there, Keith will teach you about structural patterns, such as adapter, bridge, composite, and facade. This video tutorial also covers behavioral patterns, such as chain of responsibility, common, iterator, and mediator. Finally, you will learn about the Model View Controller (MVC) design pattern.
Once you have completed this computer based training course, you will be fully capable of using these 23 design patterns to create your own C# code. Working files are included, allowing you to follow along with the author throughout the lessons.