0%

Design scalable and high-performance enterprise applications using the latest features of C# 9 and .NET 5

Key Features

  • Gain fundamental and comprehensive software architecture knowledge and the skillset to create fully modular apps
  • Design high-performance software systems using the latest features of .NET 5 and C# 9
  • Solve scalability problems in web apps using enterprise architecture patterns

Book Description

Software architecture is the practice of implementing structures and systems that streamline the software development process and improve the quality of an app. This fully revised and expanded second edition, featuring the latest features of .NET 5 and C# 9, enables you to acquire the key skills, knowledge, and best practices required to become an effective software architect.

This second edition features additional explanation of the principles of Software architecture, including new chapters on Azure Service Fabric, Kubernetes, and Blazor. It also includes more discussion on security, microservices, and DevOps, including GitHub deployments for the software development cycle.

You will begin by understanding how to transform user requirements into architectural needs and exploring the differences between functional and non-functional requirements. Next, you will explore how to carefully choose a cloud solution for your infrastructure, along with the factors that will help you manage your app in a cloud-based environment.

Finally, you will discover software design patterns and various software approaches that will allow you to solve common problems faced during development.

By the end of this book, you will be able to build and deliver highly scalable enterprise-ready apps that meet your organization's business requirements.

What you will learn

  • Use different techniques to overcome real-world architectural challenges and solve design consideration issues
  • Apply architectural approaches such as layered architecture, service-oriented architecture (SOA), and microservices
  • Leverage tools such as containers, Docker, Kubernetes, and Blazor to manage microservices effectively
  • Get up to speed with Azure tools and features for delivering global solutions
  • Program and maintain Azure Functions using C# 9 and its latest features
  • Understand when it is best to use test-driven development (TDD) as an approach for software development
  • Write automated functional test cases
  • Get the best of DevOps principles to enable CI/CD environments

Who this book is for

This book is for engineers and senior software developers aspiring to become architects or looking to build enterprise applications with the .NET Stack. Basic familiarity with C# and .NET is required to get the most out of this book.

