Discover millions of ebooks, audiobooks, and so much more with a free trial

Only $11.99/month after trial. Cancel anytime.

Software Architecture with C# 10 and .NET 6 – Third Edition: Develop software solutions using microservices, DevOps, EF Core, and design patterns for Azure
Software Architecture with C# 10 and .NET 6 – Third Edition: Develop software solutions using microservices, DevOps, EF Core, and design patterns for Azure
Software Architecture with C# 10 and .NET 6 – Third Edition: Develop software solutions using microservices, DevOps, EF Core, and design patterns for Azure
Ebook1,767 pages11 hours

Software Architecture with C# 10 and .NET 6 – Third Edition: Develop software solutions using microservices, DevOps, EF Core, and design patterns for Azure

Rating: 0 out of 5 stars

()

Read preview

About this ebook

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 third edition, featuring the latest features of .NET 6 and C# 10, enables you to acquire the key skills, knowledge, and best practices required to become an effective software architect.

Software Architecture with C# 10 and .NET 6, Third Edition features new chapters that describe the importance of the software architect, microservices with ASP.NET Core, and analyzing the architectural aspects of the front-end in the applications, including the new approach of .NET MAUI. It also includes a new chapter focused on providing a short introduction to artificial intelligence and machine learning using ML.NET, and updated chapters on Azure Kubernetes Service, EF Core, and Blazor.

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 choose a cloud solution for your infrastructure, taking into account the factors that will help you manage a cloud-based app successfully. Finally, you will analyze and implement software design patterns that will allow you to solve common development problems.

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

LanguageEnglish
Release dateMar 15, 2022
ISBN9781803245959
Software Architecture with C# 10 and .NET 6 – Third Edition: Develop software solutions using microservices, DevOps, EF Core, and design patterns for Azure

Related to Software Architecture with C# 10 and .NET 6 – Third Edition

Related ebooks

Software Development & Engineering For You

View More

Related articles

Reviews for Software Architecture with C# 10 and .NET 6 – Third Edition

Rating: 0 out of 5 stars
0 ratings

0 ratings0 reviews

What did you think?

Tap to rate

