Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

Single Responsibility Principle

Автор: kudvenkat

Загружено: 2017-11-27

Просмотров: 287914

Описание:

In this video we will discuss
1. What is Single Responsibility
2. Single Responsibility Example

Healthy diet is very important both for the body and mind. If you like Aarvi Kitchen recipes, please support by sharing, subscribing and liking our YouTube channel. Hope you can help.
   / @aarvikitchen5572  

In our previous video we discussed S in the SOLID is acronym for Single Responsibility Principle (SRP)

As per the single responsibility principle
1. A class should have only one reason to change
2. Which means, every module or class should have responsibility over a single part of the functionality provided by the software, and that responsibility should be entirely encapsulated by the class.

Encapsulation is one of the fundamentals of OOP. At this moment, understanding more about encapsulation is out of scope of this session. However, we strongly recommend you to refer to the C# tutorial playlist for more details on Object oriented principles. Now you might be wondering what do we achieve with the Single Responsibility Principle or rather with the SOLID Design Principles.

Let's first understand the motivation behind the usage of SOLID Principles

In any enterprise software application development when we design and develop software systems, we need to account the below factors during the development cycle.

Maintainability : Maintainable systems are very important to the organisations.

Testability : Test driven development (TDD) is required when we design and develop large scale systems

Flexibility and Extensibility : Flexibility and extensibility is a very much desirable factor of enterprise applications.Hence we should design the application to make it flexible so that it can be adapt to work in different ways and extensible so that we can add new features easily.

Parallel Development : It is one of the key features in the application development as it is not practical to have the entire development team working simultaneously on the same feature or component.

Loose Coupling : We can address many of the requirements listed above by ensuring that our design results in an application that loosely couples many parts that makes up the application.

SOLID Principles and Design Patterns plays a key role in achieving all of the above points.

In Single Responsibility Principle
1. Each class and module should focus on a single task at a time
2. Everything in the class should be related to that single purpose
3. There can be many members in the class as long as they related to the single responsibility
4. With SRP, classes become smaller and cleaner
5. Code is less fragile

Hence we can say that Single Responsibility Principle achieves the motivation points that we have just discussed.

Below code demonstrates how we can achieve Single Responsibility Principle

Code before Single Responsibility Segregation
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SRPDemo
{
interface IUser
{
bool Login(string username, string password);
bool Register(string username, string password, string email);
void LogError(string error);
bool SendEmail(string emailContent);
}
}

Code after Single Responsibility Segregation
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SRPDemo
{
interface IUser
{
bool Login(string username, string password);
bool Register(string username, string password, string email);
}
interface ILogger
{
void LogError(string error);
}

interface IEmail
{
bool SendEmail(string emailContent);
}
}

Now that we have segregated the single responsibility principle in these multiple interfaces the next step is to implement these interfaces with object creation mechanisms. GOF has defined many design patterns on object creations based on the requirements.

Hence we strongly recommend you to refer to our design pattern tutorial for more details on creational design patterns.

In the next video we will discuss Interface Segregation Principle.

Text version of the video
http://csharp-video-tutorials.blogspo...

Slides
http://csharp-video-tutorials.blogspo...

SOLID Design Principles Tutorial
   • SOLID Design Principles Introduction  

SOLID Design Principles Text Articles & Slides
http://csharp-video-tutorials.blogspo...

All Dot Net and SQL Server Tutorials in English
https://www.youtube.com/user/kudvenka...

All Dot Net and SQL Server Tutorials in Arabic
   / kudvenkatarabic  

Single Responsibility Principle

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

Interface Segregation Principle

Interface Segregation Principle

Open Closed Principle

Open Closed Principle

SOLID  Principal - Interview Questions and Answers

SOLID Principal - Interview Questions and Answers

SOLID Design Principles Introduction

SOLID Design Principles Introduction

От потерь на фронте до перебоев с интернетом | Что происходило в 2025-м (English subtitles)

От потерь на фронте до перебоев с интернетом | Что происходило в 2025-м (English subtitles)

Solid Design Principles

Solid Design Principles

Самые важные паттерны в программировании

Самые важные паттерны в программировании

SOLID принципы: SRP (Принцип единственной ответственности,  Single Responsibility Principle)

SOLID принципы: SRP (Принцип единственной ответственности, Single Responsibility Principle)

Ургант устал ждать и пришёл на Ютуб. Почему это важно

Ургант устал ждать и пришёл на Ютуб. Почему это важно

2026 – год жестких перемен. Цены сильно вырастут. Острый банковский кризис | Игорь ЛИПСИЦ

2026 – год жестких перемен. Цены сильно вырастут. Острый банковский кризис | Игорь ЛИПСИЦ

Так выглядит провал. Итоги 10 лет импортозамещения

Так выглядит провал. Итоги 10 лет импортозамещения

4 Hours Chopin for Studying, Concentration & Relaxation

4 Hours Chopin for Studying, Concentration & Relaxation

Design Patterns: Single Responsibility Principle Explained Practically in C# (The S in SOLID)

Design Patterns: Single Responsibility Principle Explained Practically in C# (The S in SOLID)

Россиянам предстоит пережить боль- страшная цифра. Купянск- итоги. «СВО» уже длится как 2 мировая.

Россиянам предстоит пережить боль- страшная цифра. Купянск- итоги. «СВО» уже длится как 2 мировая.

Dependency Inversion Principle Introduction

Dependency Inversion Principle Introduction

Что такое ОЧЕРЕДЬ СООБЩЕНИЙ и где она используется?

Что такое ОЧЕРЕДЬ СООБЩЕНИЙ и где она используется?

Низкоуровневое проектирование 105 | Принцип единой ответственности в SOLID | 2022 | Проектировани...

Низкоуровневое проектирование 105 | Принцип единой ответственности в SOLID | 2022 | Проектировани...

Зеленский едет к Трампу, Правительство ждет коллапса, Украина готовит выборы? Жуковский, Чижов

Зеленский едет к Трампу, Правительство ждет коллапса, Украина готовит выборы? Жуковский, Чижов

Женщина патриарха. Как глава РПЦ 50 лет скрывал гражданскую жену?

Женщина патриарха. Как глава РПЦ 50 лет скрывал гражданскую жену?

ХАКЕРЫ СЛОМАЛИ И СТЕРЛИ РЕЕСТР ПОВЕСТОК. Власти готовились к мобилизации.  ГЛАВНЫЙ ВЗЛОМ 2025 ГОДА

ХАКЕРЫ СЛОМАЛИ И СТЕРЛИ РЕЕСТР ПОВЕСТОК. Власти готовились к мобилизации. ГЛАВНЫЙ ВЗЛОМ 2025 ГОДА

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]