Reader small image

You're reading from  Software Architecture with C# 12 and .NET 8 - Fourth Edition

Product typeBook
Published inFeb 2024
PublisherPackt
ISBN-139781805127659
Edition4th Edition
Right arrow
Authors (2):
Gabriel Baptista
Gabriel Baptista
author image
Gabriel Baptista

Gabriel Baptista has been working with software development since the beginning of .NET. Today, his main contributions are managing numerous projects for retail and industry. He is an Azure Platform-as-a-Service (PaaS) solution specialist, teaches at Computing Engineering universities, and helps tech startups as a mentor.
Read more about Gabriel Baptista

Francesco Abbruzzese
Francesco Abbruzzese
author image
Francesco Abbruzzese

Francesco Abbruzzese dedicates his life to his two great passions: software and powerlifting. He is the author of the MVC Controls Toolkit and the Blazor Controls Toolkit libraries. He has contributed to the diffusion and evangelization of the Microsoft web stack since the first version of ASP.NET. His company, Mvcct Team, offers web applications, tools, and services for web technologies. He has moved from AI systems, where he implemented one of the first decision support systems for financial institutions, to top-10 video game titles such as Puma Street Soccer.
Read more about Francesco Abbruzzese

View More author details
Right arrow

Preface

This book covers the most common design patterns and frameworks involved in modern cloud-based and distributed software architectures. It discusses when and how to use each pattern by providing you with practical, real-world scenarios.

This book also presents techniques and processes such as DevOps, microservices, Kubernetes, continuous integration, and cloud computing so that you can have a best-in-class software solution developed and delivered to your customers.

This book will help you to understand the product that your customer wants from you. It will guide you to deliver and solve the biggest problems you may face during development. It also covers the dos and don’ts that you need to follow when you manage your application in a cloud-based environment. You will learn about different architectural approaches, such as layered architectures, onion architecture, service-oriented architecture, microservices, single-page applications, and cloud architecture, and understand how to apply them to specific business requirements.

Finally, you will deploy code in remote environments or on the cloud using Azure.

All the concepts in this book will be explained with the help of a real-world practical use case where design principles make a world of difference when creating safe and robust applications. By the end of the book, you will be able to develop and deliver highly scalable and secure enterprise-ready applications that meet your end customers’ business needs.

It is also worth mentioning that this book will not only cover the best practices that a software architect should follow for developing C# and .NET Core solutions, but it will also discuss all the environments that you need to master in order to develop a software product based on the latest trends, such as Kubernetes, ASP .NET Core, and Blazor.

This fourth edition has seen improvement in terms of code, level of detail, and explanations and was adapted to the new opportunities offered by C# 12 and .NET 8.

Moreover, we have also added a lot of completely new content, such as a chapter dedicated to the book case study and a chapter dedicated to .NET development for Kubernetes as an extension to the case study, since we use insights from the case study to build on this chapter.

Who this book is for

This book is for engineers and senior developers who are aspiring to become architects or wish to build enterprise applications with the .NET stacks. It is also for any software architect who wishes to improve their knowledge related to enterprise solutions based on .NET and C#. Notably, experience with C# and .NET is required.

What this book covers

Chapter 1, Understanding the Importance of Software Architecture, explains the basics of software architecture. This chapter will help you develop the right mindset to face customer requirements and then select the right tools, patterns, and frameworks.

Chapter 2, Non-Functional Requirements, guides you in an important stage of application development, that is, collecting and accounting for all constraints and goals that the application must fulfill, such as scalability, availability, resiliency, performance, multithreading, interoperability, and security.

Chapter 3, Managing Requirements, describes techniques for managing requirements, bugs, and other information about your applications. While most of the concepts are general, the chapter focuses on the usage of Azure DevOps and GitHub.

Chapter 4, Best Practices in Coding C# 12, describes best practices to be followed when developing .NET 8 applications with C# 12, including metrics that evaluate the quality of your software and how to measure them with the help of all the tools included in Visual Studio.

Chapter 5, Implementing Code Reusability in C# 12, describes patterns and best practices to maximize code reusability in your .NET 8 applications with C# 12. It also discusses the importance of code refactoring.

Chapter 6, Design Patterns and .NET 8 Implementation, describes common software patterns with .NET 8 examples. Here, you will learn the importance of patterns and best practices for using them.

