You are on page 1of 6

DesignPattern&PracticesInterviewQuestionsandAnswers(103)Page2

LatestandauthenticInterviewquestions.Youcanalsopostaninterviewquestion(/interviews/postexamquestion.aspx)andwinmonthlyprizes
(/misc/page3.aspx)aswellasgaincommunitycreditpoints(/misc/page14.aspx#points).
103recordsfound.

Search

SearchInterviews

(http://feeds2.feedburner.com/DotnetfundaInterviewQuestions)
Post(/interviews/postexamquestion.aspx)|

InterviewExperiences(/interviews/experiences.aspx)|
OnlineInterviews(/interviews/interviewtest.aspx)|

InterviewFAQs(/interviews/faq/)|

ExclusiveQuestions(/interviews/exclusive/)

Get650+Questpond'sInterviewvideosondiscount(http://www.itfunda.com/Interview)

WhatisthedifferencebetweenFactoryPatternandSingletonPattern?
(/interviews/show/5514/whatisthedifferencebetweenfactorypatternandsingletonpattern)
Singletonpatternensuresonlyoneinstanceofthetypealwaysbeavailablefortheclient(s).Letuslookintothebelowcode
class Singleton

private static Singleton singletonInstance;

private Singleton(){}

public static Singleton CreateInstance()

{
return singletonInstance == null ? new Singleton() : singletonInstance;
}
}

Theconstructorisdefinedasprivateensuringthatnoinstanceoftheclasscanbecreated.Singletonkeepscommondatainonlyoneplaceandthiscanbe
donebyusingthe"static"keywordwheretheproperty"Singleton"isdefined.Nextcheckingifthepropertyvalueisnullornot.Ifyesthenwearecreatingan
instanceandifnothenwearereturningbacktheoldinstanceonly.ThisisdoneinsidetheCreateInstancemethodTheclientinvocationpartisasunder
var _singletonInstance = Singleton.CreateInstance();

Thefactorypatterndealswithhowanobjectiscreated.Itgetsclassifiedunderthecreationalpattern.Wecangoforafactorypatternwhenweneedfor
a)Objectcreationwithoutexposingittoclient
b)Refertonewlycreatedobjectsthroughinterface.
Factorypatterndefinesaninterfaceforcreatinganobject,butlettheclassesthatimplementtheinterfacedecidewhichclasstoinstantiate.

WhatisthedifferencebetweenFactoryPatternandRepositoryPattern?
(/interviews/show/5515/whatisthedifferencebetweenfactorypatternandrepositorypattern)
Thefactorypatterndealswithhowanobjectiscreated.Itgetsclassifiedunderthecreationalpattern.Wecangoforafactorypatternwhenweneedfor
a)Objectcreationwithoutexposingittoclient
b)Refertonewlycreatedobjectsthroughinterface.
Factorypatterndefinesaninterfaceforcreatinganobject,butlettheclassesthatimplementtheinterfacedecidewhichclasstoinstantiate.
Repositorypatterncomesintousewhenwehave(ataminimum)atleastoneofthefollowingrequirements
a)Wewanttocentrallymanagethedatabyapplyinglogicandreuleswhiledealingwithdatathatcomesfromvariedlocation.
b)Weneedtousebusinessentitiesthatarestronglytyped.Thesehelpstofinderrorsatcomiletimeratheratruntime.
c)Isolatedatalayerforunittesting.
d)Wanttohaveacachingmechanisminplacetoholdthedatainordertoimprovetheapplicationperformance.
e)Seperatebusinesslogicanddatalayerlogicforbettercodemaintainability.

WhyshouldwegoaheadwithaLayeredarchitecturemodel?
(/interviews/show/6016/whyshouldwegoaheadwithalayeredarchitecturemodel)
LayeredArchitecturehelpstodecomposeanotherwisemonolithicsystemintogroupsofcomponentseachplacedatacertainlayer.
Layersalsostandardizetheformat,thecontentandthemeaningofthemessagesthatcrossthelayerboundary.
Conceptualizesthewholesystemasstackoflayers
Eachlayerfocusesononespecificresponsibility
Eachlayerconsumestheservicesofthelayersbelowitandoffersservicestothelayersaboveit.
Dataflowisalwayslinear,bothupstreamanddownstream

