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

Introducing Azure DevOps

Azure DevOps is a Microsoft Software-as-a-Service (SaaS) platform that enables you to deliver continuous value to your customers. By creating an account there, you will be able to easily plan your project, store your code safely, test it, publish the solution to a staging environment, and then publish the solution to the actual production infrastructure.The automation of all the steps involved in software production ensures the continuous enhancement and improvement of an existing solution to adapt it to market needs.You can start the process accessing https://dev.azure.com. There you will be able to sign in using a new account or even your GitHub account. Once you have access it, you will be asked to create your organization, as you can check in the picture below.

Figure 3.1: Creating Azure DevOps organization.

After the organization is created, you will be able to create a new project, as we can check in the next picture.

Figure 3.2: Creating a project using Azure DevOps

Introducing GitHub Projects

Considering all the benefits presented in Azure DevOps, you may now be asking why we need to explore another tool. The reason is simple: GitHub has become over the years the main tool for open-source world. So, we will find there many initiatives and projects that changed the way we deliver software.The main objective of GitHub is to manage code and guarantee that their users can create solutions in a collaborative way. For this, the platform presents features like version control, pull requests, code reviews, issue tracking, and CI/CD.But it would be impossible to design great projects without a platform to support them. That is why we have GitHub Projects, as an initiative that delivers an adaptable, flexible tool for planning and tracking work on GitHub.It is quite simple to set a Project at GitHub. Once you log-in to the platform, you may find projects at your user menu.

Figure 3.17: Accessing GitHub Projects.

There you will find the option to create...

Summary

This chapter covered how you can create an Azure DevOps or GitHub account for a software development project, and how to start managing your projects with Azure DevOps or GitHub Projects. It also gave a short review of all Azure DevOps functionalities, explaining how to access them through the Azure DevOps main menu.To finish, it presented the GitHub Project View options to plan and manage a project. The chapter also described in more detail how to manage system requirements and how to organize the necessary work with various kinds of work items or issues, along with how to plan and organize sprints that will deliver epic solutions with many features.The decision between Azure DevOps or GitHub in a project varies according to the expertise of the team and the objective of the project itself. If you are designing an open-source solution, for sure GitHub will be a better option. On the other hand, if you are designing an Enterprise Solution, and need everything connected, Azure...

Questions

  1. Is Azure DevOps only available for .NET projects?
  2. What kind of test plans are available in Azure DevOps?
  3. Can DevOps projects use private NuGet packages?
  4. Why do we use work items?
  5. What is the difference between Epics and Features work items?
  6. What kind of relationship exists between Tasks and Product Backlog items/User Story work items?
  7. How GitHub Projects can be useful?
  8. What is the best option: Azure DevOps or GitHub?

.NET 8 tips and tricks for coding

.NET 8 implements some good features that help us to write better code. One of the most useful things for having cleaner code is dependency injection (DI), which will be discussed in Chapter 6, Design Patterns and .NET 8 Implementation. There are some good reasons for considering this. The first one is that you will only need to worry about disposing of the injected objects if you are the creator of them.

Besides, DI enables you to inject ILogger, a useful tool for debugging exceptions that will need to be managed by try-catch statements in your code. Furthermore, programming in C# with .NET 8 must follow the common good practices of any programming language. The following list shows some of these:

  • Classes, methods, and variables should have understandable names: The name should explain everything that the reader needs to know. There should be no need for an explanatory comment unless these declarations are public.
  • Methods should...

Identifying well-written code

It is not easy to identify whether code is well written. The best practices described so far can certainly guide you as a software architect to define a standard for your team. However, even with a standard, mistakes will happen, and you will probably find them only after code is in production. The decision to refactor code in production just because it does not follow all the standards you define is not an easy one to take, especially if the code in question works properly. Some people conclude that well-written code is simply code that works well in production. However, this can surely cause damage to the software’s life since developers might be influenced by that non-standard code.

For this reason, as a software architect, you need to find ways to enforce adherence to the coding standard you’ve defined. Luckily, nowadays, we have many options for tools that can help us with this task. They are called static code analysis tools, and...

Summary

In this chapter, we discussed some important tips for writing safe code. This chapter introduced a tool for analyzing code metrics so that you can manage the complexity and maintainability of the software you develop. To finish, we presented some good tips to guarantee that your software will not crash due to memory leaks and exceptions. In real life, a software architect will always be asked to solve this kind of problem.

The chapter also recommended tools that can be used to apply the best practices of the coding we discussed. We looked at the Roslyn compiler, which enables code analysis while a developer codes.

You will find in Chapter 21, Case Study, a way to evaluate C# code prior to publishing an application, which implements code analysis during the Azure DevOps building process, using SonarCloud.

When you apply all the content you have learned in this chapter to your projects, you will find that code analysis will give you the opportunity to improve the...

Questions

  1. Why do we need to care about maintainability?
  2. What is cyclomatic complexity?
  3. List the advantages of using a version control system.
  4. What is the garbage collector?
  5. What is the importance of implementing the IDisposable interface?
  6. What advantages do we gain from .NET 8 when it comes to coding?
  7. What makes it possible for a piece of software to be described as having well-written code?
  8. What is Roslyn?
  9. What is code analysis?
  10. What is the importance of code analysis?
  11. How does Roslyn help with code analysis?
  12. What are Visual Studio extensions?
  13. What extension tools are available for code analysis?

Further reading

These are some books and websites where you will find more information about the topics of this chapter:

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}