Review must be at least 10 words

    Book preview

    Software Architecture with C# 10 and .NET 6 – Third Edition - Gabriel Baptista

    cover.png

    Software Architecture with C# 10 and .NET 6

    Third Edition

    Develop software solutions using microservices, DevOps, EF Core, and design patterns for Azure

    Gabriel Baptista

    Francesco Abbruzzese

    BIRMINGHAM—MUMBAI

    Software Architecture with C# 10 and .NET 6

    Third Edition

    Copyright © 2022 Packt Publishing

    All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

    Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.

    Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

    Producer: Suman Sen

    Acquisition Editor – Peer Reviews: Saby Dsilva

    Project Editor: Parvathy Nair

    Content Development Editors: Alex Patterson, Georgia Daisy van der Post

    Copy Editor: Safis Editing

    Technical Editor: Aniket Shetty

    Proofreader: Safis Editing

    Indexer: Subalakshmi Govindhan

    Presentation Designer: Pranit Padwal

    First published: November 2019

    Second edition: December 2020

    Third edition: March 2022

    Production reference: 2020622

    Published by Packt Publishing Ltd.

    Livery Place

    35 Livery Street

    Birmingham

    B3 2PB, UK.

    ISBN 978-1-80323-525-7

    www.packt.com

    Contributors

    About the authors

    Gabriel Baptista is a tech manager who leads a great variety of teams across a diverse range of projects using the Microsoft platform for industry and retail. He is an Azure specialist, responsible for architecting a SaaS platform in partnership with Microsoft. In addition, he is a computing professor, having published many papers, and taught subjects concerning software engineering, development, and architecture. He has also spoken at a great number of tech conferences all over the world over recent years. Moreover, he co-founded SMIT, a software development company, and SmartLoad, the first cargo mobility insurtech in Brazil.

    To my kids, Murilo and Heitor, and my beloved wife, Denise, who have always been by my side. To my friend Francesco, who is always bringing new ideas to our book! And a special thanks to the Packt Team, that supported this incredible new edition of the book.

    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.

    To my beloved brother, Luciano, who saved my life during my fight against a Covid pneumonia. And a special thanks to the entire Packt team, and to the reviewers who contributed to improving the overall content.

    About the reviewers

    João Antunes works as a software engineer, focused on software architecture, design, and development. With over 10 years of professional experience, João specializes in .NET and related technologies, but keeps up with other relevant technologies and industry trends.

    João is active on his blog and YouTube channel (Coding Militia), where he discusses software development and related topics.

    Dave Brock is a development lead with experience in the architecture, design, and development of distributed, cloud-native applications. He was awarded a master’s degree in Software Engineering from DePaul University. With a focus on Microsoft technologies such as .NET and Azure, Dave writes regularly at daveabrock.com and has been awarded a Microsoft MVP award for his community contributions. When not reviewing books, he resides in Madison, Wisconsin, and enjoys hiking, playing guitar, and, of course, is a proud dad to his two wonderful children, Emma and Colin.

    Join our book’s Discord space

    Join the book’s Discord workspace for a Ask me Anything session with the authors:

    https://packt.link/SAcsharp10dotnet6

    Contents

    Preface

    Who this book is for

    What this book covers

    To get the most out of this book

    Get in touch

    Understanding the Importance of Software Architecture

    What is software architecture?

    Creating an Azure account

    Software development process models

    Reviewing traditional software development process models

    Understanding the waterfall model principles

    Analyzing the incremental model

    Understanding agile software development process models

    Lean software development

    Extreme Programming

    Getting into the Scrum model

    Scaling agile throughout a company

    Gathering the right information to design high-quality software

    Understanding the requirements gathering process

    Detecting exact user needs

    Analyzing requirements

    Writing the specifications

    Understanding the principles of scalability, robustness, security, and performance

    Reviewing the specification

    Using design techniques as a helpful tool

    Design Thinking

    Design Sprint

    Common cases where the requirements gathering process impacts system results

    Case 1 – my website is too slow to open that page!

    Understanding backend caching

    Applying asynchronous programming

    Dealing with object allocation

    Getting better database access

    Case 2 – the user’s needs are not properly implemented

    Case 3 – the usability of the system does not meet the user’s needs

    Case study – introducing World Wild Travel Club

    Understanding user needs and system requirements

    Summary

    Questions

    Further reading

    Non-Functional Requirements

    Technical requirements

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

    Creating a scalable web app in Azure

    Vertical scaling (scaling up)

    Horizontal scaling (scaling out)

    Creating a scalable web app with .NET 6

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

    String concatenation

    Exceptions

    Multithreading environments for better results – dos and don’ts

    Usability – why inserting data takes too much time

    Designing fast selection logic

    Selecting from a huge number of items

    The fantastic world of interoperability with .NET 6

    Creating a service in Linux

    Achieving security by design

    List of practices for achieving a safe architecture

    Authentication

    Sensitive data

    Web security

    Book use case – understanding the main types of .NET projects

    Summary

    Questions

    Further reading

    Documenting Requirements with Azure DevOps

    Technical requirements

    Introducing Azure DevOps

    Organizing your work using Azure DevOps

    Azure DevOps repository

    Package feeds

    Test Plans

    Pipelines

    Managing system requirements in Azure DevOps

    Epic work items

    Feature work items

    Product Backlog items/User Story work items

    Use case – presenting use cases in Azure DevOps

    Summary

    Questions

    Further reading

    Deciding on the Best Cloud-Based Solution

    Technical requirements

    Different software deployment models

    IaaS and Azure opportunities

    Security responsibility in IaaS

    PaaS – a world of opportunities for developers

    Web apps

    SQL databases

    Azure Cognitive Services

    SaaS – just sign in and get started!

    Understanding what serverless means

    Why are hybrid applications so useful in many cases?

    Book use case – which is the best cloud solution?

    Summary

    Questions

    Further reading

    Applying a Microservice Architecture to Your Enterprise Application

    Technical requirements

    What are microservices?

    Microservices and the evolution of the concept of modules

    Microservices design principles

    The independence of design choices

    Independence from the deployment environment

    Loose coupling

    No chained requests/responses

    Containers and Docker

    When do microservices help?

    Layered architectures and microservices

    The presentation layer

    When is it worth considering microservice architectures?

    How does .NET deal with microservices?

    .NET communication facilities

    Resilient task execution

    Using generic hosts

    Visual Studio support for Docker

    Analyzing the Docker file

    Publishing the project

    Azure and Visual Studio support for microservice orchestration

    Which tools are needed to manage microservices?

    Defining your private Docker registry in Azure

    Summary

    Questions

    Further reading

    Azure Kubernetes Service

    Technical requirements

    Kubernetes basics

    .yaml files

    ReplicaSets and Deployments

    StatefulSets

    Services

    Ingresses

    Interacting with Azure Kubernetes clusters

    Using Kubectl

    Deploying the demo Guestbook application

    Advanced Kubernetes concepts

    Requiring permanent storage

    Kubernetes secrets

    Liveness and readiness checks

    Autoscaling

    Helm – Installing an Ingress Controller

    Summary

    Questions

    Further reading

    Interacting with Data in C# – Entity Framework Core

    Technical requirements

    Understanding ORM basics

    Configuring Entity Framework Core

    Defining DB entities

    Defining the mapped collections

    Completing the mapping configuration

    Entity Framework Core migrations

    Understanding stored procedures and direct SQL commands

    Compiled models

    Querying and updating data with Entity Framework Core

    Returning data to the presentation layer

    Issuing direct SQL commands

    Handling transactions

    Deploying your data layer

    Understanding Entity Framework Core advanced features

    Summary

    Questions

    Further reading

    How to Choose Your Data Storage in the Cloud

    Technical requirements

    Understanding the different repositories for different purposes

    Relational databases

    NoSQL databases

    Redis

    Azure storage accounts

    Choosing between SQL or NoSQL document-oriented databases

    Azure Cosmos DB – an opportunity to manage a multi-continental database

    Creating an Azure Cosmos DB account

    Creating an Azure Cosmos container

    Accessing Azure Cosmos data

    Defining database consistency

    The Cosmos DB client

    The Cosmos DB Entity Framework Core provider

    Use case – storing data

    Implementing the destinations/packages database with Cosmos DB

    Summary

    Questions

    Further reading

    Working with Azure Functions

    Technical requirements

    Understanding the Azure Functions app

    Consumption plan

    Premium plan

    App Service plan

    Programming Azure Functions using C#

    Listing Azure Functions templates

    Maintaining Azure Functions

    Azure Durable Functions

    Azure Functions roadmap

    Use case – Implementing Azure Functions to send emails

    First step – Creating Azure queue storage

    Second step – Creating the function to send emails

    Third step – Creating the queue trigger function

    Summary

    Questions

    Further reading

    Design Patterns and .NET 6 Implementation

    Technical requirements

    Understanding design patterns and their purpose

    Builder pattern

    Factory pattern

    Singleton pattern

    Proxy pattern

    Command pattern

    Publisher/Subscriber pattern

    Dependency Injection pattern

    Understanding the available design patterns in .NET 6

    Summary

    Questions

    Further reading

    Understanding the Different Domains in Software Solutions

    Technical requirements

    What are software domains?

    Understanding domain-driven design

    Entities and value objects

    Layers and the Onion architecture

    Aggregates

    The repository and Unit of Work patterns

    DDD entities and Entity Framework Core

    Command Query Responsibility Segregation (CQRS) pattern

    Command handlers and domain events

    Event sourcing

    Use case – understanding the domains of the use case

    Summary

    Questions

    Further reading

    Implementing Code Reusability in C# 10

    Technical requirements

    Understanding the principles of code reusability

    What is not code reuse?

    What is code reuse?

    Reusability in the development life cycle

    Using .NET 6 for code reuse

    Creating a reusable class library

    How does C# deal with code reuse?

    Object-oriented analysis

    Generics

    What if the code is not reusable?

    I have my libraries. How do I promote them?

    Documenting .NET libraries using DocFX

    Documenting a Web API using Swagger

    Use case – reusing code as a fast way to deliver good and safe software

    Summary

    Questions

    Further reading

    Applying Service-Oriented Architectures with .NET

    Technical requirements

    Understanding the principles of the SOA approach

    SOAP web services

    SOAP specifications

    Difficulties associated with the standard

    REST web services

    Service type compatibility rules

    REST and native HTTP features

    Example of methods in the REST language

    The OpenAPI standard

    REST service authorization and authentication

    How does .NET 6 deal with SOA?

    SOAP client support

    gRPC support

    A short introduction to ASP.NET Core

    Implementing REST services with ASP.NET Core

    ASP.NET Core service authorization

    ASP.NET Core support for OpenAPI

    .NET HTTP clients

    Use case – exposing WWTravelClub packages

    Summary

    Questions

    Further reading

    Implementing Microservices with .NET

    Technical requirements

    Communication and data serialization

    Efficient and flexible binary serialization

    The ProtoBuf language

    ProtoBuf serialization

    Efficient and flexible RPC

    Reliable data-driven asynchronous communication

    Distributed transactions

    Implementing worker microservices with ASP.NET core

    The problem and the architecture

    The storage layer

    The application layer

    Processing the queued requests

    Testing the GrpcMicroservice project with a fake purchase requests generator

    Implementing microservices with .NET worker services and message brokers

    Installing RabbitMQ

    RabbitMQ basics

    Replacing internal queues with RabbitMQ

    Summary

    Questions

    Further reading

    Presenting ASP.NET Core MVC

    Technical requirements

    Understanding the presentation layers of web applications

    Understanding the basics of ASP.NET Core

    ASP.NET Core middleware

    Loading configuration data and using it with the options framework

    Defining the ASP.NET Core pipeline

    Defining controllers and ViewModels

    Understanding how ASP.NET Core MVC creates the response HTML

    Razor Views

    Learning the Razor flow of control statements

    Understanding Razor View properties

    Using Razor tag helpers

    Reusing view code

    Understanding the connection between ASP.NET Core MVC and design principles

    Advantages of the ASP.NET Core pipeline

    Server-side and client-side validation

    ASP.NET Core globalization

    The MVC pattern

    Summary

    Questions

    Further reading

    Implementing Frontend Microservices with ASP.NET Core

    Technical requirements

    Frontends and micro-frontends

    Public web APIs

    HTML micro-frontends

    Application specifications and architecture

    Defining application specifications

    Defining the application architecture

    Defining the domain layer abstraction

    Defining the data layer

    Defining the application layer

    Defining controllers and views

    Summary

    Further reading

    Blazor WebAssembly

    Technical requirements

    Blazor WebAssembly architecture

    What is a single-page application?

    Loading and starting the application

    Routing

    Blazor pages and components

    Component structure

    Templates and cascading parameters

    Error handling

    Events

    Bindings

    How Blazor updates HTML

    Component lifecycle

    Blazor forms and validation

    Modifying HTML content from Blazor components

    Blazor advanced features

    References to components and HTML elements

    JavaScript interoperability

    Globalization and localization

    Authentication and authorization

    Communication with the server

    AOT compilation

    Third-party tools for Blazor WebAssembly

    Use case – implementing a simple application in Blazor WebAssembly

    Preparing the solution

    Implementing the required ASP.NET Core REST APIs

    Implementing the business logic in a service

    Implementing the user interface

    Summary

    Questions

    Further reading

    Native versus Web Clients

    Technical requirements

    Technologies focused on native development

    Windows Forms

    Windows Presentation Foundation (WPF)

    Xamarin

    Technologies focused on web development

    Progressive web applications

    Cross-platform technologies

    Xamarin.Forms

    .NET MAUI

    A first look at .NET MAUI

    .NET MAUI Blazor applications

    Summary

    Questions

    Further reading

    Artificial Intelligence and Machine Learning

    Technical requirements

    Introduction to AI and machine learning

    Classification of the most common artificial intelligence techniques

    Heuristic search

    First-order calculus

    Planners

    Heuristic rules, neural networks, and Bayesian networks

    Truth maintenance systems

    What is machine learning and why does it work?

    Machine learning basics

    How many examples do I need to learn my function?

    Learning smooth functions

    Neural networks

    The support vector algorithm

    Learning small computer programs: induction-based learning

    From theory to practice: the role of a software architect in an ML project

    Step 1 – Define your goal

    Step 2 – Provide and prepare data

    Step 3 – Train, tune, and deploy your model

    Step 4 – Test the trained model and feed back on it

    ML.NET – Machine learning made for .NET

    ML.NET Model Builder

    Summary

    Questions

    Further reading

    Best Practices in Coding C# 10

    Technical requirements

    The simpler your code, the better a programmer you are

    Maintainability index

    Cyclomatic complexity

    Depth of inheritance

    Class coupling

    Number of lines of code

    Using a version control system

    Dealing with version control systems in teams

    Writing safe code in C#

    try-catch

    try-finally and using

    The IDisposable interface

    .NET 6 tips and tricks for coding

    Identifying well-written code

    Understanding and applying tools that can evaluate C# code

    Applying extension tools to analyze code

    Applying SonarAnalyzer

    Checking the final code after analysis

    Applying this chapter to the WWTravelClub sample project

    WWTravelClub – DOs and DON’Ts in writing code

    WWTravelClub – Evaluating C# code before publishing an application

    Summary

    Questions

    Further reading

    Understanding DevOps Principles

    Technical requirements

    Describing DevOps

    Understanding DevOps principles

    Defining continuous integration

    Understanding continuous delivery with Azure DevOps

    Creating the Azure Web App and the Azure database

    Configuring your Visual Studio solution

    Configuring Azure Pipelines

    Adding a manual approval for the release

    Creating a release

    The multistage environment

    Defining continuous feedback and the related DevOps tools

    Monitoring software with Application Insights

    Using the Test and Feedback tool to enable feedback

    Understanding SaaS

    Adapting your organization to a service scenario

    Developing software in a service scenario

    Technical implications of a service scenario

    Deciding when to adopt a SaaS solution

    Preparing a solution for a service scenario

    The WWTravelClub project approach

    Summary

    Questions

    Further reading

    Challenges of Applying CI & CD Scenarios

    Technical requirements

    Understanding CI/CD

    CI/CD and GitHub

    Understanding the risks and challenges when using CI/CD

    Disabling continuous production deployment

    Incomplete features

    An unstable solution for testing

    Understanding the WWTravelClub project approach

    Summary

    Questions

    Further reading

    Testing Your Enterprise Application

    Technical requirements

    Understanding unit and integration tests

    Automating unit and integration tests

    Writing automated (unit and integration) tests

    Acceptance tests: writing functional and performance tests

    Understanding test-driven development

    Functional tests

    Defining C# test projects in Visual Studio

    Using the xUnit test framework

    Advanced test preparation and tear-down scenarios

    Mocking interfaces with Moq

    Automating functional tests in C#

    Testing the staging application

    Testing the staging application with Selenium

    Testing a controlled application

    Use case – automating unit and functional tests

    Automating functional tests

    Connecting to an Azure DevOps repository

    Summary

    Questions

    Further reading

    Answers

    Other Books You May Enjoy

    Index

    Landmarks

    Cover

    Index

    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 for 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 can face during development. It also covers the do’s 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 architecture, 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 real-world practical use cases where design principles make the 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 the end customers’ business needs.

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

    This third edition was improved in terms of code and explanations, and was adapted to the new opportunities offered by C# 10 and .Net 6.

    Moreover, we also added a lot of completely new content, including a complete description of gRPC usage in .NET projects, more focus on portable microservices with a chapter dedicated to the .NET implementation of worker microservices, and another one dedicated to the ASP.NET core implementation of frontend microservices. We also explained how to interact with the RabbitMQ message broker form .NET.

    We also added a short introduction to artificial intelligence and machine learning using ML.NET, and a chapter on native clients that also includes a preliminary description of .NET MAUI preview.

    Who this book is for

    This book is for any software architect who wishes to improve their knowledge related to Azure Solutions with C#.NET. It is also for engineers and senior developers who are aspiring to become architects or wish to build enterprise applications with the .NET stacks. 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 give you 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, Documenting Requirements with Azure DevOps, describes techniques for documenting 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, Deciding on the Best Cloud-Based Solution, gives you a wide overview of the tools and resources available in the cloud, and 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 5, 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 6, Azure Kubernetes Service, describes the Azure implementation of Kubernetes, which is a de facto standard for microservices orchestration. Here you will package and deploy microservices applications on Kubernetes.

    Chapter 7, 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, with Entity Framework Core 6.0.

    Chapter 8, How to Choose 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 9, Working with 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 10, Design Patterns and .NET 6 Implementation, describes common software patterns with .NET 6 examples. Here, you will learn the importance of patterns and best practices for using them.

    Chapter 11, Understanding the Different Domains in Software Solutions, describes the modern domain-driven design software production methodology, and related design patterns and architectures. There 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 12, Implementing Code Reusability in C# 10, describes patterns and best practices to maximize code reusability in your .NET 6 applications with C# 10. It also discusses the importance of code refactoring.

    Chapter 13, 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 Open API packages.

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

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

    Chapter 16, 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. There, you will learn how to implement a frontend microservice based on ASP.NET Core with the help of a complete and detailed example.

    Chapter 17, Blazor WebAssembly, describes the new Blazor framework that leverages the power of WebAssembly to run .NET in the user browser. Here you will learn how to implement single-page applications in C#.

    Chapter 18, Native versus Web Clients, describes the various technologies for implementing native clients available in the .NET world. It also contains a preliminary introduction to .NET MAUI which, at the time the book was published, is still in preview.

    Chapter 19, Artificial Intelligence and Machine Learning, 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.

    Chapter 20, Best Practices in Coding C# 10, describes best practices to be followed when developing .NET 6 applications with C# 10, 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 21, Understanding DevOps Principles, describes the DevOps basis for software development and evolution. Here, you will learn how to organize your application’s continuous integration/continuous delivery cycle. 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 22, Challenges of Applying CI & CD Scenarios, complements the description of DevOps by discussing the opportunities and difficulties in achieving a continuous integration and continuous deployment scenario.

    Chapter 23, Testing Your Enterprise Application, describes how to test your applications. Here, you will 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 automatically verify whether a version of a whole application conforms to the agreed functional specifications.

    To get the most out of this book

    In order to get the most out of this book, it is worth bearing the following in mind:

    This book covers many subjects. View it as a guide that you may want to revisit many times for different circumstances.

    Do not forget to have Visual Studio Community 2022 or higher installed.

    Be sure that you understand C# .NET principles.

    Download the example code files

    The code bundle for the book is hosted on GitHub at https://github.com/PacktPublishing/Software-Architecture-with-C-10-and-.NET-6-3E. 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://static.packt-cdn.com/downloads/9781803235257_ColorImages.pdf.

    Conventions used

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

    CodeInText

    : Indicates code words in the text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. For example: "The

    IServiceCollection

    interface implemented by

    builder.Services

    defines all services that can be injected into object constructors through DI."

    A block of code is set as follows:

    [

    Fact

    ]

    public

    void

    Test1

    ()

    {

    var

    myInstanceToTest =

    new

    ClassToTest(); Assert.Equal(

    5

    , myInstanceToTest.MethodToTest(

    1

    )); }

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

    kubectl apply -f myClusterConfiguration.yaml

    Bold: Indicates a new term, an important word, or words that you see on the screen, for example, in menus or dialog boxes, also appear in the text like this. For example: "In the Git Changes tab, click the Create Git Repository button."

    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

    [email protected]

    , 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

    [email protected]

    .

    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 would report this to us. Please visit, http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

    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

    [email protected]

    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# 10 and .NET 6, Third 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.

    1

    Understanding the Importance of Software Architecture

    Software architecture is one of the most discussed topics in the software industry today, and its importance will certainly grow more in the future. The more we build complex and fantastic solutions, the more we need great software architectures to maintain them. But the speed at which new features are added to these software solutions keeps increasing, and new architectural opportunities keep emerging. That is the reason why you decided to read this book, and this is the reason why we decided to write its third edition. We have included in this new edition not only the differences between C# 9 and C# 10, but also more information about microservices with ASP.NET Core, more details about how to use Azure Functions, more information about native versus web clients, machine learning, and much more! We hope you all enjoy this new journey!

    It is not a simple task to write about this important topic, which offers so many alternative techniques and solutions. The main objective of this book is not to build an exhaustive and never-ending list of available techniques and solutions, but to show how various families of techniques are related, and how they impact, in practice, the construction of a maintainable and sustainable solution.

    The need to keep our focus on creating actually effective enterprise solutions continuously increases; users always need more new features in their applications. Moreover, the need to deliver frequent application versions (due to a quickly changing market) increases our obligation to have sophisticated software architecture and development techniques.

    The following topics will be covered in this chapter:

    What software architecture is

    Some software development process models that may help you as a software architect

    The process for gathering the right information to design high-quality software

    Design techniques for helping in the process of development

    Cases where the requirements impact the system results

    An introduction to the case study of the book

    The case study of this book will take you through the process of creating the software architecture for a travel agency called World Wild Travel Club (WWTravelClub). The purpose of this case study is to help you understand the theory explained in each chapter, and to provide an example of how to develop an enterprise application with Azure, Azure DevOps, C# 10, .NET 6, ASP.NET Core, and other technologies that will be introduced in this book.

    By the end of this chapter, you will understand exactly what the mission of software architecture is. You will also learn what Azure is, and how to create your account on the platform. You will also get an overview of software processes, models, and other techniques that will enable you to manage your team.

    What is software architecture?

    For the fact that you are reading this book today, you should thank the computer scientists who decided to consider software development as an engineering area. This happened in the last century, more specifically, at the end of the sixties, when they proposed that the way we develop software is quite like the way we construct buildings. That is why we have the name software architecture. Just as an architect designs a building and oversees its construction based on that design, the main goal of a software architect is to ensure that the software application is implemented well; and good implementation requires the design of a great solution.

    In a professional development project, you must do the following things:

    Define the customer requirements for the solution

    Design a great solution to meet those requirements

    Implement the designed solution

    Validate the solution with your customer

    Deliver the solution in the working environment

    Software engineering defines these activities as the software development life cycle. All the theoretical software development process models (waterfall, spiral, incremental, agile, and so on) are somehow related to this cycle. No matter which model you use, if you do not perform the essential tasks in the initial stages of your project, you will not deliver acceptable software as a solution.

    The main point about designing great solutions is foundational to the purpose of this book. You must understand that great real-world solutions bring with them a few fundamental constraints:

    The solution needs to meet user requirements

    The solution needs to be delivered on time

    The solution needs to adhere to the project budget

    The solution needs to deliver good quality

    The solution needs to guarantee safe and effective future evolution

    Great solutions need to be sustainable, and you must understand that there is no sustainable software without great software architecture. Nowadays, great software architectures depend on both modern tools and modern environments to perfectly fit users’ requirements.

    For this reason, this book will use some great tools provided by Microsoft. After three editions, we finally have .NET 6, the LTS version announced as a unified platform for software development, which gives us a great opportunity to create fantastic solutions.

    .NET MAUI supported platforms.

    Figure 1.1: .NET 6 platform

    .NET 6 is delivered together with C# 10. Considering the .NET approach of targeting so many platforms and devices, C# is now one of the most used programming languages in the world and runs on everything from small devices up to huge servers in different operating systems and environments.

    The book will also use Azure, which is Microsoft’s cloud platform, where you will find all the components the company provides to build advanced software architecture solutions. One of them is Azure DevOps, an application life cycle management environment where you can build solutions using the latest approach for developing software. GitHub is also discussed in this edition since Microsoft has improved its integration with Azure.

    It is worth mentioning that the use of .NET 6 with Azure was just an option chosen by the authors. .NET can work just as well using other cloud providers, and Azure can handle very well other coding frameworks.

    To be a software architect, you need to be familiar with these technologies, and a lot of others, too. This book will guide you on a journey where, as a software architect working in a team, you will learn how to provide optimal solutions using these tools. Let us start this journey by creating your Azure account.

    Creating an Azure account

    Microsoft Azure is one of the best cloud solutions currently available on the market. It is important to know that, inside Azure, we will find a selection of components that can help us define the architecture of twenty-first-century solutions.

    If you want to check Azure’s current state, structure, and updates in a compact, digestible way, just go to https://azurecharts.com/, developed by Alexey Polkovnikov. The content is continuously updated so you can revisit it to learn, evaluate, or even just have fun with the dozens of Azure components described in this Azure encyclopedia.

    This subsection will guide you in creating an Azure account. If you already have one, you can skip this part.

    Go to https://azure.microsoft.com. There, you will find the information you need to start your subscription. Translation to your native language is usually set automatically:

    Once you have accessed this portal, it is possible to sign up. If you have never done this before, it is possible to Start free, so you will be able to use some Azure features without spending any money. Please check the options for free plans at https://azure.microsoft.com/free/.

    The process for creating a free account is quite simple, and you will be guided by a form that requires you to have a Microsoft account or GitHub account.

    During the process, you will also be asked for a credit card number, to verify your identity and to keep out spam and bots. However, you will not be charged unless you upgrade the account.

    To finish the assignment, you will need to accept the subscription agreement, offer details, and privacy statement.

    Once you finish the form, you will be able to access the Azure portal. As you can see in the following screenshot, the panel shows a dashboard that you can customize, and a menu on the left, where you can set up the Azure components you are going to use in your solution. Throughout this book, we will come back to this screen to set up the components needed to help us create modern software architecture. To find the next page, just select the hamburger menu icon and click on All services.

    Interface gráfica do usuário, Aplicativo Descrição gerada automaticamente

    Figure 1.2: The Azure portal

    Once you have created your Azure account, you are ready to find out how a software architect can manage a team to develop software, taking advantage of all the opportunities offered by Azure. However, it is important to keep in mind that a software architect needs to go beyond just technologies because they are expected to define how the software will be delivered.

    Today, a software architect not only architects the basis of a piece of software but also determines how the whole software development and deployment process is conducted. The next section will cover some of the most widely used software development paradigms in the world. We will start by describing what the community refers to as traditional software engineering. After that, we will cover the agile models that have changed the way we build software nowadays.

    Software development process models

    As a software architect, it is important for you to understand some of the common development processes that are currently used in most enterprises. A software development process defines how people in a team produce and deliver software. In general, this process relates to a software engineering theory, called a software development process model. Ever since software development was first defined as an engineering process, many process models for developing software have been proposed. Let us review the traditional software models, and then look at the agile ones that are currently common.

    Reviewing traditional software development process models

    Some of the models introduced in software engineering theory are already considered traditional and more or less obsolete. This book does not aim to cover all of them, but here, we will give a brief explanation of the ones that are still used in some companies – the waterfall and incremental models.

    Understanding the waterfall model principles

    This topic may appear strange in a software architecture book from 2022, but yes, you may still find companies where the most traditional software process model remains the guideline for software development. This process executes all fundamental tasks in sequence. Any software development project consists of the following steps:

    Requirements, where a product requirements document is created, and it is the basis for the software development process

    Design, where the software architecture is developed according to the requirements

    Implementation, where the software is programmed

    Verification, where tests are performed in the application

    Maintenance, where the cycle starts again, after a delivery

    Let us look at a diagrammatic representation of this:

    D:\Neha\OFFICE\CME\PEN\Epub to Word sty\B16756_EPUB\B16756_EPUB\OEBPS\Images\B16756_01_03.png

    Figure 1.3: The waterfall development cycle (https://en.wikipedia.org/wiki/Waterfall_model)

    Often, the use of waterfall models causes problems such as delays in the delivery of a functional version of the software and user dissatisfaction due to the distance between expectations and the final product delivered. Besides, in my experience, having application tests start only after the completion of development always feels terribly stressful.

    Analyzing the incremental model

    Incremental development is an approach that tries to overcome the biggest problem of the waterfall model: the user can test the solution only at the end of the project. The idea of this model is to give the users opportunities to interact with the solution as early as possible so that they can give useful feedback, which will help during the development of the software.

    D:\Neha\OFFICE\CME\PEN\Epub to Word sty\B16756_EPUB\B16756_EPUB\OEBPS\Images\B16756_01_04.png

    Figure 1.4: The incremental development cycle (https://en.wikipedia.org/wiki/Incremental_build_model)

    The incremental model presented in the preceding picture was introduced as an alternative to the waterfall approach. The idea of the model is to run for each increment a set of practices related to software development (communication, planning, modeling, construction, and deployment). Although it mitigated problems related to the lack of communication with the customer, for big projects, fewer increments were still a problem because the increments were still too long.

    When the incremental approach was used on a large scale—mainly at the end of the last century—many problems related to project bureaucracy were reported, due to the large amount of documentation required. This clunky scenario caused the rise of a very important movement in the software development industry – agile.

    Understanding agile software development process models

    At the beginning of this century, developing software was considered one of the most chaotic activities in engineering. The percentage of software projects that failed was incredibly high, and this fact proved the need for a different approach to deal with the flexibility required by software development projects.

    In 2001, the Agile Manifesto was introduced to the world, and from that time forward various agile process models were proposed. Some of them have survived up until now and are still very common.

    The Agile Manifesto has been translated into more than 60 languages. You can check it out at https://agilemanifesto.org/.

    One of the biggest differences between agile models and traditional models is the way developers interact with the customer. The message behind all agile models is that the faster you deliver software to the user, the better. This idea is sometimes confusing for software developers who understand this as – Let’s try coding, and that’s all, folks!

    However, there is an important observation of the Agile Manifesto that many people do not read when they start working with agile:

    D:\Neha\OFFICE\CME\PEN\Epub to Word sty\B16756_EPUB\B16756_EPUB\OEBPS\Images\B16756_01_05.png

    Figure 1.5: Manifesto for agile software development

    A software architect always needs to remember this. Agile processes do not mean a lack of discipline. Moreover, when you use the agile process, you will quickly understand that there is no way to develop good software without discipline. On the other hand, as a software architect, you need to understand that soft means flexibility. A software project that refuses to be flexible tends to ruin itself over time.

    The 12 principles behind agile are foundational to this flexible approach:

    Continuously delivering valuable software to satisfy the customer must be the highest priority of any developer

    Changing requirements needs to be understood as an opportunity to make the customer more competitive

    Use a weekly timescale to deliver software

    A software team must be composed of businesspeople and developers

    A software team needs to be trusted and should have the correct environment to get the project done

    The best way to communicate with a software team is face to face

    You can see the greatest software team achievement as when the software is really working in production

    Agile is working properly when it delivers sustainable development

    The more you invest in techniques and good design, the more agile you are

    Simplicity is essential

    The more self-organized the teams are, the better-quality delivery you will have

    Software teams tend to improve their behavior from time to time, analyzing and adjusting their process

    Even 20 years after the launch of the Agile Manifesto, its importance and connection to the current needs of software teams remain intact. Certainly, there are many companies where this approach is not fully accepted, but as a software architect, you should understand this as an opportunity to transform practices and evolve the team you are working with.

    There are many techniques and models that were presented to the software community with the agile approach. The next subsections will discuss Lean software development, Extreme Programming, and Scrum, so that you can decide, as a software architect, which ones you might use to improve your software delivery.

    Lean software development

    After the Agile Manifesto, the approach of Lean software development was introduced to the community as an adaptation of a well-known movement in automobile engineering, Toyota’s model for building cars. The Lean manufacturing method delivers a high level of quality even with few resources.

    Mary and Tom Poppendieck mapped seven Lean principles for software development, really connected to agile and to the approach of many companies of this century, which are listed here:

    Eliminate waste: You may consider waste to be anything that will interfere with the delivery of the real need of the customer.

    Build quality in: An organization that wants to guarantee quality needs to promote it in processes from the very beginning, instead of only considering it when code is being tested.

    Create knowledge: All companies that have achieved excellence have a common pattern of generating new knowledge by disciplined experimentation, documenting that knowledge, and guaranteeing that it is spread all over the organization.

    Defer commitment: Plan decisions at the latest possible moment without causing damage to the project.

    Deliver fast: The faster you deliver software, the more elimination of waste you have. Companies that compete using time frequency have significant advantages over their competitors.

    Respect people: Giving reasonable objectives to the team, together with plans that will guide them to self-organize their routine, is a matter of respecting the people that you work with.

    Optimize the whole: A Lean company improves the cycle of value, from the moment it receives a new requirement to the point at which it delivers the software.

    Following the Lean principles helps a team or company to improve the quality of the features that are delivered to the customer. It also creates a reduction in time spent on features that will not be used by the customer. In Lean, deciding the features that are important to the customer guides the team in delivering software that matters, and this is exactly what the Agile Manifesto intends to promote in software teams.

    Extreme Programming

    Just before the release of the Agile Manifesto, some of the participants who designed the document, especially Kent Beck, presented to the world the Extreme Programming (XP) methodology for developing software.

    XP is based on the values of simplicity, communication, feedback, respect, and courage. It was considered later as a social change in programming, according to Beck in his second book about the topic. It certainly promotes a huge change in the flow of development.

    XP has it that every team should simply do only what it was asked to do, communicating face to face daily, demonstrating the software early to get feedback, respecting the expertise of each member of the team, and having the courage to tell the truth about progress and estimates, considering the team’s work as a whole.

    XP also delivers a set of rules. These rules may be changed by the team if they detect something is not working properly, but it is important to always maintain the values of the methodology.

    These rules are divided into planning, managing, designing, coding, and testing. Don Wells has mapped XP at http://www.extremeprogramming.org/. Although some of the ideas of the methodology were criticized strongly by many companies and specialists, there are many good practices that are still used nowadays:

    Writing software requirements using user stories: User stories are considered an agile approach to describing user needs, together with acceptance tests, which are used to guarantee the correct implementation.

    Divide software into iterations and deliver small releases: The practice of iterating in software development is defended by all methodologies after waterfall. The fact of delivering faster versions decreases the risk of not meeting the customer’s expectations.

    Avoid working overtime and guarantee a sustainable velocity: Although this has to be one of the hardest tasks a software architect may deal with, overtime indicates that something is not working properly in the process.

    Keep things simple: While developing solutions, it is quite common to try to anticipate features that the customer would like to have. This approach increases the complexity of the development and the time to market the solution. A different approach will cause high costs, and probably a low level of features that are used, in the system you are developing.

    Refactoring: The approach of refactoring the code continuously is good because it enables the evolution of your software and guarantees the design improvement that will truly be necessary due to the normal technical changes of the platforms you use to develop.

    Keep the customer always available: If you follow XP, you should have an expert customer inside your team. This is certainly something that is hard to do, but the main idea of this approach is to guarantee that the customer is involved in all parts of development. As another bonus, having the customer close to your team means they understand the difficulties and expertise the team has, enabling an increase of trust between the parties.

    Continuous integration: This practice is one of the bases of the current DevOps approach. The less difference you have between your personal code repository and the main code repository, the better.

    Code the unit test first: A unit test is an approach where you program specific code for testing a single unit (class/method) of your project. This is discussed in a current development methodology called Test-Driven Development (TDD). The main goal here is to guarantee that every business rule has its own unit test case.

    Code must be written to agreed standards: The need to determine standards for coding is connected to the idea that no matter which developer you have working on a specific part of the project, the code must be written so that any of them will understand it.

    Pair programming: Pair programming is another difficult approach to achieve in every single minute of a software project, but the technique itself—one programmer coding and the other actively observing and offering comments, criticism, and advice—is useful in critical scenarios.

    Acceptance tests: The adoption of acceptance tests to meet user stories is a good way to guarantee that newly released versions of the software do not cause damage to its current needs. An even better option is to have these acceptance tests automated.

    It is worth mentioning that many of these rules are today considered vital practices in different software development methodologies, including DevOps and Scrum. We will discuss DevOps later in this book, in Chapter 21, Understanding DevOps Principles. Let us get into the Scrum model right now.

    Getting into the Scrum model

    Scrum is an agile model for the management of software development projects. The model comes from Lean principles and is one of the more widely used approaches for developing software nowadays.

    Please check out this link for more information about the Scrum framework: https://www.scrum.org/.

    As you can see in the following figure, the basis of Scrum is that you have a flexible backlog of user requirements (Product Backlog) that needs to be discussed in each agile cycle, called a Sprint. The Sprint goal (Sprint Backlog) is determined by the Scrum Team, composed of the Product Owner, the Scrum Master, and the Development Team. The Product Owner is responsible for prioritizing what will be delivered in that Sprint. During the Sprint, this person will help the team to develop the required features. The person who leads the team in the Scrum process is called the Scrum Master. All the meetings and processes are conducted by this person.

    D:\Neha\OFFICE\CME\PEN\Epub to Word sty\B16756_EPUB\B16756_EPUB\OEBPS\Images\B16756_01_06.png

    Figure 1.6: The Scrum process

    It is common to apply Scrum together with another agile technique called Kanban, also developed by Toyota for manufacturing cars. The main purpose of the approach is to deliver a visual system to make sure everybody understands what is going on in the product that is being developed. The famous Kanban board is an incredible way to do so, where you define what the team must do, what they are doing, and the things that are already done. We will learn how to set up the Azure DevOps service in Chapter 3, Documenting Requirements with Azure DevOps. There we will be able to discuss a little bit more about how to create good Kanban boards.

    It is important to note that the Scrum process does not discuss how the software needs to be implemented, nor which activities will be done. Again, you must remember the basis of software development, discussed at the beginning of this chapter; Scrum needs to be implemented together with a process model. DevOps is one of the approaches that may help you use a software development process model together with Scrum. Check out Chapter 21, Understanding DevOps Principles, to understand it better.

    Scaling agile throughout a company

    Today it is quite common to find companies where agility is being practiced and evolving in a good way, considering the results of the techniques presented in the previous sections. The mixture of Scrum, Kanban, and XP, together with the evolution of the maturity of the software development process, has brought good results for companies and we have a world where software development is one of the key strategies for the success of a business.

    Some companies naturally need to scale up the number of teams, but the important question in this process is how to evolve without missing agility. And you can be sure that this question may be addressed to you, as a software architect. You may find in SAFe®—Scaled Agile Framework—a good answer for this question.

    SAFe® for Lean Enterprises is a knowledge base of proven, integrated principles, practices, and competencies for achieving business agility using Lean, Agile, and DevOps.

    – Dean Leffingwell, creator.

    © Scaled Agile, Inc.

    Based on the core values of alignment, built-in quality, transparency, and program execution, the framework provides a detailed path for delivering products with the agility needed in companies where you have one or more value streams. Its principles enable agility and incremental delivery, system thinking, fast and economic decisions, and mainly, organization around value.

    As a software architect, you may find opportunities for growth, considering you can work as a software architect in a system team, a system architect in an agile release train, or even an enterprise architect in the company. For sure, this will require a lot of studying and dedication, but this structure is what you will find in big companies.

    As with every framework, technique, or model that you will find in this book, the purpose of presenting SAFe to you is not to cover every single detail of the content. You will find excellent material and training on their website. But as a software architect, understanding how to scale up a company may be good knowledge to have in your toolbelt! Now that you know it, let us go back to the stages of designing software with high quality, discussing how to gather the right information to design it.

    Gathering the right information to design high-quality software

    Fantastic! You’ve just started a software development project. Now, it is time to use all your knowledge to deliver the best software you can. Your first question is probably – How do I start? Well, as a software architect, you are going to be the one to answer that question. And you can be sure that your answer is going to evolve with each software project you lead.

    Defining a software development process is the first task. This is generally done during the project planning process, or it might happen before it starts.

    Another very important task is to gather the software requirements. No matter which software development process you decide to use, collecting real user needs is part of a difficult and continuous job. Of course, there are techniques to help you with this, and you can be sure that gathering requirements will help you to define important aspects of your software architecture.

    These two tasks are considered by most experts in software development as the keys to success at the end of the development project journey. As a software architect, you need to enable them so that you can avoid as many problems as possible while guiding your team.

    Understanding the requirements gathering process

    There are many ways to represent the requirements. The most traditional approach consists of you having to write a perfect specification before the beginning of the analysis. Agile methods suggest instead that you need to write user stories as soon as you are ready to start a development cycle.

    Remember: You do not write requirements just for the user; you write them for you and your team too.

    The truth is that no matter the approach you decide to adopt in your projects, you will have to follow some steps to gather requirements. This is what we call requirements engineering.

    D:\Neha\OFFICE\CME\PEN\Epub to Word sty\B16756_EPUB\B16756_EPUB\OEBPS\Images\B16756_01_07.png

    Figure 1.7: Requirements engineering process

    During this process, you need to be sure that the solution is feasible. In some cases, the feasibility analysis is part of the project planning process too, and by the time you start the requirements elicitation, you will have the feasibility report already done. So, let us check the other parts of this process, which will give you a lot of important information for the software architecture.

    Detecting exact user needs

    There are a lot of ways to detect what exactly the user needs for a specific scenario. This process is known as elicitation. In general, this can be done using techniques that will help you to understand what we call user requirements. Here, you have a list of common techniques:

    The power of imagination: If you are an expert in the area where you are providing solutions, you may use your own imagination to find new user requirements. Brainstorming can be conducted together so that a group of experts can define the user needs.

    Questionnaires: This tool is useful for detecting common and important requirements such as the number and kind of users, peak system usage, and the commonly used Operating System (OS) and web browser.

    Interviews: Interviewing the users helps you as an architect to detect user requirements that perhaps questionnaires and your imagination will not cover.

    Observation: There is no better way to understand the daily routine of a user than being with them for a day.

    As soon as you apply one or more of these techniques, you will have great and valuable information about the user’s needs.

    Remember: You can use these techniques in any situation where the real need is to gather requirements, no matter whether it is for the whole system or for a single story.

    At that moment, you will be able to start analyzing these user needs and detecting the user and system requirements. Let us see how to do so in the next section.

    Analyzing requirements

    When you have detected the user needs, it is time to begin analyzing the requirements. To do so, you can use

    Enjoying the preview?
    Page 1 of 1