ListsomeoftheAdvantagesofLayeredArchitecture.
(/interviews/show/6017/listsomeoftheadvantagesoflayeredarchitecture)
Exchangeability
Allowsswappingwithanalternateimplementationsincecommunicationbetweenlayersisthroughwelldefinedprotocols/interfaces
Standardization
Enablesdevelopmentofstandardizedtasksandinterfacessincethelevelsofabstractionareclearlydefinedandcommonlyaccepted
LocalizationofDependencies
Standardizedinterfacesbetweenlayersconfinetheeffectofchangeimplementationtothelayerthatischanged

ListsomeoftheDisadvantagesofLayeredArchitecture.
(/interviews/show/6018/listsomeofthedisadvantagesoflayeredarchitecture)
LowEfficiency
Datatransferoccursthroughanumberofintermediatelayers.Thisislessefficientthanagroupofobjectscommunicatingdirectlywitheachother
GranularityofLayers
Thedecisionaboutthegranularityoflayersandtheassignmentsoftaskstothelayersisdifficult.Toofewlayersdonotfullyexploitthepatternandtoomany
layersaddoverheardofdatatransfer.
Duplication
WorkServicesperformedbylowerlayersmaynotberequiredbyhigherlayersandthoseperformedbyhigherlayersmaynotbeneededbythelowerlayers.
Theduplicationhasanegativeimpactontheperformanceofthesystem

InwhichsituationweshouldgoaheadforaMVCpattern?
(/interviews/show/6019/inwhichsituationweshouldgoaheadforamvcpattern)
Thepatternisapplicableonlyinthecontextofinteractiveapplicationswithhumancomputerinterface
MVCdividesaninteractiveapplicationintothreeareasProcessing,Output,Model
TheModelisindependentofspecificinputoroutputrepresentations.
TheViewcomponenthasmorethanonerepresentationofasinglemodel
TheControllertranslateseventstoservicerequestsforthemodelordisplayrequestsfortheview

ListsomeoftheAdvantagesofMVCArchitecture.
(/interviews/show/6020/listsomeoftheadvantagesofmvcarchitecture)
Multipleviewsofthesamemodel
MVCseparatesthemodelviewsandallowsmultipleviewstorepresentthesamemodelsimultaneously
Pluggableviewsandcontrollers
TheconceptualseparationofMVCallowsexchangeofviewandcontrollerobjectsofamodel

ListsomeoftheDisadvantagesofMVCArchitecture.
(/interviews/show/6021/listsomeofthedisadvantagesofmvcarchitecture)
ViewandtheControllercodebreaks
Bothviewandcontrollercomponentsmakedirectcallstothemodel.Ifachangeoccursinthemodelsinterface,thiscouplingincreasesthepossibilityofcode
breaksintheviewandthecontrollercode
InefficiencyofdataaccessinView
Theviewattimesmighthavetomakemultiplecallstoobtainitsdisplaydataandtherebyweakenstheperformanceofthesystem

WhichsituationweshoulddiveforEventDrivenArchitecture?
(/interviews/show/6022/whichsituationweshoulddiveforeventdrivenarchitecture)
Dealswithhowthechangeinthestateofonesystemispropagatedtoothersystemsintheapplication
Thesubjecthasneithertheknowledgetheinterestedpartiesnoroftheeventssubsequentprocessing
AlsoknownasPublishSubscribepattern

WhataretheparticipatingcomponentsforEventDrivenArchitecture?
(/interviews/show/6023/whataretheparticipatingcomponentsforeventdrivenarchitecture)
Generators/Subject/PublisherThesourceoftheevent
Subscribers/ObserverReactioninresponsetoevents
DispatcherDispatcheseventsusingpatternmatching,andcorrelationtechniques
ChannelComponentresponsibleforactivitiessuchastranslation,filteringofeventmessagesbetweeneventgeneratorsandeventsubscribers

