Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Software Architecture with C# 12 and .NET 8 - Fourth Edition

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

Product type Book
Published in Feb 2024
Publisher Packt
ISBN-13 9781805127659
Pages 756 pages
Edition 4th Edition
Languages
Authors (2):
Gabriel Baptista Gabriel Baptista
Profile icon Gabriel Baptista
Francesco Abbruzzese Francesco Abbruzzese
Profile icon Francesco Abbruzzese
View More author details

Table of Contents (26) Chapters

Preface 1. Understanding the Importance of Software Architecture 2. Non-Functional Requirements 3. Managing Requirements 4. Best Practices in Coding C# 12 5. Implementing Code Reusability in C# 12 6. Design Patterns and .NET 8 Implementation 7. Understanding the Different Domains in Software Solutions 8. Understanding DevOps Principles and CI/CD 9. Testing Your Enterprise Application 10. Deciding on the Best Cloud-Based Solution 11. Applying a Microservice Architecture to Your Enterprise Application 12. Choosing Your Data Storage in the Cloud 13. Interacting with Data in C# – Entity Framework Core 14. Implementing Microservices with .NET 15. Applying Service-Oriented Architectures with .NET 16. Working with Serverless – Azure Functions 17. Presenting ASP.NET Core 18. Implementing Frontend Microservices with ASP.NET Core 19. Client Frameworks: Blazor 20. Kubernetes 21. Case Study 22. Case Study Extension: Developing .NET Microservices for Kubernetes 23. Answers
24. Other Books You May Enjoy
25. Index

Non-Functional Requirements

Once you have gathered the system requirements, it is time to think about the impact they have on the architectural design. Scalability, availability, resiliency, performance, multithreading, interoperability, security, and other aspects need to be analyzed so that we can meet user needs. We refer to these aspects as non-functional requirements.

We will cover the following topics in this chapter:

  • Enabling scalability, availability, and resiliency with Azure and .NET 8
  • Performance issues that need to be considered when programming in C#
  • Software usability: how to design effective user interfaces
  • Interoperability with .NET 8
  • Achieving security by design

The main purpose of discussing non-functional requirements here is that they are highly relevant to software architects: even though they are not so important to getting the software working in terms of functionality, they can make all the difference when comparing...

Technical requirements

The samples provided in this chapter require Visual Studio 2022 Community Edition with the .NET 8 SDK installed.

You can find the sample code for this chapter at https://github.com/PacktPublishing/Software-Architecture-with-C-Sharp-12-and-.NET-8-4E.

Enabling scalability, availability, and resiliency with Azure and .NET 8

A quick search online for a definition of “scalability” returns something along the lines of “the ability of a system to keep working well when there is an increase in demand.” When developers go by this definition, many of them incorrectly conclude that scalability only means adding more hardware to keep things working without stopping their apps.

Scalability relies on hardware solutions to some extent. However, as a software architect, you need to be aware that good software will keep scalability in a sustainable model, which means that well-architected software can save a lot of money. Hence, scalability is not just a matter of hardware but also a matter of overall software design. The point here is that the running costs of a system should also be a factor in architectural decisions.

In Chapter 1, Understanding the Importance of Software Architecture, while discussing software...

Performance issues that need to be considered when programming in C#

Nowadays, C# is one of the most used programming languages in the world, so awareness of C# programming best practices is fundamental for the design of good architectures that satisfy the most common non-functional requirements.

The following sections mention a few simple but effective tips – the associated code samples are available in this book’s GitHub repository. It is worth mentioning that .NET Foundation has developed a library dedicated to benchmarking called BenchmarkDotNet. You may find it useful for your scenarios. Check it out at https://benchmarkdotnet.org/.

String concatenation

This is a classic one! A naive concatenation of strings with the + string operator may cause serious performance issues since every time two strings are concatenated; their contents are copied into a new string.

So, if we concatenate, for instance, 10 strings that have an average length of 100, the...

Software usability: how to design effective user interfaces

As a software architect, you cannot improve the performance of humans, but you can improve the performance of human-machine interaction by designing an effective user interface (UI), that is, a UI that ensures fast interaction with humans, which, in turn, means the following:

  • The UI must be easy to learn to reduce the time that is needed for the target users to learn how to operate it. This constraint is fundamental if UI changes are frequent and for public websites that need to attract the greatest possible number of users.
  • The UI must not cause any kind of slowdown in data insertion; data entry speed must be limited only by the user’s ability to type, not by system delays or additional gestures that could be avoided.
  • Today, we must also consider the accessibility aspects of our solutions since doing so allows us to include more users.

It is worth mentioning that we have UX experts...

Interoperability with .NET 8

Since .NET Core, Microsoft has brought to C# developers the ability to deliver their software to various platforms. And you, as a software architect, need to pay attention to this, considering developing for Linux and macOS as a great opportunity to deliver new features to your customers. Therefore, we need to ensure performance and multi-platform support, two common non-functional requirements for many systems.

Both console applications and web apps designed with .NET 8 in Windows are almost completely compatible with Linux and macOS, too. This means you do not have to build the app again to run it on these platforms.

Microsoft offers scripts to help you install .NET on Linux and macOS. You can find them at https://docs.microsoft.com/dotnet/core/tools/dotnet-install-script. Once you have the SDK installed, you just need to call dotnet the same way you do in Windows.

However, you must be aware of some features that are not fully...

Achieving security by design

As we have seen up to this point in the book, the opportunities and techniques we have for developing software are incredible. If you add all the information you will read about in relation to cloud computing in the next chapters, you will see that the opportunities just increase, as does the complexity involved in maintaining this computing environment.

As a software architect, you must understand that these opportunities come with many responsibilities. The world has changed a lot in recent years. The second decade of the 21st century has required lots of technology. Apps, social media, Industry 4.0, big data, and artificial intelligence are no longer future objectives but current projects that you will lead and deal with within your daily routine. However, the third decade of our century will require much more attention when it comes to cybersecurity.

The world now regulates companies that manage personal data. For instance, the GDPR –...

Summary

Functional requirements that describe system behavior must be complemented with non-functional requirements that constrain system performance, scalability, availability, resilience, interoperability, usability, and security.

Performance requirements come from response time and system load requirements. As a software architect, you should ensure you have the required performance at the minimum cost, building efficient algorithms and taking full advantage of the available hardware resources with multithreading.

Scalability is the ability of a system to be adapted to an increasing load. Systems can be scaled vertically by providing more powerful hardware or horizontally by replicating and load balancing the same hardware, which increases the availability. The cloud, in general, and Azure can help us implement strategies dynamically, with no need to stop your application.

Tools such as .NET 8 that run on several platforms can ensure interoperability, that is, the capability...

Questions

  1. What are the two conceptual ways to scale a system?
  2. Can you deploy your web app automatically from Visual Studio to Azure?
  3. What is multithreading useful for?
  4. What are the main advantages of the asynchronous pattern over other multithreading techniques?
  5. Why is the order of input fields so important?
  6. Why is the Path class so important for interoperability?
  7. What is the advantage of a .NET standard class library?
  8. List the most-used types of .NET Visual Studio projects.
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 2024 Publisher: Packt ISBN-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.
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}