.NET ARCHITECTURE

How can we implement singleton pattern in .NET?

Singleton pattern mainly focuses on having one and only one instance of the object running. Example a windows directory service which has multiple entries but you can only have single instance of it through out the network.

Note:- May of developers would jump to a conclusion saying using the “STATIC” keyword we can have a single instance of object. But that’s not the real case there is something more that has to be done. But please note we can not define a class as STATIC, so this will not serve our actual purpose of implementing singleton pattern.

Following are the three steps More >

What is MVC pattern?

The main purpose using MVC pattern is to decouple the GUI from the Data. It also gives the ability to provide multiple views for the same Data. MVC pattern separates objects in to three important sections:-

?   Model: – This section is specially for maintaining data. It is actually where your business logic, querying database, database connection etc. is actually implemented.

?   Views: – Displaying all or some portion of data, or probably different view of data. View is responsible for look and feel, Sorting, formatting etc.

?   Controller: – They are event handling section which affects either the model or the view. More >

What is the difference between Factory and Abstract Factory Patterns?

First read the definition provided in the first question about both these patterns. The common thing they have is that they belong to creational patterns. In short they hide the complexity of creating objects.

The main difference between factory and Abstract factory is factory method uses inheritance to decide which object has to be instantiated while abstract factory uses delegation to decide instantiation of object. We can say Abstract factory uses factory method to complete the architecture. Abstract Factory is one level higher in abstraction over Factory.

The   two class diagrams below will provide overview of what is the actual difference. First figure More >

Can you list down all patterns and their classification ?

There are three basic classification of patterns Creational, Structural and Behavioral patterns.

Creational Patterns

?   Abstract Factory:- Creates an instance of several families of classes

?   Builder :- Separates object construction from its representation ?   Factory Method:- Creates an instance of several derived classes ?   Prototype:- A fully initialized instance to be copied or cloned ?   Singleton:- A class in which only a single instance can exist

Note :- The best way to remember Creational pattern is by ABFPS (Abraham Became First President of States).

Structural Patterns

?   Adapter:-Match interfaces of different classes.

?   Bridge:-Separates an object’s interface from its implementation. ?   Composite:-A tree structure of simple More >

What are design patterns ?

Design patterns are recurring solution to recurring problems in software architecture.