ListsomeoftheAdvantagesofEventDrivenArchitecture
(/interviews/show/6024/listsomeoftheadvantagesofeventdrivenarchitecture)

(/interviews/show/6024/listsomeoftheadvantagesofeventdrivenarchitecture)
Extremelylooselycoupledarchitecturepermitsalowerlevelsubjecttocommunicatewithahigherlevelobserverwithoutimpactingthesystemslayering
Supportsbroadcastcommunicationinahighlydistributedarchitecturestyle
Newbusinessservicesaseventlistenerscanbeinvokeddynamicallyandtransparentlywithoutmakinganychangestotheeventsourceitself.
Eventinterceptorshelpmakeinformedbusinessdecisionsbyprovidinginsightsintothesystem

ListsomeoftheDisadvantagesofEventDrivenArchitecture
(/interviews/show/6025/listsomeofthedisadvantagesofeventdrivenarchitecture)
Eventtraceabilitythroughthesystemisdifficultastheeventcantraverseindifferentdirections
Withoutcomplexupdatesemantics,allchangesinthesubjectarepushedtoallobserversregardlessoftheirneed,resultinginunnecessarybroadcasttraffic
Theobservershavenoknowledgeofeachotherspresence,sothefinaloutcomeofaneventresponsecanbehardtotrackdown
Indistributedeventarchitecture,theeventcontextgetscopiedforeachobserverandreducesmemoryscalability

WhatarethedriversforBrokerArchitecture?
(/interviews/show/6026/whatarethedriversforbrokerarchitecture)
Brokerisacentralpieceofsoftwarethatisusedbyseveraldistributedcomponentstocommunicatewitheachother.
IndividualcomponentsneednotbeequippedwithdifferentcommunicationmechanismthecomponentsonlyneedthemeanstotalktotheBroker.
Brokeralsoprovidesregistryservicesforadding,removing,exchanging,activatingandlocatingcomponents.
ClientsideproxiesrepresentalayerbetweenclientsandtheBroker.Thisadditionallayerprovidestransparency,inthataremoteobjectappearstothe
clientasalocalone.
ABrokerisanalogoustoamessengerthatisresponsibleforthetransmissionofrequestsfromclientstoservers,aswellasthetransmissionofresponses
andexceptionsbacktotheclient.

WhoaretheparticipatingcomponentsinBrokerArchitecture?
(/interviews/show/6027/whoaretheparticipatingcomponentsinbrokerarchitecture)
Server
ObjectsthatexposetheirfunctionalitythroughinterfacesconformingtoInterfaceDefinitionLanguage(IDL)orthroughabinarystandardspecificforthe
Broker
Clients
ApplicationsthataccesstheservicesofatleastoneserverbyforwardingrequeststotheBroker
Proxies
Componentsthathidethecommunicationdetailsbyexposingthesameobjectorientedinterfaceasclientandserver
Bridge
Thisisanoptionalcomponentusedforintegratingtwobrokersacrossdifferentheterogeneousnetwork

ListsomeadvantagesofBrokerArchitecture
(/interviews/show/6028/listsomeadvantagesofbrokerarchitecture)
Distributiontransparency
AclientcantreatremoteobjectslikealocalobjectbyusingaclientsideproxyasalayerbetweenitselfandtheBroker(CORBA).
Centralization
AdditionalresponsibilitiessuchasInstancemanagement,Security,TransactionManagementetccanbecentralizedEx:EJBContainer