Table of Contents

  1. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Get in touch
  2. Understanding the Importance of Software Architecture
    1. What is software architecture?
    2. Creating an Azure account
    3. Software development process models
    4. Reviewing traditional software development process models
    5. Understanding the waterfall model principles
    6. Analyzing the incremental model
    7. Understanding agile software development process models
    8. Lean software development
    9. Extreme Programming
    10. Getting into the Scrum model
    11. Gathering the right information to design high-quality software
    12. Understanding the requirements gathering process
    13. Detecting exact user needs
    14. Analyzing requirements
    15. Writing the specifications
    16. Understanding the principles of scalability, robustness, security, and performance
    17. Reviewing the specification
    18. Using design techniques as a helpful tool
    19. Design Thinking
    20. Design Sprint
    21. Common cases where the requirements gathering process impacted system results
    22. Case 1 – my website is too slow to open that page!
    23. Understanding caching
    24. Applying asynchronous programming
    25. Dealing with object allocation
    26. Getting better database access
    27. Case 2 – the user's needs are not properly implemented
    28. Case 3 – the usability of the system does not meet user needs
    29. Case study – introducing World Wild Travel Club
    30. Understanding user needs and system requirements
    31. Summary
    32. Questions
    33. Further reading
  3. Non-Functional Requirements
    1. Technical requirements
    2. Enabling scalability, availability, and resiliency with Azure and .NET 5
    3. Creating a scalable web app in Azure
    4. Vertical scaling (Scaling up)
    5. Horizontal scaling (Scaling out)
    6. Creating a scalable web app with .NET 5
    7. Performance issues that need to be considered when programming in C#
    8. String concatenation
    9. Exceptions
    10. Multithreading environments for better results – dos and don'ts
    11. Usability – why inserting data takes too much time
    12. Designing fast selection logic
    13. Selecting from a huge number of items
    14. The fantastic world of interoperability with .NET Core
    15. Creating a service in Linux
    16. Achieving security by design
    17. List of practices for achieving a safe architecture
    18. Authentication
    19. Sensitive data
    20. Web security
    21. Book use case – understanding the main types of .NET Core projects
    22. Summary
    23. Questions
    24. Further reading
  4. Documenting Requirements with Azure DevOps
    1. Technical requirements
    2. Introducing Azure DevOps
    3. Organizing your work using Azure DevOps
    4. Azure DevOps repository
    5. Package feeds
    6. Test plans
    7. Pipelines
    8. Managing system requirements in Azure DevOps
    9. Epic work items
    10. Feature work items
    11. Product Backlog items/User Story work items
    12. Use case – presenting use cases in Azure DevOps
    13. Summary
    14. Questions
    15. Further reading
  5. Deciding the Best Cloud-Based Solution
    1. Technical requirements
    2. Different software deployment models
    3. IaaS and Azure opportunities
    4. Security responsibility in IaaS
    5. PaaS – a world of opportunities for developers
    6. Web apps
    7. SQL Databases
    8. Azure Cognitive Services
    9. SaaS – just sign in and get started!
    10. Understanding what serverless means
    11. Why are hybrid applications so useful in many cases?
    12. Book use case – which is the best cloud solution?
    13. Summary
    14. Questions
    15. Further reading
  6. Applying a Microservice Architecture to Your Enterprise Application
    1. Technical requirements
    2. What are microservices?
    3. Microservices and the evolution of the concept of modules
    4. Microservices design principles
    5. The independence of design choices
    6. Independence from the deployment environment
    7. Loose coupling
    8. No chained requests/responses
    9. Containers and Docker
    10. When do microservices help?
    11. Layered architectures and microservices
    12. The presentation layer
    13. When is it worth considering microservice architectures?
    14. How does .NET deal with microservices?
    15. .NET communication facilities
    16. Resilient task execution
    17. Using generic hosts
    18. Visual Studio support for Docker
    19. Analyzing the Docker file
    20. Publishing the project
    21. Azure and Visual Studio support for microservice orchestration
    22. Which tools are needed to manage microservices?
    23. Defining your private Docker registry in Azure
    24. Summary
    25. Questions
    26. Further reading
  7. Azure Service Fabric
    1. Technical requirements
    2. Visual Studio support for Azure Service Fabric
    3. Defining and configuring your Azure Service Fabric cluster
    4. Step 1 – Basic information
    5. Step 2 – Cluster configuration
    6. Step 3 – Security configuration
    7. Use case – Logging microservices
    8. Ensuring message idempotency
    9. The Interaction library
    10. Implementing the receiving side of communications
    11. Implementing service logic
    12. Defining the microservice's host
    13. Communicating with the service
    14. Testing the application
    15. Summary
    16. Questions
    17. Further reading
  8. Azure Kubernetes Service
    1. Technical requirements
    2. Kubernetes basics
    3. .yaml files
    4. ReplicaSets and Deployments
    5. StatefulSets
    6. Services
    7. Ingresses
    8. Interacting with Azure Kubernetes clusters
    9. Using Kubectl
    10. Deploying the demo Guestbook application
    11. Advanced Kubernetes concepts
    12. Requiring permanent storage
    13. Kubernetes secrets
    14. Liveness and readiness checks
    15. Autoscaling
    16. Helm – Installing an Ingress Controller
    17. Summary
    18. Questions
    19. Further reading
  9. Interacting with Data in C# – Entity Framework Core
    1. Technical requirements
    2. Understanding ORM basics
    3. Configuring Entity Framework Core
    4. Defining DB entities
    5. Defining the mapped collections
    6. Completing the mapping configuration
    7. Entity Framework Core migrations
    8. Understanding stored procedures and direct SQL commands
    9. Querying and updating data with Entity Framework Core
    10. Returning data to the presentation layer
    11. Issuing direct SQL commands
    12. Handling transactions
    13. Deploying your data layer
    14. Understanding Entity Framework Core advanced features
    15. Summary
    16. Questions
    17. Further reading
  10. How to Choose Your Data Storage in the Cloud
    1. Technical requirements
    2. Understanding the different repositories for different purposes
    3. Relational databases
    4. NoSQL databases
    5. Redis
    6. Azure storage accounts
    7. Choosing between structured or NoSQL storage
    8. Azure Cosmos DB – an opportunity to manage a multi-continental database
    9. Creating an Azure Cosmos DB account
    10. Creating an Azure Cosmos container
    11. Accessing Azure Cosmos data
    12. Defining database consistency
    13. The Cosmos DB client
    14. The Cosmos DB Entity Framework Core provider
    15. Use case – storing data
    16. Implementing the destinations/packages database with Cosmos DB
    17. Summary
    18. Questions
    19. Further reading
  11. Working with Azure Functions
    1. Technical requirements
    2. Understanding the Azure Functions app
    3. Consumption plan
    4. Premium plan
    5. App Service plan
    6. Programming Azure functions using C#
    7. Listing Azure Functions templates
    8. Maintaining Azure functions
    9. Use case – Implementing Azure Functions to send emails
    10. First step – Creating Azure Queue storage
    11. Second step – Creating the function to send emails
    12. Third step – Creating the queue trigger function
    13. Summary
    14. Questions
    15. Further reading
  12. Design Patterns and .NET 5 Implementation
    1. Technical requirements
    2. Understanding design patterns and their purpose
    3. Builder pattern
    4. Factory pattern
    5. Singleton pattern
    6. Proxy pattern
    7. Command pattern
    8. Publisher/Subscriber pattern
    9. Dependency Injection pattern
    10. Understanding the available design patterns in .NET 5
    11. Summary
    12. Questions
    13. Further reading
  13. Understanding the Different Domains in Software Solutions
    1. Technical requirements
    2. What are software domains?
    3. Understanding domain-driven design
    4. Entities and value objects
    5. Using SOLID principles to map your domains
    6. Aggregates
    7. The repository and Unit of Work patterns
    8. DDD entities and Entity Framework Core
    9. Command Query Responsibility Segregation (CQRS) pattern
    10. Command handlers and domain events
    11. Event sourcing
    12. Use case – understanding the domains of the use case
    13. Summary
    14. Questions
    15. Further reading
  14. Implementing Code Reusability in C# 9
    1. Technical requirements
    2. Understanding the principles of code reusability
    3. What is not code reuse?
    4. What is code reuse?
    5. Reusability in the development life cycle
    6. Using .NET 5 or .NET Standard for code reuse
    7. Creating a .NET Standard library
    8. How does C# deal with code reuse?
    9. Object-oriented analysis
    10. Generics
    11. What if the code is not reusable?
    12. I have my libraries. How do I promote them?
    13. Documenting .NET libraries using DocFX
    14. Documenting a Web API using Swagger
    15. Use case – reusing code as a fast way to deliver good and safe software
    16. Summary
    17. Questions
    18. Further reading
  15. Applying Service-Oriented Architectures with .NET Core
    1. Technical requirements
    2. Understanding the principles of the SOA approach
    3. SOAP web services
    4. REST web services
    5. Service type compatibility rules
    6. Rest and native HTTP features
    7. Example of methods in the REST language
    8. The OpenAPI standard
    9. REST service authorization and authentication
    10. How does .NET 5 deal with SOA?
    11. SOAP client support
    12. gRPC support
    13. A short introduction to ASP.NET Core
    14. Implementing REST services with ASP.NET Core
    15. ASP.NET Core service authorization
    16. ASP.NET Core support for OpenAPI
    17. .Net Core HTTP clients
    18. Use case – exposing WWTravelClub packages
    19. Summary
    20. Questions
    21. Further reading
  16. Presenting ASP.NET Core MVC
    1. Technical requirements
    2. Understanding the presentation layers of web applications
    3. Understanding the ASP.NET Core MVC structure
    4. How the ASP.NET Core pipeline works
    5. Loading configuration data and using it with the options framework
    6. Defining the ASP.NET Core MVC pipeline
    7. Defining controllers and ViewModels
    8. Understanding Razor Views
    9. Learning the Razor flow of control statements
    10. Understanding Razor View properties
    11. Using Razor tag helpers
    12. Reusing view code
    13. What is new in the latest versions of ASP.NET Core?
    14. Understanding the connection between ASP.NET Core MVC and design principles
    15. Advantages of the ASP.NET Core pipeline
    16. Server-side and client-side validation
    17. ASP.NET Core globalization
    18. The MVC pattern
    19. Use case – implementing a web app in ASP.NET Core MVC
    20. Defining application specifications
    21. Defining the application architecture
    22. Defining the domain layer
    23. Defining the data layer
    24. Defining the application layer
    25. Controllers and views
    26. Summary
    27. Questions
    28. Further reading
  17. Blazor WebAssembly
    1. Technical requirements
    2. Blazor WebAssembly architecture
    3. What is a Single-Page Application?
    4. Loading and starting the application
    5. Routing
    6. Blazor pages and components
    7. Component structure
    8. Templates and cascading parameters
    9. Events
    10. Bindings
    11. How Blazor updates HTML
    12. Component lifecycle
    13. Blazor forms and validation
    14. Blazor advanced features
    15. References to components and HTML elements
    16. JavaScript interoperability
    17. Globalization and localization
    18. Authentication and authorization
    19. Communication with the server
    20. Third-party tools for Blazor WebAssembly
    21. Use case – implementing a simple application in Blazor WebAssembly
    22. Preparing the solution
    23. Implementing the required ASP.NET Core REST APIs
    24. Implementing the business logic in a service
    25. Implementing the user interface
    26. Summary
    27. Questions
    28. Further reading
  18. Best Practices in Coding C# 9
    1. Technical requirements
    2. The more complex your code, the worse a programmer you are
    3. Maintainability index
    4. Cyclomatic complexity
    5. Depth of inheritance
    6. Class coupling
    7. Lines of code
    8. Using a version control system
    9. Dealing with version control systems in teams
    10. Writing safe code in C#
    11. try-catch
    12. try-finally and using
    13. The IDisposable interface
    14. .NET 5 tips and tricks for coding
    15. WWTravelClub – DOs and DON'Ts in writing code
    16. Summary
    17. Questions
    18. Further reading
  19. Testing Your Code with Unit Test Cases and TDD
    1. Technical requirements
    2. Understanding unit and integration tests
    3. Automating unit and integration tests
    4. Writing automated (unit and integration) tests
    5. Writing acceptance and performance tests
    6. Understanding test-driven development (TDD)
    7. Defining C# test projects
    8. Using the xUnit test framework
    9. Advanced test preparation and tear-down scenarios
    10. Mocking interfaces with Moq
    11. Use case – Automating unit tests in DevOps Azure
    12. Connecting to an Azure DevOps repository
    13. Summary
    14. Questions
    15. Further reading
  20. Using Tools to Write Better Code
    1. Technical requirements
    2. Identifying well-written code
    3. Understanding and applying tools that can evaluate C# code
    4. Applying extension tools to analyze code
    5. Using Microsoft Code Analysis 2019
    6. Applying SonarLint for Visual Studio 2019
    7. Checking the final code after analysis
    8. Use case – Evaluating C# code before publishing an application
    9. Summary
    10. Questions
    11. Further reading
  21. Understanding DevOps Principles
    1. Technical requirements
    2. Describing DevOps
    3. Understanding DevOps principles
    4. Defining continuous integration
    5. Understanding continuous delivery with Azure DevOps
    6. Deploying our package-management application with Azure Pipelines
    7. Creating the Azure Web App and the Azure database
    8. Configuring your Visual Studio solution
    9. Configuring Azure Pipelines
    10. Adding a manual approval for the release
    11. Creating a release
    12. The multistage environment
    13. Defining continuous feedback and the related DevOps tools
    14. Monitoring software with Azure Monitor Application Insights
    15. Using the Test and Feedback tool to enable feedback
    16. Understanding SaaS
    17. Adapting your organization to a service scenario
    18. Developing software in a service scenario
    19. Technical implications of a service scenario
    20. Deciding when to adopt a SaaS solution
    21. Preparing a solution for a service scenario
    22. The WWTravelClub project approach
    23. Summary
    24. Questions
    25. Further reading
  22. Challenges of Applying CI Scenarios
    1. Technical requirements
    2. Understanding CI
    3. Continuous Integration and GitHub
    4. Understanding the risks and challenges when using CI
    5. Disabling continuous production deployment
    6. Incomplete features
    7. An unstable solution for testing
    8. Understanding the WWTravelClub project approach
    9. Summary
    10. Questions
    11. Further reading
  23. Automation for Functional Tests
    1. Technical requirements
    2. Understanding the purpose of functional tests
    3. Using unit testing tools to automate functional tests in C#
    4. Testing the staging application
    5. Testing a controlled application
    6. Use case – automating functional tests
    7. Summary
    8. Conclusions
    9. Questions
    10. Further reading
  24. Answers
    1. Chapter 1
    2. Chapter 2
    3. Chapter 3
    4. Chapter 4
    5. Chapter 5
    6. Chapter 6
    7. Chapter 7
    8. Chapter 8
    9. Chapter 9
    10. Chapter 10
    11. Chapter 11
    12. Chapter 12
    13. Chapter 13
    14. Chapter 14
    15. Chapter 15
    16. Chapter 16
    17. Chapter 17
    18. Chapter 18
    19. Chapter 19
    20. Chapter 20
    21. Chapter 21
    22. Chapter 22
  25. Another Book You May Enjoy
  26. Index
18.218.38.125