Chapter 7, Understanding the Different Domains in Software Solutions, describes the modern domain-driven design software production methodology and related design patterns and architectures. Here, you will also learn how to use it to face complex applications that require several knowledge domains and how to use it to take advantage of cloud and microservices-based architectures.

Chapter 8, Understanding DevOps Principles and CI/CD, describes the DevOps basis for software development and evolution. Here, you will learn how to organize your application’s continuous integration/continuous delivery cycle, discussing the opportunities and difficulties in reaching this scenario. It also describes how to automate the whole deployment process, from the creation of a new release in your source repository through various testing and approval steps to the final deployment of the application in the actual production environment. Here, you will learn how to use Azure Pipelines and GitHub Actions to automate the whole deployment process.

Chapter 9, Testing Your Enterprise Application, describes how to test your applications, including the various kinds of tests that must be included in the development lifecycle and the test-driven development methodology. Here, you will also learn how to test .NET Core applications with xUnit and see how easily you can develop and maintain code that satisfies your specifications with the help of test-driven design.

Here, you will also learn how to use functional tests to verify automatically whether a version of a whole application conforms to the agreed functional specifications.

Chapter 10, Deciding on the Best Cloud-Based Solution, gives you a wide overview of the tools and resources available in the cloud, and more specifically on Microsoft Azure. Here, you will learn how to search for the right tools and resources and how to configure them to fulfill your needs.

Chapter 11, Applying a Microservice Architecture to Your Enterprise Application, offers a broad overview of microservices and Docker containers. Here, you will learn how the microservices-based architecture takes advantage of all the opportunities offered by the cloud, and you will see how to use microservices to achieve flexibility, high throughput, and reliability in the cloud. You will learn how to use containers and Docker to mix different technologies in your architecture as well as make your software platform independent.

Chapter 12, Choosing Your Data Storage in the Cloud, describes the main storage engines available in the cloud and in Microsoft Azure. Here, you will learn how to choose the best storage engines to achieve the read/write parallelism you need, how to configure them, and how to interact with them from your C# code.

Chapter 13, Interacting with Data in C# – Entity Framework Core, explains in detail how your application can interact with various storage engines with the help of Object-Relational Mappings (ORMs) and, in particular, Entity Framework Core 8.0.

Chapter 14, Implementing Microservices with .NET, describes how to implement a microservice with .NET in practice and how to design communication among microservices. Here, you will learn also how to use the gRPC communication protocol and the RabbitMQ message broker in your .NET projects.

Chapter 15, Applying Service-Oriented Architectures with .NET, describes service-oriented architecture, which enables you to expose the functionalities of your applications as endpoints on the web or on a private network so that users can interact with them through various types of clients. Here, you will learn how to implement service-oriented architecture endpoints with ASP.NET Core and gRPC and how to self-document them with existing OpenAPI packages.

Chapter 16, Working with Serverless – Azure Functions, describes the serverless model of computation and how to use it in the Azure cloud. Here, you will learn how to allocate cloud resources just when they are needed to run some computation, thus paying only for the actual computation time.

Chapter 17, Presenting ASP.NET Core, describes the ASP.NET Core framework in detail. Here, you will learn also how to implement web applications based on the Model-View-Controller (MVC) pattern.

Chapter 18, Implementing Frontend Microservices with ASP.NET Core, is dedicated to frontend microservices, that is, to the microservices that fill the role of interacting with the world outside of the application. Here, you will learn in detail how to implement a frontend microservice based on ASP.NET Core.

Chapter 19, Client Frameworks: Blazor, describes the various client technologies for implementing presentation layers. The chapter focuses on and describes in detail both the browser-based Blazor WebAssembly and the .NET MAUI-based native Blazor. Here, you will learn how to implement single-page applications and native applications in C#.

Chapter 20, Kubernetes, describes Kubernetes, which is a de facto standard for microservices orchestration. Here, you will package and deploy microservices applications on Kubernetes. You will learn how to interact with Azure Kubernetes Service and how to simulate a Kubernetes cluster on your development machine with Minikube.

Chapter 21, Case Study, is dedicated to the book travel agency case study, which shows how technologies and architectural patterns learned in the book can be used in practice in the implementation of a microservice-based enterprise application.

Chapter 22, Case Study Extension: Developing .NET Microservices for Kubernetes, bridges the insights from Chapter 21, Case Study, which explores the practical implementation of .NET microservices, with the foundational knowledge of Kubernetes presented in Chapter 20, Kubernetes.