ListsomeDisadvantagesofBrokerArchitecture
(/interviews/show/6029/listsomedisadvantagesofbrokerarchitecture)
ComplexMemoryManagement
ServicesreferencedbyexternalclientsaremanagedbytheBrokerprocessandexecutedremotelyinaseparateprocess.Thelifecycleofsuchservice
instancesreferencedbyexternalclientsmakesmemorymanagementcomplex
IncreasedOverhead
Clientsideproxiesexposethesameinterfaceastheserverobject.Invocationsthatappeartobelocal,mightactuallyberemoteandcarryoverheadswith
regardtomarshalling,networkandsoon
PortabilityConcerns
Brokerarchitecturesutilizenonstandardgenerationofstubandproxiestoimplementthecoreconnectionandmarshallingmechanism

ListsomeofthecharacteristicsofPipesandFilterarchitecture
(/interviews/show/6032/listsomeofthecharacteristicsofpipesandfilterarchitecture)
Thepatternisenvisagedasastreamofdataflowingthroughasetofprocessingstages.
Datacanbeprocessedsequentiallyorinparallel,basedonthecontext
PipesandFilterscanbecombinedindifferentwaystocreateafamilyofsystems
ManyintegrationarchitecturalpatternsarevariantsofthePipesandFilterpattern.
ThekeybenefitofthisarchitecturalstyleisTheprocessingstepscanbechangedandcomposedindifferentwaysasallthefiltersandpipesexposethe
sameexternalinterface.
e.g.
ManyEnterpriseIntegrationPatternsarebasedonPipesandFiltersArchitectureStyle
ContentBasedRouter
Splitter
Aggregator
ReSequencer

WhatarethemainparticipatingcomponentsofPipesandFilterarchitecture
(/interviews/show/6033/whatarethemainparticipatingcomponentsofpipesandfilterarchite)
Filter
Enriches,refinesortransformsinputdata.Eachprocessingstepisimplementedbyafiltercomponent
Pipes
Implementthedataflowbetweenadjacentprocessingsteps
Pipeline
Asequenceoffiltersthatareconnectedusingpipes
Port
Theconnectionbetweenthefilterandthepipe.Inthebasicform,eachfiltercomponenthasoneinputportandoneoutputport

ListsomeoftheAdvantagesofPipesandFilters.
(/interviews/show/6034/listsomeoftheadvantagesofpipesandfilters)
Allowscomplexprocessingonamessagewhilemaintainingindependenceandflexibility
Filtersthatusethesameexternalinterfacecanbecomposedintodifferentsolutions,byconnectingthecomponentstodifferentpipes,withouthavingto
changethefiltersthemselves
Filtersareeasytoreuseindifferentcontextsthanlargecomponents
Multiprocessingoffilters,forexamplerunningtheminparallelorquasiparallel,ispossible

ListsomeoftheDisAdvantagesofPipesandFilters.
(/interviews/show/6035/listsomeofthedisadvantagesofpipesandfilters)
A)Increasedoverheaddueto
Thesmallgranularityofeachprocessingstep
Numberofcontextswitchtobemadebetweenfilters
B)Performanceisaffectedbytheneedtocopydatabetweenaddressspacesoffilters
C)Constraintsonthealloweddatasizeinthepipes(typicallyqueues)affectsthescalabilityofdatatransfersbetweenfilters

1(/interviews/cat/45/designpatternpractices/)

4(/interviews/cat/45/designpatternpractices/60/4)

3(/interviews/cat/45/designpatternpractices/40/3)
5(/interviews/cat/45/designpatternpractices/80/5)

6(/interviews/cat/45/designpatternpractices/100/6)

MoreDESIGNPATTERN&PRACTICESExclusiveInterviewQuestions&Answershere(/interviews/exclusive/cat/45/designpatternpractices)
Foundthisuseful,bookmarkthispagetotheblogorsocialnetworkingwebsites.

