Hands-On Design Patterns with C# and .NET Core
- Length: 410 pages
- Edition: 1
- Language: English
- Publisher: Packt Publishing
- Publication Date: 2019-07-05
- ISBN-10: 1789133645
- ISBN-13: 9781789133646
- Sales Rank: #2528858 (See Top 100 Books)
Apply design patterns to solve problems in software architecture and programming using C# 7.x and .NET Core 2
Key Features
- Enhance your programming skills by implementing efficient design patterns for C# and .NET
- Explore design patterns for functional and reactive programming to build robust and scalable applications
- Discover how to work effectively with microservice and serverless architectures
Book Description
Design patterns are essentially reusable solutions to common programming problems. When used correctly, they meet crucial software requirements with ease and reduce costs. This book will uncover effective ways to use design patterns and demonstrate their implementation with executable code specific to both C# and .NET Core.
Hands-On Design Patterns with C# and .NET Core begins with an overview of object-oriented programming (OOP) and SOLID principles. It provides an in-depth explanation of the Gang of Four (GoF) design patterns such as creational, structural, and behavioral. The book then takes you through functional, reactive, and concurrent patterns, helping you write better code with streams, threads, and coroutines. Toward the end of the book, you’ll learn about the latest trends in architecture, exploring design patterns for microservices, serverless, and cloud native applications. You’ll even understand the considerations that need to be taken into account when choosing between different architectures such as microservices and MVC.
By the end of the book, you will be able to write efficient and clear code and be comfortable working on scalable and maintainable projects of any size.
What you will learn
- Make your code more flexible by applying SOLID principles
- Follow the Test-driven development (TDD) approach in your .NET Core projects
- Get to grips with efficient database migration, data persistence, and testing techniques
- Convert a console application to a web application using the right MVP
- Write asynchronous, multithreaded, and parallel code
- Implement MVVM and work with RxJS and AngularJS to deal with changes in databases
- Explore the features of microservices, serverless programming, and cloud computing
Who this book is for
If you have a basic understanding of C# and the .NET Core framework, this book will help you write code that is easy to reuse and maintain with the help of proven design patterns that you can implement in your code.
Table of Contents
- Overview of OOP in .NET Core and C#
- Modern Software Design Patterns and Principles
- Implementing Design Patterns – Basics Part 1
- Implementing Design Patterns – Basics Part 2
- Implementing Design Patterns – .Net Core
- Implementing Design Patterns for web applications- Part 1
- Implementing Design Patterns for web applications- Part 2
- Concurrent programming in NET Core
- Functional Programming Practices
- Reactive Programming Patterns and techniques
- Advanced database design and application techniques
- Coding for the Cloud
- Appendix A: Miscellaneous Best Practices
Title Page Copyright and Credits Hands-On Design Patterns with C# and .NET Core Dedication About Packt Why subscribe? Foreword Contributors About the authors About the reviewers Packt is searching for authors like you Preface Who this book is for What this book covers To get the most out of this book Download the example code files Code in Action Download the color images Conventions used Get in touch Reviews Section 1: Essentials of Design Patterns in C# and .NET Core Overview of OOP in .NET Core and C# Technical requirements Installing Visual Studio Setting up .NET Core The models used in this book OOP and how classes and objects work Explaining OOP A class An object Associations An interface Inheritance Types of inheritance Encapsulation Polymorphism Static polymorphism Dynamic polymorphism Interface polymorphism Inheritance polymorphism Generics Summary Questions Modern Software Design Patterns and Principles Technical requirements Installing Visual Studio Setting up .NET Core Design principles DRY – Don't Repeat Yourself KISS – Keep It Simple Stupid YAGNI – You Aren't Gonna Need It MVP – Minimum Viable Product SOLID Single responsibility principle Open/closed principle Liskov substitution principle Interface segregation principle Dependency inversion principle Software patterns GoF patterns Creational patterns Structural patterns Decorator patterns Behavioral patterns Chain of responsibility Observer pattern Enterprise integration patterns Topology Patterns Messaging Transformation Routing Software development life cycle patterns Waterfall SDLC Agile SDLC Summary Questions Section 2: Deep Dive into Utilities and Patterns in .NET Core Implementing Design Patterns - Basics Part 1 Technical requirements Installing Visual Studio Setting up .NET Core Minimum Viable Product Requirements How does MVP fit with future development? Test-driven development Why did the team choose TDD? Setting up the projects Initial unit test definitions Abstract Factory design pattern InventoryCommand abstract class SOLID principles Single responsibility principle (SRP) Open/closed principle (OCP) Liskov substitution principle (LSP) Interface segregation principle (ISP) Dependency inversion principle InventoryCommand unit tests Access modifiers Helper TestUserInterface Example unit test – QuitCommand Summary Questions Implementing Design Patterns - Basics Part 2 Technical requirements Installing Visual Studio Setting up .NET Core The singleton pattern Processes and threads The repository pattern Unit tests A race condition illustration AddInventoryCommand TestInventoryContext AddInventoryCommandTest UpdateQuantityCommand UpdateQuantityCommandTest GetInventoryCommand GetInventoryCommandTest The factory pattern Unit tests Issue one – UnknownCommand InventoryCommandFactoryTests Issue two – case-insensitive text commands Features in .NET Core IServiceCollection CatalogService IServiceProvider Console application Summary Questions Implementing Design Patterns - .NET Core Technical requirements Installing Visual Studio Setting up .NET Core .Net Core service lifetimes Transient Scoped Singleton Back to FlixOne Unit tests Scope Implementation factory IInventoryContext IInventoryReadContext IInventoryWriteContext InventoryCommandFactory InventoryCommand Implementation factory using a function Using services Using third-party containers Summary Questions Implementing Design Patterns for Web Applications - Part 1 Technical requirements Installing Visual Studio Setting up .NET Core Installing SQL Server Creating a .Net Core web application Kicking off the project Developing requirements Crafting a web application Web applications and how they work Coding the web application Implementing CRUD pages Summary Questions Further reading Implementing Design Patterns for Web Applications - Part 2 Technical requirements Installing Visual Studio Setting up .NET Core Installing SQL Server Extending the .NET Core web application Project kickoff Requirements Business requirements Technical requirements Challenges Challenges for developers Challenges for businesses Finding a solution to the problems/challenges Authentication and authorization Authentication in action Why does it make a difference? Authorization in action Creating a web test project Summary Questions Further reading Section 3: Functional Programming, Reactive Programming, and Coding for the Cloud Concurrent Programming in .NET Core Technical requirements Installing Visual Studio Setting up .NET Core Installing SQL Server Concurrency in the real world Multithreading and asynchronous programming Async/Await – why is blocking bad? Concurrent collections Patterns and practices – TDD and Parallel LINQ Summary Questions Further reading Functional Programming Practices Technical requirements Installing Visual Studio Setting up .NET Core Installing SQL Server Understanding functional programming Enhancing our inventory application Requirements Back to FlixOne Strategy pattern and functional programming Summary Questions Reactive Programming Patterns and Techniques Technical requirements Installing Visual Studio Setting up .NET Core Installing SQL Server The principles of reactive programming Be reactive with reactive programming Reactive streams in action Reactive and IObservable Observer pattern – implementation using IObservable<T> Reactive extensions – .NET Rx extensions Inventory application use case Starting the project Requirements Business requirements Getting inventory with a filter, paging, and sorting Patterns and Practices – MVVM Implementation of MVVM Summary Questions Further reading Advanced Database Design and Application Techniques Technical requirements Installing Visual Studio Setting up .NET Core Installing SQL Server Use case discussion Project kickoff Requirements Business requirements Technical requirements Challenges Challenges for developers Challenges for businesses Providing a solution to the problems/challenges Database discussion Database processing OLTP OLAP Ledger-style databases Implementing the CQRS pattern Summary Questions Coding for the Cloud Technical requirements Key considerations when building solutions in the cloud Scalability Workload Solution patterns Vertical scaling Horizontal scaling Auto-scaling Microservices Small Business capability Loosely coupled Independently maintainable Isolated state Advantages Resiliency/availability Solution pattern EDA Queue-Based Load Leveling Publisher Subscriber Priority Queue Compensating transaction Security Solution patterns Federated security Application design Solution patterns Cache Cache-aside Write-through cache Static Content Hosting Command and Query Responsibility Segregation Challenges of CQRS Why CQRS? DevOps Solution patterns Telemetry Continuous integration/continuous deployment Summary Questions Further reading Miscellaneous Best Practices Technical requirements Installation of Visual Studio Use case discussion UML diagram Types of UML diagram Best practices Other design patterns Summary Questions Further reading Assessments Chapter 1 – Overview of OOP in .NET Core and C# Chapter 2 – Modern Software Design Patterns and Principles Chapter 3 – Implementing Design Patterns – Basics Part 1 Chapter 4 – Implementing Design Patterns – Basics Part 2 Chapter 5 – Implementing Design Patterns – .NET Core Chapter 6 – Implementing Design Patterns for Web Applications – Part 1 Chapter 7 – Implementing Design Patterns for Web Applications – Part 2 Chapter 8 – Concurrent Programming in .NET Core Chapter 9 – Functional Programming Practices – an Approach Chapter 10 – Reactive Programming Patterns and Techniques Chapter 11 – Advanced Database Design and Application Techniques Chapter 12 – Coding for the Cloud Appendix A – Miscellaneous Best Practices Other Books You May Enjoy Leave a review - let other readers know what you think
Donate to keep this site alive
How to download source code?
1. Go to: https://github.com/PacktPublishing
2. In the Find a repository… box, search the book title: Hands-On Design Patterns with C# and .NET Core
, sometime you may not get the results, please search the main title.
3. Click the book title in the search results.
3. Click Code to download.
1. Disable the AdBlock plugin. Otherwise, you may not get any links.
2. Solve the CAPTCHA.
3. Click download link.
4. Lead to download server to download.