Answers contains answers to all the questions you can find at the end of all the chapters.

Appendix: Artificial Intelligence and Machine Learning, is an online-only chapter that contains an introduction to artificial intelligence and machine learning. The first part summarizes the basic principles and techniques, while the second part puts them into practice with a description of Azure Machine Learning Studio and a simple example based on ML .NET.

You can read the appendix at the following link: https://static.packt-cdn.com/downloads/9781805127659_Appendix.pdf

To get the most out of this book

  • Do not forget to have Visual Studio Community 2022 or a later version installed.
  • For a deeper understanding of any chapter’s content, feel free to jump to the suggested section of Chapter 21, Case Study.
  • Similarly, before diving into any section of Chapter 21, Case Study, please review the theory discussed in the corresponding suggested chapters.

Download the example code files

The code bundle for the book is hosted on GitHub at https://github.com/PacktPublishing/Software-Architecture-with-C-Sharp-12-and-.NET-8-4E. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://packt.link/gbp/9781805127659.

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. For example: “Mount the downloaded WebStorm-10*.dmg disk image file as another disk in your system.”

A block of code is set as follows:

private static string ParseIntWithTryParse()
{
    string result = string.Empty;
    if (int.TryParse(result, out var value))
        result = value.ToString();
    else
        result = "There is no int value";
    return $"Final result: {result}";
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

private static string ParseIntWithException()
{
    string result = string.Empty;
    try
    {
        result = Convert.ToInt32(result).ToString();
    }
    catch (Exception)
    {
        result = "There is no int value";
    }
    return $"Final result: {result}";

Any command-line input or output is written as follows:

sudo cp sample.service /lib/systemd/system
sudo systemctl daemon-reload
sudo systemctl enable sample

Bold: Indicates a new term, an important word, or words that you see on the screen. For instance, words in menus or dialog boxes appear in the text like this. For example: “Select System info from the Administration panel.”

Warnings or important notes appear like this.

Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: Email feedback@packtpub.com and mention the book’s title in the subject of your message. If you have questions about any aspect of this book, please email us at questions@packtpub.com.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you reported this to us. Please visit http://www.packtpub.com/submit-errata, search for this book, click Submit Errata, and fill in the form.

Piracy: If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at copyright@packtpub.com with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit http://authors.packtpub.com.

Share your thoughts

Once you’ve read Software Architecture with C# 12 and .NET 88, Fourth Edition we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.

Your review is important to us and the tech community and will help us make sure we’re delivering excellent quality content.

Download a free PDF copy of this book

Thanks for purchasing this book!

Do you like to read on the go but are unable to carry your print books everywhere?

Is your eBook purchase not compatible with the device of your choice?

Don’t worry, now with every Packt book you get a DRM-free PDF version of that book at no cost.

Read anywhere, any place, on any device. Search, copy, and paste code from your favorite technical books directly into your application.

The perks don’t stop there, you can get exclusive access to discounts, newsletters, and great free content in your inbox daily.

Follow these simple steps to get the benefits:

  1. Scan the QR code or visit the link below.

https://packt.link/free-ebook/9781805127659

  1. Submit your proof of purchase.
  2. That’s it! We’ll send your free PDF and other benefits to your email directly.
lock icon
The rest of the chapter is locked
You have been reading a chapter from
Software Architecture with C# 12 and .NET 8 - Fourth Edition
Published in: Feb 2024Publisher: PacktISBN-13: 9781805127659
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Authors (2)

author image
Gabriel Baptista

Gabriel Baptista has been working with software development since the beginning of .NET. Today, his main contributions are managing numerous projects for retail and industry. He is an Azure Platform-as-a-Service (PaaS) solution specialist, teaches at Computing Engineering universities, and helps tech startups as a mentor.
Read more about Gabriel Baptista

author image
Francesco Abbruzzese

Francesco Abbruzzese dedicates his life to his two great passions: software and powerlifting. He is the author of the MVC Controls Toolkit and the Blazor Controls Toolkit libraries. He has contributed to the diffusion and evangelization of the Microsoft web stack since the first version of ASP.NET. His company, Mvcct Team, offers web applications, tools, and services for web technologies. He has moved from AI systems, where he implemented one of the first decision support systems for financial institutions, to top-10 video game titles such as Puma Street Soccer.
Read more about Francesco Abbruzzese