(http://www.copyscape.com/)

(https://in.pinterest.com/pin/find/?url=http://www.dotnetfunda.com/interviews/cat/45/designpatternpractices/20/2)

(mailto:sample@sample.com?subject=http://www.dotnetfunda.com/interviews/cat/45/designpatternpractices/20/2)

BookmarkIt(/post/postga.aspx?u=http%3a%2f%2fwww.dotnetfunda.com%2finterviews%2fcat%2f45%2fdesignpatternpractices%2f20%2f2)

Resume Database in US

460 Million Resumes, Contact via Mail/ Phone and Hire Today!

InterviewQuestionsandAnswersCategories
.NETCertifications(/interviews/cat/29/netcertifications)

.NETFramework(/interviews/cat/52/netframework)

ADO.NET(/interviews/cat/47/adonet)

Android(/interviews/cat/221/android)

AngularJS(/interviews/cat/225/angularjs)

AptituteTest(/interviews/cat/214/aptitutetest)

ASP.NET(/interviews/cat/5/aspnet)

ASP.NETAJAX(/interviews/cat/23/aspnetajax)

ASP.NETCore(/interviews/cat/229/aspnetcore)

ASP.NETMVC(/interviews/cat/131/aspnetmvc)

ASP.NETWebAPI(/interviews/cat/222/aspnetwebapi)

Azure(/interviews/cat/111/azure)

BestPractices(/interviews/cat/114/bestpractices)

BizTalkServer(/interviews/cat/90/biztalkserver)

Bootstrap(/interviews/cat/223/bootstrap)

C#(/interviews/cat/6/csharp)

Cloud(/interviews/cat/177/cloud)

CMS(/interviews/cat/134/cms)

CSS3(/interviews/cat/18/css3)

DataStructures&Algorithms(/interviews/cat/226/datastructuresalgorithms)

DesignPattern&Practices(/interviews/cat/45/designpatternpractices/20/2)

DotNetFunda.Com(/interviews/cat/167/dotnetfundacom)

EntityFramework(/interviews/cat/227/entityframework)

ErrorandSolution(/interviews/cat/126/errorandsolution)

F#(/interviews/cat/66/f)

FunctionPoints(FPA)(/interviews/cat/112/functionpointsfpa)

HR(/interviews/cat/213/hr)

HTML5(/interviews/cat/161/html5)

IIS(/interviews/cat/122/iis)

InterviewQuestions(/interviews/cat/219/interviewquestions)

JavaScript(/interviews/cat/7/javascript)

jQuery(/interviews/cat/95/jquery)

Kinect(/interviews/cat/189/kinect)

LightSwitch(/interviews/cat/159/lightswitch)

LINQ(/interviews/cat/110/linq)

Management(/interviews/cat/70/management)

MobileDevelopment(/interviews/cat/170/mobiledevelopment)

Mule(/interviews/cat/209/mule)

Networking(/interviews/cat/215/networking)

NewsandCommunity(/interviews/cat/218/newsandcommunity)

Node.js(/interviews/cat/220/nodejs)

NoSql(/interviews/cat/194/nosql)

OOPS(/interviews/cat/53/oops)

Oracle(/interviews/cat/205/oracle)

Others(/interviews/cat/16/others)

PostgreSQL(/interviews/cat/208/postgresql)

PowerShell(/interviews/cat/135/powershell)

ProductReviews(/interviews/cat/199/productreviews)

ProjectManagement(/interviews/cat/216/projectmanagement)

Python(/interviews/cat/228/python)

QA(Testing)(/interviews/cat/217/qatesting)

RegularExpressions(/interviews/cat/30/regularexpressions)

SEO(/interviews/cat/24/seo)

SharePoint(/interviews/cat/85/sharepoint)

SignalR(/interviews/cat/230/signalr)

Silverlight(/interviews/cat/83/silverlight)

SqlServer(/interviews/cat/8/sqlserver)

TypeScript(/interviews/cat/224/typescript)

UML(/interviews/cat/113/uml)

VB.NET(/interviews/cat/117/vbnet)

VisualStudio(/interviews/cat/130/visualstudio)

WCF(/interviews/cat/73/wcf)

WebAnalytics(/interviews/cat/22/webanalytics)

WebServices,Remoting(/interviews/cat/187/webservicesremoting)

Windows8(/interviews/cat/183/windows8)

WindowsForms(/interviews/cat/92/windowsforms)

WindowsMetro(/interviews/cat/200/windowsmetro)

WindowsPhone(/interviews/cat/160/windowsphone)

WPF(/interviews/cat/72/wpf)

WWF(/interviews/cat/71/wwf)

XML(/interviews/cat/125/xml)

WINNERS

Bhuvanesh6

ADS

SOCIAL
YouTube/DNFVideo(http://www.youtube.com/dnfvideo)
Facebook/DotNetFunda(https://www.facebook.com/pages/DotNetFunda/150208065028141)
Twitter/DotNetFunda(http://twitter.com/dotnetfunda)
LinkedIn/In/DotNetFunda(http://www.linkedin.com/in/dotnetfunda)
Plus.Google.Com(https://plus.google.com/110725672744452026072/)
+978 Recommend this

LikeusonFacebook

DotNetFunda
Like Page

16k likes

Be the rst of your friends to like this

TOPINTERVIEWSAUTHORS
Wed,31Aug2016Authors
AllTimeAuthors

56720(/profile/vishalneeraj24503.aspx)
22400(/profile/rajkatie.aspx)
18040(/profile/bharathicherukuri.aspx)
Latestmembers(/misc/latestmembers.aspx)|More...(/misc/topauthors.aspx?c=3)
(Statisticsdelayedby5minutes)

ADVERTISEMENTS

KESARFASHION

KESARFASHIONWOMEN'S
COTTONSILKSAREE

VIVERA

VIVERAWOMEN'STUSSAR
SILKSAREE

ISHIN

ISHINCOTTONWOMEN'S
SAREE

LATESTDESIGNPATTERN&PRACTICESARTICLES
DependencyInjectionwithUNITYandMEFinASP.NETMVC(/articles/show/3148/dependencyinjectionwithunityandmefinaspnetmvc)
LetuslearnAutofac(/articles/show/2386/letuslearnautofac)
UsingStructureMapinFactoryMethodusingFactoryPattern(/articles/show/2385/usingstructuremapinfactorymethodusingfactorypattern)
LetuslearnProviderDesignPattern(/articles/show/2306/letuslearnproviderdesignpattern)
LetuslearnFactoryPattern(/articles/show/1929/letuslearnfactorypattern)
More...(/articles/cat/45/designpatternpractices)

LATESTDESIGNPATTERN&PRACTICESFORUMS
FactoryPatternRealProjectImplementation(/forums/show/18864/factorypatternrealprojectimplementation)
WhichDesignPatterisSuitableforThis?(/forums/show/18247/whichdesignpatterissuitableforthis)
WhichistheBestDesignPatternforBankingWebApplication(/forums/show/16244/whichisthebestdesignpatternforbankingwebapplication)
PatternforInventoryManagementSoftware(/forums/show/15302/patternforinventorymanagementsoftware)
whatisuseofmvp?(/forums/show/14401/whatisuseofmvp)
More...(/forums/cat/45/designpatternpractices)

AboutUs(/about.aspx)

Shareknowledge(/misc/page10.aspx)

HostingPartner

ContactUs(/feedback.aspx)

PrivacyPolicy(/privacypolicy.aspx)

GoTop

TheTeam(/misc/page11.aspx)

TermsofUse(/termsconditions.aspx)

Testimonials(/feedbacklist.aspx)

SearchMembers
(/search/searchmembers.aspx)

Advertise(/misc/page9.aspx)

Catalogs(/catalogs/)

GeneralNotice:Ifyoufindplagiarised(copied)contentonthispage,pleaseletusknow(/feedback.aspx?writeurl=yes)originalsourcealongwithyour
correctemailid(tocommunicate)foraction.
DotNetFunda.Com.AllRightsReserved.Logos,companynamesusedhereifanyareonlyforreferencepurposesandtheymayberespectiveowner'srightor
trademarks.|8/31/20164:27:45AM

You might also like