Write clean and maintainable code by using reusable solutions to common software design problems.
Author(s): Gaurav Aroraa and Jeffrey Chilberto
Publisher: Packt
Year: 2019
Language: English
Pages: 402
City: Birmingham
Tags: C#, Design Patterns, .NET
Cover
Title Page
Copyright and Credits
Dedication
About Packt
Foreword
Contributors
Table of Contents
Preface
Section 1: Essentials of Design Patterns in C# and .NET Core
Chapter 1: 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
Chapter 2: 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
Chapter 3: 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
Chapter 4: 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
Chapter 5: 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
Chapter 6: 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
Chapter 7: 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
Chapter 8: 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
Chapter 9: 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
Chapter 10: 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
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
Chapter 11: 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
Chapter 12: 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
Index