?

Log in

Previous Entry | Next Entry

Below are some important C# Architecture interview questions which are asked again and again by .NET interviewers around SOLID and design patterns.

Can you explain in simple and short sentence SOLID?
It’s an acronym of five object oriented design principles which when applied together make our system an easy maintenance system.

It simply helps us to avoid the bad design.

Five principles are

  1. S – SRP – Single Responsibility Principle
    Every software module should have only one reason to change

  2. O – OCP – Open closed principle
    Software modules should be closed for modifications but open for extension

  3. L – LSP – Liskov substitution principle
    Subclasses should be substitutable for base classes.

  4. I – ISP– Interface Segregation principle
    Clients should not be forced to implement interfaces they don’t use. OR Many client specific interfaces are better than one general purpose interface

  5. D – DIP– Dependency Inversion principle
    High level modules should not depend upon low level modules. Rather, both should depend upon abstractions

IS SOLID a Design Pattern
No, Design patterns are reusable solutions for commonly occurring problems in software programming whereas SOLID is a set of principles, we can call it guidelines which let us create system where every part will be loosely attached to every other part.

SRP – What is mean by “module” and “Reason to change” in explanation?
Module - May be class, function, namespace
Reason to change Responsibility.
Every Modules should contain only one responsibility. Here the word responsibility depends on the context where we are talking like, when we say module as class responsibility indicates “database responsibility”, “reporting responsibility” etc., when we say module as function it indicates “Generating xml from list”, “using generated xml for inserting multiple records into sql”.

OCP – Can you name some techniques using which we can expose new functionality to client without touching existing code?
There are various ways achieving it. Some are,


  • Using Extension methods in .net 3.5

  • By creating derived classes

Next time we will speak about more interview questions related to SOLID and Design pattern. Stay tuned.

For live trainings on various technical trainings like MVC, WCF, Design patterns, ALM with VSTS, WPF etc visit www.Sukesh-Marla.com or contact SukeshMarla@Gmail.com

References





Copy right www.questpond.com

Buy 600+ Real Time Interview Videos

Call +91-22-66752917 or mail us on questpond@questpond.com for more details on C#, .NET, ASP.NET, SQL Server interview question videos.

SQL Server interview question videos

Latest Month

March 2017
S M T W T F S
   1234
567891011
12131415161718
19202122232425
262728293031 

Tags

Powered by LiveJournal.com