Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Enterprise Application Development with C# 10 and .NET 6
  • Table Of Contents Toc
Enterprise Application Development with C# 10 and .NET 6

Enterprise Application Development with C# 10 and .NET 6 - Second Edition

By : Ravindra Akella, Arun Kumar Tamirisa , Kumar Kunani, Bhupesh Guptha Muthiyalu
4.2 (5)
close
close
Enterprise Application Development with C# 10 and .NET 6

Enterprise Application Development with C# 10 and .NET 6

4.2 (5)
By: Ravindra Akella, Arun Kumar Tamirisa , Kumar Kunani, Bhupesh Guptha Muthiyalu

Overview of this book

Building production-ready enterprise applications can be a challenging task due to the overabundance of tools and their different versions that make app development complex. This book simplifies the process with an end-to-end road map for building enterprise applications from scratch using the latest features of .NET Core 6 and C# 10. Throughout the book, you'll work on creating an enterprise app, adding a key component to the app with each chapter, before ?nally getting it ready for testing and deployment. You'll learn concepts relating to advanced data structures, the Entity Framework Core, parallel programming, and dependency injection. As you progress, you'll cover various authentication and authorization schemes provided by .NET Core to make your apps and APIs secure. The book then shows you how the latest Microsoft Visual Studio and C# 10 help you simplify developer tasks and shares tips and tricks in Visual Studio to improve your productivity. You'll discover various testing techniques, such as unit testing and performance testing, as well as di?erent methods to deploy enterprise apps. By the end of this book, you’ll be able to create enterprise apps using the powerful features of .NET 6 and deploy them to the cloud while working with various cloud components using Azure.
Table of Contents (23 chapters)
close
close
1
Part 1: Fundamentals
5
Part 2: Cross-Cutting Concerns
11
Part 3: Developing Enterprise Applications
15
Part 4: Security
18
Part 5: Health Checks, Unit Testing, Deployment, and Diagnostics

A primer on common design principles and patterns

Every piece of software in the world solves at least one real-world problem. As time goes by, things change, including what we expect from any specific software. To manage this change and deal with various aspects of software, engineers have developed several programming paradigms, frameworks, tools, techniques, processes, and principles. These principles and patterns, proven over time, have become guiding stars for engineers to build quality software.

Principles are high-level abstract guidelines to be followed while designing. They are applicable regardless of the programming language being used. They do not provide implementation guidelines.

Patterns are low-level specific implementation guidelines that are proven, reusable solutions for recurring problems. First, let's start with design principles.

Design principles

Techniques become principles if they are widely accepted, practiced, and proven to be useful in any industry. Those principles become solutions to make software designs more understandable, flexible, and maintainable. In this section, we will cover the SOLID, KISS, and DRY design principles.

SOLID

The SOLID principles are a subset of the many principles promoted by an American software engineer and instructor, Robert C. Martin. These principles have become the de facto standard principles in the OOP world and have become part of the core philosophy for other methodologies and paradigms.

SOLID is an acronym for the following five principles:

  1. Single-responsibility principle (SRP): An entity or software module should only have a single responsibility. You should avoid granting multiple responsibilities to one entity.
Figure 1.1 – SRP

Figure 1.1 – SRP

  1. Open-closed principle (OCP): Entities should be designed in such a way that they are open for extension but closed for modification. This means the regression testing of existing behaviors can be avoided; only extensions need to be tested.
Figure 1.2 – OCP

Figure 1.2 – OCP

  1. Liskov substitution principle (LSP): Parent or base class instances should be replaceable with instances of their derived classes or subtypes without altering the sanity of the program.
Figure 1.3 – LSP

Figure 1.3 – LSP

  1. Interface segregation principle (ISP): Instead of one common large interface, you should plan multiple, scenario-specific interfaces for better decoupling and change management:
Figure 1.4 – ISP

Figure 1.4 – ISP

  1. Dependency inversion principle (DIP): You should avoid having any direct dependency on concrete implementations. High-level modules and low-level modules should not depend on each other directly. Instead, both should depend on abstractions as much as possible. Abstractions should not depend on details, and details should depend on abstractions.
Figure 1.5 – DIP

Figure 1.5 – DIP

Don't Repeat Yourself (DRY)

With DRY, a system should be designed in such a way that the implementation of a feature or a pattern should not be repeated in multiple places. This would result in maintenance overhead, as a change in requirements would result in modifications being needed at multiple places. If you fail to make a necessary update in one place by mistake, the behavior of the system will become inconsistent. Rather, the feature should be wrapped into a package and should be reused in all places. In the case of a database, you should look at using data normalization to reduce redundancy.

Figure 1.6 – DRY

Figure 1.6 – DRY

This strategy helps in reducing redundancy and promoting reuse. This principle helps an organization's culture too, encouraging more collaboration.

Keep it simple, stupid (KISS)

With KISS, a system should be designed as simply as possible, avoiding complicated designs, algorithms, new untried technologies, and more. You should focus on leveraging the right OOP concepts and reusing proven patterns and principles. Include new or non-simple things only if it is necessary and adds value to the implementation.

When you keep it simple, you will be able to do the following better:

  • Avoid mistakes while designing/developing.
  • Keep the train running (there is always a team whose job is to maintain the system, even though they are not the team that developed the system in the first place).
  • Read and understand your system code (your system code needs to be understandable to people who are new to it or for people who will use it in the future).
  • Do better and less error-prone change management.

With this, we are done with our primer on common design principles; we have learned about SOLID, DRY, and KISS. In the next section, we'll look at some common design patterns in the context of real-world examples to help you understand the difference between principles and patterns and when to leverage which pattern—a skill that's essential for good design and architecture.

Design patterns

While following design principles in the OOP paradigm, you might see the same structures and patterns repeating over and again. These repeating structures and techniques are proven solutions to common problems and are known as design patterns. Proven design patterns are easy to reuse, implement, change, and test. The well-known book, Design Patterns: Elements of Reusable Object-Oriented Software, comprising what is known as the Gang of Four (GOF) design patterns, is considered the bible of patterns.

We can categorize the GOF patterns as follows:

  • Creative: Helpful in creating objects
  • Structural: Helpful in dealing with the composition of objects
  • Behavioral: Helpful in defining the interactions between objects and distributing responsibility

Let's look at these patterns with some real-life examples.

Creational design patterns

Let's take a look at some creational design patterns, along with relevant examples, in the following table:

Table 1.1 – Creational design patterns

Table 1.1 – Creational design patterns

Structural design patterns

The following table includes some examples of structural design patterns:

Table 1.2 – Structural design patterns

Table 1.2 – Structural design patterns

Behavioral design patterns

The following table includes some examples of behavioral design patterns:

Table 1.3 – Behavioral design patterns

Table 1.3 – Behavioral design patterns

Sometimes, you can become overwhelmed by all these patterns being inside the table. But really, any design is a good design until it violates the basic principles. One rule of thumb that we can use is to go back to the basics, and in design, principles are the basics.

Figure 1.7 – Patterns versus principles

Figure 1.7 – Patterns versus principles

With this, we are done with our primer on common design principles and patterns. By now, you should have a good understanding of the different principles and patterns, where to use them, and what it takes to build a great solution. Now, let's spend some time looking at common enterprise architectures.

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Enterprise Application Development with C# 10 and .NET 6
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon