tag:blogger.com,1999:blog-51178332615907229822024-02-02T00:56:40.792-08:00.NET Technical DiscussionRanjan Dailatahttp://www.blogger.com/profile/01485829723000549876noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-5117833261590722982.post-33939704015463912772012-09-15T21:32:00.000-07:002012-09-16T20:05:44.095-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<h2 style="text-align: left;">
<span style="font-size: 20.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;">Telerik TV - Win 7 Phone App</span></h2>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="text-align: left;">
<span style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;">Telerik TV is a Win 7 mobile App uses
Telerik Odata and fetches some of the information which the user may be
interested. <o:p></o:p></span></span></div>
<div class="MsoNormal" style="text-align: left;">
<span style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;"><br /></span></span></div>
<div class="MsoNormal" style="text-align: left;">
<span style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;">The following are the features on this
App<o:p></o:p></span></span></div>
<div class="MsoNormal" style="text-align: left;">
<span style="font-family: Verdana, sans-serif; text-indent: -0.25in;"><span style="line-height: 21px;"><br /></span></span></div>
<div class="MsoNormal" style="text-align: left;">
</div>
<ul style="text-align: left;">
<li><span style="font-family: Verdana, sans-serif; line-height: 115%; text-indent: -0.25in;"> View Authors and his blog Information</span></li>
<li><span style="font-family: Verdana, sans-serif; line-height: 115%; text-indent: -0.25in;"> View Channel Information</span></li>
<li><span style="font-family: Verdana, sans-serif; line-height: 115%; text-indent: -0.25in;"> View Video Information</span></li>
</ul>
<div class="MsoNormal" style="text-align: left;">
<span style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;"><br /></span></span>
<span style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;">The App shows the panoramic view of Authors,
Channel and Video Information. The panoramic view is made with an intention of
easy navigation across various related information.<o:p></o:p></span></span></div>
<div class="MsoNormal" style="text-align: left;">
<br /></div>
<div class="MsoNormal" style="text-align: left;">
<span style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;">Author Info is shown with the Author Name,
Author Photo if they have and the Blog link. The user can view the blog
information by just clicking on the link which will open in a Web browser
integrated with in the application.<span style="font-size: medium;"><o:p></o:p></span></span></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg007VP5rhHWgZfbz2l-c9nWOXzFjPkZzNgjUeXGXbEj1Zj-FniiQNz6uBEfdwrFMr4KkOTyWhHtjs-irDYOfXwaWvhqHkwBk8LYXoHBraNjPnEG0ovgEgX2zyioJf5mS_8_9m-6WnWdxs/s1600/AuthorInfo.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg007VP5rhHWgZfbz2l-c9nWOXzFjPkZzNgjUeXGXbEj1Zj-FniiQNz6uBEfdwrFMr4KkOTyWhHtjs-irDYOfXwaWvhqHkwBk8LYXoHBraNjPnEG0ovgEgX2zyioJf5mS_8_9m-6WnWdxs/s640/AuthorInfo.png" width="342" /></a><span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"> </span></div>
<div class="MsoNormal">
<br /></div>
<br />
<br />
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<span style="font-family: "Calibri","sans-serif"; font-size: 14.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-language: AR-SA; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin;"><br clear="all" style="mso-special-character: line-break; page-break-before: always;" />
</span>
<br />
<div class="MsoNormal" style="text-align: left;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div class="MsoNormal" style="text-align: left;">
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif; line-height: 115%;">The Channel information shows the Name,
Url and Description information <span style="font-size: medium;"><o:p></o:p></span></span></div>
</div>
<div class="MsoNormal">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKUiEJeZfWn1GcdFmL-RAoWgzbsnjl6PKKxk5sQ4myKT14RtQZJztDKaSBqV9jnnBjACc6s10Ie3_4L9gDDAWxEshFFFXp7sV2hwMdU9pvQOHXKhZnFzF1yXBEvjaTXEG_aecFai58Dh8/s1600/ChannelInfo.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKUiEJeZfWn1GcdFmL-RAoWgzbsnjl6PKKxk5sQ4myKT14RtQZJztDKaSBqV9jnnBjACc6s10Ie3_4L9gDDAWxEshFFFXp7sV2hwMdU9pvQOHXKhZnFzF1yXBEvjaTXEG_aecFai58Dh8/s640/ChannelInfo.png" width="344" /></a></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="font-size: 14.0pt; line-height: 115%; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin;"><br /></span></div>
<div class="MsoNormal">
<span style="line-height: 115%;"><span style="font-family: Verdana, sans-serif; font-size: large;"><br /></span></span></div>
<div style="text-align: left;">
<span style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;">The Video information shows the Name,
Url and Description information. The user can click on the link that will
navigate to telerik page. </span></span></div>
<div style="text-align: left;">
<span style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;"><br /></span></span><span style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;">Telerik uploads view to viddler and uses render them in
their web page using Adobe Flash. As of today there is no Flash support for Win
7 so you can’t view watch Telerik videos.</span></span></div>
<div class="MsoNormal" style="text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghR4AvKtdxTWrm0_sF8QlxWumjGimAvePR3jCBdIA3Yx9iDc2xGNYbcu81uS2VQnNE0SEwZBOzPNn5mVuBpe_9rAGtMhZyFR71RgQUPmKwkt8-D0H1p26EFtwVX4jO4idicl5jCOvOH94/s1600/VideoInfo.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-left: 1em;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghR4AvKtdxTWrm0_sF8QlxWumjGimAvePR3jCBdIA3Yx9iDc2xGNYbcu81uS2VQnNE0SEwZBOzPNn5mVuBpe_9rAGtMhZyFR71RgQUPmKwkt8-D0H1p26EFtwVX4jO4idicl5jCOvOH94/s640/VideoInfo.png" width="342" /></a></div>
<div class="MsoNormal">
<br /></div>
</div>
Ranjan Dailatahttp://www.blogger.com/profile/01485829723000549876noreply@blogger.com0tag:blogger.com,1999:blog-5117833261590722982.post-38049143915603128322012-05-26T11:30:00.003-07:002012-05-28T20:11:21.605-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: left;">
<h2 style="text-align: justify;">
<b><span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif; font-size: x-large;">WCF Service Vs Windows Service</span></span></b></h2>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<br /></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;">This article is all about
understanding WCF and Windows service. We will first try to understand what it
is at high level and then dig in more.<span style="font-size: medium;"><o:p></o:p></span></span></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<br /></div>
</div>
<div class="MsoNormal">
<h3 style="text-align: justify;">
<b><span lang="EN-US" style="font-size: 14pt; line-height: 115%;"><span style="font-family: Verdana, sans-serif;">WCF Service</span></span></b></h3>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif; line-height: 115%;">WCF is meant for designing and
deploying distributed applications and it’s a framework for building
service-oriented applications.</span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<br /></div>
</div>
<div class="MsoNormal">
<h3 style="text-align: justify;">
<b><span lang="EN-US" style="font-size: 14pt; line-height: 115%;"><span style="font-family: Verdana, sans-serif;">What is SOA?</span></span></b></h3>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif; line-height: 115%;">A service-oriented
architecture is a collection of services. These services communicate with each
other. The communication can involve either simple data passing or it could
involve two or more services coordinating each other to do some activity.</span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<br /></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;">SOA is a buzz word also it is
a misconception that when it comes to SOA, we have to create and consume WCF
services.Some architects mistakenly
assumes and considers WCF as default. However in theory point of view it doesn’t
really matter how it’s being implemented. WCF just provides a means for
developing distributed services.<o:p></o:p></span></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<br /></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;">We all started working with
Web services before WCF came into picture. Web services by itself is service
oriented implementation. Guys we already we aware of what are SOA. <o:p></o:p></span></span></div>
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;"><br /></span></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;">Simply stating for SOA, the
most basic components would be a service user and a service provider that’s
all. As I already mentioned about WCF, its Microsoft’s implementation of
service oriented architecture. <span style="font-size: medium;"><o:p></o:p></span></span></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<br /></div>
</div>
<div class="MsoNormal">
<h3 style="text-align: justify;">
<b><span lang="EN-US" style="font-size: 14pt; line-height: 115%;"><span style="font-family: Verdana, sans-serif;">What is a
Service?</span></span></b></h3>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif; line-height: 115%;">In simple words, a service is
the work performed by one that serves or helps.</span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;"><br /></span></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="line-height: 115%;">A service is a reusable component that can be used as
a building block to form larger, more complex business-application
functionality.</span><span style="line-height: 115%;"><o:p></o:p></span></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;"><br /></span></span></div>
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;">Services are independent. They don’t know or really care
whether the service is:<o:p></o:p></span></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;">– Running on Windows, J2EE or a Mainframe<o:p></o:p></span></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;">– Written in assembler, C, Java, or COBOL.<o:p></o:p></span></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;">– Being served by a CRM system, a DDA system, or a
database<o:p></o:p></span></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;"><br /></span></span></div>
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;">Don’t think service as just one big massive thing. The
services can be broken into compound and granular services.<span style="font-size: medium;"><o:p></o:p></span></span></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<br /></div>
</div>
<div class="MsoNormal">
<h3 style="text-align: justify;">
<b><span lang="EN-US" style="font-size: 14pt; line-height: 115%;"><span style="font-family: Verdana, sans-serif;">Why do we need an SOA?</span></span></b></h3>
<div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif; line-height: 115%;">The systems that we build and use today are much
complex ones. That doesn’t mean the older systems are not much complex. From my
own personal experience, When I was working for Healthcare clearing house ,
there were products which were built with technology like Foxpro , VB, .NET
components (these are legacy systems for now that’s a different story) which are
still running since from nearly 20 yrs.</span></div>
</div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;"><br /></span></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;">The Object Oriented (OO) solved the problem for medium
sized systems or applications. The component orientation solved the problem
that a simple objected oriented could not do in a medium sized products or
applications. </span></span><span style="font-family: Verdana, sans-serif; line-height: 115%;">With large systems, neither of this could solve the
problem.</span></div>
</div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="font-size: 14pt; line-height: 115%;"><br clear="all" style="mso-special-character: line-break; page-break-before: always;" />
</span>
</span></div>
<div class="MsoNormal">
<div style="text-align: justify;">
<br /></div>
</div>
<div class="MsoNormal">
<h3 style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><b><span lang="EN-US" style="font-size: 14pt; line-height: 115%;">When is SOA good and Bad?</span></b></span></h3>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif; line-height: 115%;">Good when you are building a large system or systems
of systems or planning for distributed systems then it’s good to go.</span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;"><br /></span></span></div>
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;">It’s bad when there are no distributed systems. It may
not be feasible for small or medium sized systems.<span style="font-size: medium;"><o:p></o:p></span></span></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><span style="font-size: 19px; line-height: 21px;"><br /></span></span></div>
</div>
<div class="MsoNormal">
<h3 style="text-align: justify;">
<b><span lang="EN-US" style="font-size: 14pt; line-height: 115%;"><span style="font-family: Verdana, sans-serif;">Windows Service</span></span></b></h3>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif; line-height: 115%;">Windows service is generally used when an application
needs to run continuously in the background without any human intervention. The
main functions of a windows service is to run in the background.</span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;"><br /></span></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;">We can set the windows service to start automatically when the
machine boots and also we can manually stop and re-start later if required.<o:p></o:p></span></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;"><br /></span></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;">In simple, these services are developed when we want everything
to be done and in a same machine. In contrast to WCF services these services
are not distributed in nature. We can have multiple services where in each one
can perform some activities. But as such
windows services won’t provide any service to consumers. I mean in general we
use windows service to do something autonomously without any other external
applications interacting with it. However we can host a WCF service with in a
windows service and make the WCF services available to consume within in an
intranet environment.<o:p></o:p></span></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;"><br /></span></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 115%;"><span style="font-family: Verdana, sans-serif;">Consider an example where in you can make use of this.
You have developed an application which pushes some messages (Say Windows MSMQ
or a Service broker queue). In such cases you can go with a simple windows
service which runs in the background continuously monitoring the queue for the
incoming messages. Once you have the message, we can simply process the same.<o:p></o:p></span></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<br /></div>
</div>
</div>Ranjan Dailatahttp://www.blogger.com/profile/01485829723000549876noreply@blogger.com0tag:blogger.com,1999:blog-5117833261590722982.post-77860828064791208172012-05-07T08:30:00.001-07:002012-05-07T08:36:42.253-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="MsoNormal">
<b><span lang="EN-US" style="font-size: 18pt; line-height: 115%;">Behavioral Driven Development (Part 1)<o:p></o:p></span></b></div>
<div class="MsoNormal">
<b><span lang="EN-US" style="font-size: 18pt; line-height: 115%;"><br /></span></b></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 115%;">Behavioral driven development is all about documenting
or producing the executable specification. We think in terms of various
scenario’s or steps and write unit tests to verify the behavior of objects under
test.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 115%;"><br /></span><br />
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 115%;">BDD is said to be superset of TDD. </span><span style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 115%;">If you are aware of
the TDD process where in we write the failing unit tests, then write the
production code; verify the test to make it pass. Refactor code and verify the
tests. </span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><span style="font-family: Verdana, sans-serif;"><br /></span></span><br />
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><span style="font-family: Verdana, sans-serif;">One thing I would like to tell the reader is BDD is not just about unit testing.
It’s about how you drive your tests with various behaviors. One has to think and
come up with various scenarios for a use-case then start writing acceptance
test for the same.</span><o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<b><span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></b></div>
<div class="MsoNormal">
<b><span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 115%;">TDD Technique<o:p></o:p></span></b></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicrjwj_biRKuB80KTdqDqk6Jc44qj3SamaiXs3ALZzrBl_JXBstJsi-Wt7syrGwXp8ubsoPf8cUIdsBSpt3OlEgV-1ZJTj3-pWIZb-yirvH8LGtvHSenqNrrWg-E1ieUwwSTDvjP9nUH8/s1600/TDD.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="264" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicrjwj_biRKuB80KTdqDqk6Jc44qj3SamaiXs3ALZzrBl_JXBstJsi-Wt7syrGwXp8ubsoPf8cUIdsBSpt3OlEgV-1ZJTj3-pWIZb-yirvH8LGtvHSenqNrrWg-E1ieUwwSTDvjP9nUH8/s320/TDD.jpg" width="320" /></a></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="line-height: 18px;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 115%;"><br /></span><br />
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 115%;"><br /></span><br />
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 115%;">With BDD, we are writing a feature tests. What that
means is write unit tests with the behavior in mind. We think about various scenarios
and write unit tests to make it to pass.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 115%;">BDD focuses on the Acceptance tests or executable
specification. Think as an end user performing various steps to accomplish a
particular use case/scenario. You can go with one Use case at a time and follow
the acceptance tests to cover the same.<o:p></o:p></span></div>
<b><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 12pt; line-height: 115%;"><br clear="all" style="mso-special-character: line-break; page-break-before: always;" />
</span></b>
<br />
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><span style="font-family: Verdana, sans-serif;">BDD Technique</span><o:p></o:p></span></b></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiR3HpOen3S2MRb_cy5L8DEThZnLQey0YikaB_iDI8jiRCf8bunFtsRfsdFjH713P1gX3814df-ZIJRx29w8dNThumJ3jYiDtzY6XyFoHUY_xVuSTluvFy4uOhd0eTUtHhy16a0W5PfbwA/s1600/BDD.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="175" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiR3HpOen3S2MRb_cy5L8DEThZnLQey0YikaB_iDI8jiRCf8bunFtsRfsdFjH713P1gX3814df-ZIJRx29w8dNThumJ3jYiDtzY6XyFoHUY_xVuSTluvFy4uOhd0eTUtHhy16a0W5PfbwA/s400/BDD.jpg" width="400" /></a><span lang="EN-US" style="font-size: 12pt; line-height: 115%;"></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></div>
<div style="text-align: left;">
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="font-size: 12pt; line-height: 115%;"><br /></span></span><br />
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="font-size: 12pt; line-height: 115%;">The key difference what we can think of TDD and BDD is
the focus on the initial design and creation of tests. With BDD we are focusing
on the steps or features to achieve our goals rather than focusing on the just
writing a passing test with TDD.</span></span></div>
<div style="text-align: left;">
<br />
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="font-size: 12pt; line-height: 115%;">BDD is all about documenting the executable
specification in terms on Unit tests which verifies the behavior of our system. </span><span lang="EN-US" style="font-size: 12pt; line-height: 115%;">There are many tools available for doing BDD. SpecFlow
is one among the good tool that I personally suggest with which we can easily
write acceptance tests describing the features. </span></span></div>
<div>
<o:p></o:p><br />
<div style="text-align: left;">
</div>
<div class="MsoNormal" style="text-align: left;">
<br /></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<br /></div>
</div>
</div>Ranjan Dailatahttp://www.blogger.com/profile/01485829723000549876noreply@blogger.com0tag:blogger.com,1999:blog-5117833261590722982.post-78353727641083870852012-05-05T10:32:00.001-07:002012-05-28T20:10:43.389-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: justify;">
<br /></div>
<div class="MsoNormal">
<h2 style="text-align: justify;">
<span lang="EN-US" style="font-size: 20pt; line-height: 31px;">Introduction to Mocks and Stubs</span></h2>
<div>
<div style="text-align: justify;">
<span lang="EN-US" style="font-size: 20pt; line-height: 31px;"><br /></span></div>
</div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif; line-height: 18px;">Mock objects are simulated objects that mimic the behavior of real objects in controlled ways. We typically create mock objects to test the behavior of some other object.</span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;"><br /></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 18px;"><span style="font-family: Verdana, sans-serif;">A stub is a replacement for an existing dependency in the system. By using a stub, you can test your code without dealing with the dependency directly.</span><span style="font-size: small;"><o:p></o:p></span></span></div>
<div style="text-align: justify;">
<span lang="EN-US" style="font-size: 12pt; line-height: 18px;"><br /></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;">Consider a scenario where you need mocks and stubs<o:p></o:p></span></div>
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;"><br /></span></div>
</div>
<div class="MsoListParagraphCxSpFirst" style="text-indent: -0.25in;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="line-height: 18px;"> You want to simulate the behavior of the dependent objects, say you wish to mock and test EmailSender. While testing such things we won’t be really connecting to Email server. In this scenario, we can simply mock and test the behavior of email sender and verify the expectations set against the mock object.<o:p></o:p></span></span></div>
</div>
<div class="MsoListParagraphCxSpMiddle">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
</div>
<div class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in;">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif;"><span style="line-height: 18px;"> </span></span><span lang="EN-US" style="line-height: 18px;"><span style="font-family: Verdana, sans-serif;">Imagine you are testing a data access class which connects to DB fetches, inserts / updates some data. We can make use of mock and stub techniques to test the DAO logics without the database dependency.</span><span style="font-size: small;"><o:p></o:p></span></span></div>
</div>
<div class="MsoListParagraphCxSpLast">
<div style="text-align: justify;">
<br /></div>
</div>
<div class="MsoNormal">
<h3 style="text-align: justify;">
<b><span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 18px;">Why Mocking?</span></b></h3>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 18px;">If you are planning to isolate the dependencies of an object and unit test, then you will have to mock and test.</span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 18px;"><br /></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 18px;">Here I'm considering an example of User object which has SendEmail method used to send an email with subject, body and email address.<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-size: 9pt; line-height: 13px;"><br /></span></div>
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;">public class User<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;">{<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;"> public FirstName { get; set; }<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;"> public LastName { get; set; }<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;"> public UserName { get; set;}<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;"> public Password { get; set; }<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;"> public Email { get; set; } <o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;"> public User() { }<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;"> public bool SendEmail(IEmailSender emailSender) {<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;"> string subject = "Your Password";<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;"> string body = String.Format("{0} {1}, your password is {2}", FirstName, LastName, Password);<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;"> return emailSender.Send(subject, body, Email);<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;"> }<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-size: 9pt; line-height: 13px;"><span style="font-family: Verdana, sans-serif;">}</span><o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<br /></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 18px;">You will notice one thing here the User object depends on the instance of IEmailSender type to send mail for the specified user email address.<o:p></o:p></span></div>
</div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="color: #953735; font-size: 9pt; line-height: 13px;"><br clear="all" style="page-break-before: always;" /></span></span></div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;">public interface IEmailSender<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;">{<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;"> bool Send(string subject, string body, string email); <o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;">}<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 18px;">We will learn how we can mock the EmailSender and test the expected behavior.<o:p></o:p></span></div>
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 18px;"><br /></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 18px;">The below example is making use of Moq Framework for mock and unit testing<o:p></o:p></span></div>
<div style="text-align: justify;">
<span lang="EN-US" style="font-size: 12pt; line-height: 18px;"><br /></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;">[Test]<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;">public void User_Can_Send_Email()<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;">{<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;"> var emailMock = new Moq.Mock<IEmailSender>();<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;"> emailMock<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;"> .Expect(sender => sender.Send(It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>()))<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;"> .Returns(true); <o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;"> User user = new User();<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;"> Assert.That(user.SendEmail(emailMock.Object) == true);<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt; line-height: 13px;">}<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0in;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 18px;">The unit tests creates a mock object of type IEmailSender and sets the expectation for Send method with any arguments passed as a parameter to it should return ‘true’.<o:p></o:p></span></div>
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 18px;"><br /></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="font-size: 12pt; line-height: 18px;">At the ends of the unit test, we did an assertion for the user.SendMail to verify for the true value. You can also add a .Verifiable() on the end of the mock setup code and then call emailMock.Verify() after you run your test code and verify that the method was actually called</span>.</span><o:p></o:p></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<br /></div>
</div>
<div class="MsoNormal">
<h3 style="text-align: justify;">
<b><span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 18px;">An Example for a Stubbed Class</span></b></h3>
<div style="text-align: justify;">
<span style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt;">public class StubbedSecurityDataStore : ISecurityDataStore</span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt;">{<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt;"> public bool Authenticate(string userName, string password)<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt;"> {<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt;"> return true;<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt;"> }<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt;"> public string[] GetRoles(string userName)<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt;"> {<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt;"> return new string[]{“Admin”, “Write”, “Read”};<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-family: Verdana, sans-serif; font-size: 9pt;"> }<o:p></o:p></span></div>
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<div style="text-align: justify;">
<span lang="EN-US" style="color: #953735; font-size: 9pt;"><span style="font-family: Verdana, sans-serif;">}</span><o:p></o:p></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<br /></div>
</div>
<div class="MsoNormal">
<h3 style="text-align: justify;">
<b><span lang="EN-US" style="font-size: 12pt; line-height: 18px;"><span style="font-family: Verdana, sans-serif;">About Moq Framework</span></span></b></h3>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 18px;">Moq is an open source framework and has adopted an API that tries to be both simple to learn and easy to use. The API also follows the arrange-act-assert style and relies heavily on .NET 3.5 features, such as lambdas and extension methods. The learning curve is quite easy, but you need to feel comfortable with using lambdas. </span></div>
</div>
<div style="text-align: justify;">
<span style="font-family: Calibri, sans-serif;"><span style="line-height: 18px;"><b><br /></b></span></span></div>
<div class="MsoNormal">
<h3 style="text-align: justify;">
<b><span lang="EN-US" style="font-size: 12pt; line-height: 18px;"><span style="font-family: Verdana, sans-serif;">Difference between Mock and Stubs</span></span></b></h3>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 18px;">Mock objects are used to define expectations i.e. we expect some methods to be called with such and such parameters. Mocks record and verify such expectations.</span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 18px;"><br /></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="font-size: 12pt; line-height: 18px;">Stubs, on the other hand have a different purpose: they do not record or verify expectations, but rather allow us to provide “fake” objects in order to utilize a test scenario. Stubbing a method is all about replacing the method with code that returns a specified result</span>. Most important thing is a stub will never cause a test to fail.<o:p></o:p></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<br class="Apple-interchange-newline" /></div>
</div>
</div>Ranjan Dailatahttp://www.blogger.com/profile/01485829723000549876noreply@blogger.com2tag:blogger.com,1999:blog-5117833261590722982.post-89187013897537412432012-02-12T01:50:00.000-08:002012-05-28T20:28:54.363-07:00<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<h2>
<b><h2>
<b><span lang="EN-US" style="font-size: 18pt; line-height: 27px;"><br class="Apple-interchange-newline" /></span></b><b><span lang="EN-US" style="font-size: 18pt; line-height: 27px;">Licensing a product with the help of Licenser</span></b></h2>
</b></h2>
<div class="MsoNormal">
<h3>
<b><span lang="EN-US" style="font-size: 14pt; line-height: 21px;"><br /></span></b></h3>
<h3>
<b><span lang="EN-US" style="font-size: 14pt; line-height: 21px;">Introduction:</span></b></h3>
</div>
<div class="MsoNormal">
<br />
<span style="font-family: Verdana, sans-serif; line-height: 18px;">This article explains the importance of why licensing a product/application is important. Also explains how we can re-use open source License Manager Tools in our application.</span><br />
<span style="font-family: Verdana, sans-serif;"><span style="line-height: 18px;"><br /></span><span style="line-height: 18px;">Consider a scenario where in you have developed a small application for a customer. At first you may not be thinking about licensing part. You may have developed as a prototype or a proof of concept and deliver it to the customer. She/he may be happily using all the features that you have provided in your application. The customer may also install and use your application in more than one system.</span></span><br />
<span style="font-family: Verdana, sans-serif;"><span style="line-height: 18px;"><br /></span></span><br />
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;"></span><br />
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;">Eventually as the product/ application features get enhanced, one has to think about how we can license a feature so that we can restrict the clients from being using that. Or you can think about selling your product based upon some features. This is where product or application licensing by features comes into picture and it is very much important for a product/ application developer or an organization.</span></div>
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;"></span><br />
<div style="font-size: 14pt; text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;"><span style="font-size: 14pt; line-height: 21px;"><br /></span></span></div>
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;"></span><span style="font-family: Verdana, sans-serif;"></span><br />
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="line-height: 18px;">We shall see how to license our applications with the help of one Open Source codeplex tool named Licenser which is located at </span><a href="http://licenser.codeplex.com/"><span style="line-height: 18px;">http://licenser.codeplex.com/</span></a></span></div>
<span style="font-family: Verdana, sans-serif;"></span><br />
<br />
<span style="font-family: Verdana, sans-serif; line-height: 18px;"></span><br />
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif; line-height: 18px;">The Licenser package has the following things:</span></div>
<span style="font-family: Verdana, sans-serif; line-height: 18px;"></span><span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;"></span><br />
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;">1. Licenser / Production – A license production tool</span></div>
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;"></span><span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;"></span><br />
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;">2. Licenser / API – An API for checking a license</span></div>
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;"></span><span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;"><div style="text-align: justify;">
3. Licenser / Identification – A tool that is used one-time by the end-user to display the computer id.</div>
</span><span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<span style="line-height: 18px;"> </span><span style="line-height: 18px;"> </span></div>
</span><span style="font-family: Verdana, sans-serif;"><div style="text-align: justify;">
<span lang="EN-US" style="line-height: 18px;">The first thing which is required for licensing is the client computer id. </span><span style="line-height: 18px;">Ask your client to run LicenserIdentification.exe and send the computer id.</span></div>
</span></div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span style="font-size: 14pt; line-height: 21px;"><br /></span></div>
</div>
<div class="MsoNormal">
<span style="font-size: 14pt; line-height: 21px;"></span><span lang="EN-US" style="font-size: 14pt; line-height: 21px;"><o:p></o:p></span></div>
<div class="separator" style="clear: both; text-align: justify;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOqGCEJh4Lqo_xyDntl4DH4Ht5fMCIUQzNoeIgnDSkYqnKO0JGZPFtzvWAhBu8E3HaEQKY_Dh_EiFWmVMrg01Pw_v8vs7veGTsTzuDu8PdYkiS9QsWOwbNDMTvdxX2Y3pd7tJ7cnS59dg/s1600/LicenserIdentification.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="158" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOqGCEJh4Lqo_xyDntl4DH4Ht5fMCIUQzNoeIgnDSkYqnKO0JGZPFtzvWAhBu8E3HaEQKY_Dh_EiFWmVMrg01Pw_v8vs7veGTsTzuDu8PdYkiS9QsWOwbNDMTvdxX2Y3pd7tJ7cnS59dg/s320/LicenserIdentification.png" width="320" /></a></div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span style="font-size: 19px; line-height: 21px;"><br /></span></div>
</div>
<div class="MsoNormal">
<h3>
<b><span lang="EN-US" style="font-size: 14pt; line-height: 21px;">Creating a License File:</span></b></h3>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span style="line-height: 18px;"><span style="font-family: Verdana, sans-serif;">Once you receive the customer Id you are ready to go with generating a license for your client. Run LicenserProduction.exe , Click on File -> New</span></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-size: 14pt; line-height: 21px;"><br /></span></div>
</div>
<div class="separator" style="clear: both; text-align: justify;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghKFzqlj2jriTIs4FTuSYWa5bML_1HtefaBm728raPVKaJSWj1B0L-4LGrP4cv9PykZJS3dkX87jjEV28KNGeQeJQfFroLWkXTuzB7qJD8yoE9gKTflnsyx68qJiFFW8q7qpgEtwqHVuc/s1600/LicenserProduction.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="227" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEghKFzqlj2jriTIs4FTuSYWa5bML_1HtefaBm728raPVKaJSWj1B0L-4LGrP4cv9PykZJS3dkX87jjEV28KNGeQeJQfFroLWkXTuzB7qJD8yoE9gKTflnsyx68qJiFFW8q7qpgEtwqHVuc/s320/LicenserProduction.png" width="320" /></a></div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-size: 14pt; line-height: 21px;"><br /></span></div>
</div>
<div class="MsoNormal">
<span style="font-size: 14pt; line-height: 21px;"></span><span lang="EN-US" style="font-size: 14pt; line-height: 21px;"><o:p></o:p></span></div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;">Fill in the customer details and save it.<o:p></o:p></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="line-height: 18px;"><span style="font-family: Verdana, sans-serif;">Right click on the customer and click on New License</span><span style="font-size: medium;"><o:p></o:p></span></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<br /></div>
</div>
<div class="separator" style="clear: both; text-align: justify;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJASvwKDONOhPRMJ1fw56xE7oKyHoundfDVr_YYvuCWgBmoPs3PgjhkUcsPjpnHhjJMJUwvRsQS5zEfJvVNs1xiSaF4GtQbIJJDPTyOhon1jNgajjyhfGDvHTsslpkGoOsESwjjYN8lhY/s1600/NewLicense.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="231" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjJASvwKDONOhPRMJ1fw56xE7oKyHoundfDVr_YYvuCWgBmoPs3PgjhkUcsPjpnHhjJMJUwvRsQS5zEfJvVNs1xiSaF4GtQbIJJDPTyOhon1jNgajjyhfGDvHTsslpkGoOsESwjjYN8lhY/s320/NewLicense.png" width="320" /></a></div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span style="font-size: 19px; line-height: 21px;"><br /></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;">You need to fill in the following details and click on OK button to save the information<o:p></o:p></span></div>
</div>
<div class="MsoListParagraphCxSpFirst" style="text-indent: -0.25in;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="line-height: 18px;">1.<span style="line-height: normal;"> </span></span><span lang="EN-US" style="line-height: 18px;">Product name: Name of the product for which you want to license.<o:p></o:p></span></span></div>
</div>
<div class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="line-height: 18px;">2.<span style="line-height: normal;"> </span></span><span lang="EN-US" style="line-height: 18px;">License Type:<o:p></o:p></span></span></div>
</div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1in; text-indent: -0.25in;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="line-height: 18px;">a.<span style="line-height: normal;"> </span></span><span lang="EN-US" style="line-height: 18px;">Node Locked License: You are licensing based upon the computer Id.<o:p></o:p></span></span></div>
</div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 1in; text-indent: -0.25in;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="line-height: 18px;">b.<span style="line-height: normal;"> </span></span><span lang="EN-US" style="line-height: 18px;">Demo license: Used for demo purpose and not in production.<o:p></o:p></span></span></div>
</div>
<div class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="line-height: 18px;">3.<span style="line-height: normal;"> </span></span><span lang="EN-US" style="line-height: 18px;">Password: The password with which you want to license you client. You can choose any password and send it across to your client. The client will make use of this while using the product. The LicenserAPI will validate based upon the License file, password and Feature name.<o:p></o:p></span></span></div>
</div>
<div class="MsoListParagraphCxSpLast" style="text-indent: -0.25in;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="line-height: 18px;">4.<span style="line-height: normal;"> </span></span><span lang="EN-US" style="line-height: 18px;">Computer Ids: Computer Id of the client for which you want to generate a license.<o:p></o:p></span></span></div>
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
</div>
<div class="MsoNormal">
<span style="font-family: Verdana, sans-serif;"><span style="line-height: 18px;"></span><span lang="EN-US" style="line-height: 18px;"><o:p></o:p></span></span></div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;">Adding product features for licensing<o:p></o:p></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;"><br /></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;">In the Feature grid, key in the Feature Name. You have an option to make it either time dependent or not. If ‘IsTimeDependent’ is checked then you will have to provide the Expiration date.<o:p></o:p></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;">Click on ‘Generate’ button to generate the License file. A Save dialog will be opened with a default file name. Just select the location where you wish to save the license file.<o:p></o:p></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;"><br /></span></div>
</div>
<div class="separator" style="clear: both; text-align: justify;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6gHpNuafL06xW_szmV2X_xewaXHMiGcjEluSAx0VcAgVQf8Uz-eeoDlBdceHPMVEEPJ_9lSh5ac8nHhJZ2yeye67DRodvffQDtfD4aWE6cQ0K89MnMcf49QVENVjretkTX2T3WXsjAaY/s1600/LicenseProduct.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: Verdana, sans-serif;"><img border="0" height="231" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6gHpNuafL06xW_szmV2X_xewaXHMiGcjEluSAx0VcAgVQf8Uz-eeoDlBdceHPMVEEPJ_9lSh5ac8nHhJZ2yeye67DRodvffQDtfD4aWE6cQ0K89MnMcf49QVENVjretkTX2T3WXsjAaY/s320/LicenseProduct.png" width="320" /></span></a></div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;"><br /></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<b><span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;">Test License<o:p></o:p></span></b></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<b><span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;"><br /></span></b></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;">Now we will see how we can test the license by product feature from the LicenserProduction tool.<o:p></o:p></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;"><br /></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;">Under Customer -> Right click and select Test License. Below is the screen which pops up.<o:p></o:p></span></div>
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;"><br /></span></div>
</div>
<div class="separator" style="clear: both; text-align: justify;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZ3rSXfZQGxYyDFaQoTAHYjYOMhCDdFNB0xTD4icADyxFqPSf2Glbl3m4kMx8CaQQVwzXdZzJAVaTMxytb9kwDkUO9BvdxyNTgc0hb7VrTcpMRfVo0FRW_92yIdBgQMnXFuNOxoVHxKg8/s1600/TestLicense.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: Verdana, sans-serif;"><img border="0" height="233" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZ3rSXfZQGxYyDFaQoTAHYjYOMhCDdFNB0xTD4icADyxFqPSf2Glbl3m4kMx8CaQQVwzXdZzJAVaTMxytb9kwDkUO9BvdxyNTgc0hb7VrTcpMRfVo0FRW_92yIdBgQMnXFuNOxoVHxKg8/s320/TestLicense.png" width="320" /></span></a></div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
</div>
<div class="MsoNormal">
<span style="font-family: Verdana, sans-serif;"><span style="line-height: 18px;"></span><span lang="EN-US" style="line-height: 18px;"><o:p></o:p></span></span></div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;">Testing the license file requires the following.<o:p></o:p></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;"><br /></span></div>
</div>
<div class="MsoListParagraphCxSpFirst" style="text-indent: -0.25in;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="line-height: 18px;">1.<span style="line-height: normal;"> </span></span><span lang="EN-US" style="line-height: 18px;">Selecting the License file.<o:p></o:p></span></span></div>
</div>
<div class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="line-height: 18px;">2.<span style="line-height: normal;"> </span></span><span lang="EN-US" style="line-height: 18px;">Key in the password that you have chosen while generating the license for your customer.<o:p></o:p></span></span></div>
</div>
<div class="MsoListParagraphCxSpLast" style="text-indent: -0.25in;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="line-height: 18px;">3.<span style="line-height: normal;"> </span></span><span lang="EN-US" style="line-height: 18px;">Enter the Feature name for which you want to test.<o:p></o:p></span></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;">Click on ‘Test’ button to verify whether the LicenserAPI validates with the information which you have provided.<o:p></o:p></span></div>
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;"><br /></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;">So now you got the license file, it has the list of features with which you can validate for a client to see if we can allow him to use a feature or not. </span></div>
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;"><br /></span></div>
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 18px;">You will have to use this information in your application to validate the client and provide access to use only those features which are meant for him.<o:p></o:p></span></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
</div>
<div class="MsoNormal">
<span style="font-family: Verdana, sans-serif;"><span style="line-height: 18px;"></span><span lang="EN-US" style="line-height: 18px;"><o:p></o:p></span></span></div>
<div class="separator" style="clear: both; text-align: justify;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaK-iFnAm_r-I_ix6JnXotJD1xdfY0LWfymz-ggLEn9LxGJmmay6Y__lXoKFMRZhBxaDSAoqIxi9TYUF6hJ059oLXHSeJJzoZTBxH38wq4VPmb-8RgzDbHFG_4piUT-11FBgP8d_oyFtk/s1600/TestLicenseSuccess.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><span style="font-family: Verdana, sans-serif;"><img border="0" height="225" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaK-iFnAm_r-I_ix6JnXotJD1xdfY0LWfymz-ggLEn9LxGJmmay6Y__lXoKFMRZhBxaDSAoqIxi9TYUF6hJ059oLXHSeJJzoZTBxH38wq4VPmb-8RgzDbHFG_4piUT-11FBgP8d_oyFtk/s320/TestLicenseSuccess.png" width="320" /></span></a></div>
<div class="MsoNormal">
<div style="text-align: justify;">
<br /></div>
</div>
<div class="MsoNormal">
<h3>
<b><span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: small; line-height: 21px;">Behind the scene of a Licenser Tool:</span></b></h3>
<div>
<b><span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: small; line-height: 21px;"><br /></span></b></div>
</div>
<div class="MsoNormal">
<div style="text-align: justify;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; line-height: 21px; text-indent: -0.25in;">The produced license file is digitally signed and it’s also specific for the licensed computer.</span></div>
</div>
<div class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="line-height: 21px;">·<span style="line-height: normal;"> </span></span></span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="line-height: 21px;"> In order to enhance security, the application has to pass to the licenser a PASSCODE during run-time.<o:p></o:p></span></span></div>
</div>
<div class="MsoListParagraphCxSpMiddle" style="text-indent: -0.25in;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="line-height: 21px;">·<span style="line-height: normal;"> </span></span></span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="line-height: 21px;"><span style="line-height: normal;"> T</span></span><span lang="EN-US" style="line-height: 21px;">here are no restrictions for the number of features being licensed for the product.<o:p></o:p></span></span></div>
</div>
<div class="MsoListParagraphCxSpLast" style="text-indent: -0.25in;">
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="line-height: 21px;">·<span style="line-height: normal;"> </span></span></span></div>
<div style="text-align: justify;">
<span style="font-family: Verdana, sans-serif;"><span lang="EN-US" style="line-height: 21px;"> The feature information, as well as the licensed computer identification together with the PASSCODE is encrypted into a digital signature that is written in the license file. So any tampering done to the license file say by modifying the information within it will invalidate the license.<o:p></o:p></span></span></div>
</div>
<br class="Apple-interchange-newline" /></div>Ranjan Dailatahttp://www.blogger.com/profile/01485829723000549876noreply@blogger.com0tag:blogger.com,1999:blog-5117833261590722982.post-42690242835577524952012-02-09T18:08:00.000-08:002012-02-09T19:04:43.471-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="MsoNormal">
<b><span lang="EN-US" style="font-size: 16pt; line-height: 115%;">Convert PowerPoint to HTML<o:p></o:p></span></b></div>
<div class="MsoNormal">
<b><span lang="EN-US" style="font-size: 16pt; line-height: 115%;"><br /></span></b></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;">Introduction:<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;">A tool developed to convert PowerPoint to HTML. It was
completely developed using .NET Framework 4.0 Winform Technology. <o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;">Consider a scenario, where you are preparing some
presentation for a client. Assume the client may not be having a PowerPoint
installed in his/her machine, he/she may wish to view the same PowerPoint
presentation through static HTML pages. <o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;">This tool evolved from the above requirement. It takes
PowerPoint as input and converts the same to static HTML pages.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;">Note: Surprisingly the MS PowerPoint did not provide
an option to Save As HTML.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;">Features of this tool:<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;"><br /></span></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l1 level1 lfo1; text-indent: -.25in;">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;">1.<span style="font: normal normal normal 7pt/normal 'Times New Roman';">
</span></span><span lang="EN-US" style="font-size: 14pt; line-height: 115%;">Convert PowerPoint to HTML static
pages.<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l1 level1 lfo1; text-indent: -.25in;">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;">2.<span style="font: normal normal normal 7pt/normal 'Times New Roman';">
</span></span><span lang="EN-US" style="font-size: 14pt; line-height: 115%;">Save HTML folder path settings: Once the settings are saved by the user; the HTML folder settings will be read and
displayed on the html folder path textbox for the subsequent use of the
application. <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l1 level1 lfo1; text-indent: -.25in;">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;">3.<span style="font: normal normal normal 7pt/normal 'Times New Roman';">
</span></span><span lang="EN-US" style="font-size: 14pt; line-height: 115%;">Minimize on System tray option: You
can simply minimize the application if you are not currently using it. On
minimize, the convertor will be on the system tray. You can notice a folder
icon for this tool in system tray.<o:p></o:p></span></div>
<span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 14pt; line-height: 115%;"><br clear="all" style="page-break-before: always;" />
</span>
<br />
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;">Snapshots:<o:p></o:p></span></div>
<div class="MsoListParagraph" style="mso-list: l0 level1 lfo2; text-indent: -.25in;">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;">1.<span style="font: normal normal normal 7pt/normal 'Times New Roman';">
</span></span><span lang="EN-US" style="font-size: 14pt; line-height: 115%;">Main screen <o:p></o:p></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3rCsEBXshxXxptCzErndplRgEuRmNPxQXmuxyxa8tHDD7GnJuUZQNJtnOjecXGGSEWNOlQh3lRVQn6Y9mVzBhqtQPFqbkEWzMF6tV4wLzKAmDC7fmkz89YDt-UiF1jYJuwDO00q72HDw/s1600/MainScreen.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="165" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3rCsEBXshxXxptCzErndplRgEuRmNPxQXmuxyxa8tHDD7GnJuUZQNJtnOjecXGGSEWNOlQh3lRVQn6Y9mVzBhqtQPFqbkEWzMF6tV4wLzKAmDC7fmkz89YDt-UiF1jYJuwDO00q72HDw/s320/MainScreen.png" width="320" /></a></div>
<div class="MsoNormal">
<span style="font-size: 19px; line-height: 21px;"><br /></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoListParagraph" style="mso-list: l0 level1 lfo2; text-indent: -.25in;">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;">2.<span style="font: normal normal normal 7pt/normal 'Times New Roman';">
</span></span><span lang="EN-US" style="font-size: 14pt; line-height: 115%;">Select a PowerPoint by clicking on
the Open PowerPoint File button. Then type the HTML folder path.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-size: 14pt; line-height: 115%;"></span><span lang="EN-US" style="font-size: 14pt; line-height: 115%;"><o:p></o:p></span></div>
<span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 14pt; line-height: 115%;"><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 14pt; line-height: 115%;"><br /></span><br />
<br clear="all" style="mso-special-character: line-break; page-break-before: always;" />
</span>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcmwoQGb7YFLIYqGgu_IMq-It4rolenx32zeLprnmXU-xp7EMkc30p1B-AVy1WnqJFIW3bhey3AC9q0yRKbcV_JVWGRvW59m1uXoi3cuc8dahasDT5bG7D4tK2ppM6hONUZHxjhUiKcnA/s1600/OpenPresentation.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="168" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcmwoQGb7YFLIYqGgu_IMq-It4rolenx32zeLprnmXU-xp7EMkc30p1B-AVy1WnqJFIW3bhey3AC9q0yRKbcV_JVWGRvW59m1uXoi3cuc8dahasDT5bG7D4tK2ppM6hONUZHxjhUiKcnA/s320/OpenPresentation.png" width="320" /></a></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoListParagraph" style="mso-list: l0 level1 lfo2; text-indent: -.25in;">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;">3.<span style="font: normal normal normal 7pt/normal 'Times New Roman';">
</span></span><span lang="EN-US" style="font-size: 14pt; line-height: 115%;">Click on the ‘Convert to HTML’ button
to convert the Powerpoint presentation to HTML static pages.<o:p></o:p></span></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="MsoNormal">
<span style="font-size: 19px; line-height: 21px;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcmwoQGb7YFLIYqGgu_IMq-It4rolenx32zeLprnmXU-xp7EMkc30p1B-AVy1WnqJFIW3bhey3AC9q0yRKbcV_JVWGRvW59m1uXoi3cuc8dahasDT5bG7D4tK2ppM6hONUZHxjhUiKcnA/s1600/OpenPresentation.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="168" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcmwoQGb7YFLIYqGgu_IMq-It4rolenx32zeLprnmXU-xp7EMkc30p1B-AVy1WnqJFIW3bhey3AC9q0yRKbcV_JVWGRvW59m1uXoi3cuc8dahasDT5bG7D4tK2ppM6hONUZHxjhUiKcnA/s320/OpenPresentation.png" width="320" /></a></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoListParagraph" style="mso-list: l0 level1 lfo2; text-indent: -.25in;">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;">4.<span style="font: normal normal normal 7pt/normal 'Times New Roman';">
</span></span><span lang="EN-US" style="font-size: 14pt; line-height: 115%;">Folder settings<o:p></o:p></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeELfMpD2LMDtHp97UQD8qlfKXNSEWpubmcsQFXRnleE7gMkdDISrSmstwJhdRadXXAJb4AZhmOC_dcT_vVR9dLjEyw0M3J36R51A3EkoU7dDbh2oqbsKA6ASETse68B2qGRzJPjLseaE/s1600/FolderSettings.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="173" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgeELfMpD2LMDtHp97UQD8qlfKXNSEWpubmcsQFXRnleE7gMkdDISrSmstwJhdRadXXAJb4AZhmOC_dcT_vVR9dLjEyw0M3J36R51A3EkoU7dDbh2oqbsKA6ASETse68B2qGRzJPjLseaE/s320/FolderSettings.png" width="320" /></a></div>
<div class="MsoNormal">
<span style="font-size: 19px; line-height: 21px;"><br /></span></div>
<div class="MsoListParagraph" style="mso-list: l0 level1 lfo2; text-indent: -.25in;">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;">5.<span style="font: normal normal normal 7pt/normal 'Times New Roman';">
</span></span><span lang="EN-US" style="font-size: 14pt; line-height: 115%;">About Us <o:p></o:p></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNMzRorYpxzkwoDhqZrxp0agpk5ZfAsleXHytbGLckNFLrhVpK3u0iGpU2obIr-_CIRpZIDLcmnTYm1YqFd4Yd_vxDcKkqFmRXdAlqDOt7EJD5aTD6GZ32ruJQTAv4Dj_yI9CCuOQCRJY/s1600/AboutUs.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="232" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNMzRorYpxzkwoDhqZrxp0agpk5ZfAsleXHytbGLckNFLrhVpK3u0iGpU2obIr-_CIRpZIDLcmnTYm1YqFd4Yd_vxDcKkqFmRXdAlqDOt7EJD5aTD6GZ32ruJQTAv4Dj_yI9CCuOQCRJY/s320/AboutUs.png" width="320" /></a></div>
<div class="MsoNormal">
<span style="font-size: 19px; line-height: 21px;"><br /></span></div>
</div>Ranjan Dailatahttp://www.blogger.com/profile/01485829723000549876noreply@blogger.com0tag:blogger.com,1999:blog-5117833261590722982.post-45673333960831758942012-01-29T02:29:00.000-08:002012-01-29T18:20:01.633-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;">Remote System Monitoring and Controlling via Web based
Mobile or Desktop Application<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<b><span lang="EN-US">Introduction:<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span lang="EN-US"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US">The idea of
remote system monitoring and controlling application is to do some of the
actions like ex: Shutdown, Reboot, Hibernate of the users systems remotely. The
user can also make use of this application to query additional details of the
systems.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US">Consider a
scenario where you have a set of systems (Computers) and you want to control
them from your mobile or any other desktop anywhere from the world. So this
started as initial requirement of how we can implement the same to control
numerous systems remotely. <o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US">Consider
another scenario of how you can retrieve the information of a particular system
remotely from your handheld devices or through desktops. By retrieving
information, one may be interested in knowing the following<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US"><br /></span></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l2 level1 lfo1; text-indent: -18.0pt;">
<span lang="EN-US">1.<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Machine Name<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l2 level1 lfo1; text-indent: -18.0pt;">
<span lang="EN-US">2.<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">CPU information<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l2 level1 lfo1; text-indent: -18.0pt;">
<span lang="EN-US">3.<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Username<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l2 level1 lfo1; text-indent: -18.0pt;">
<span lang="EN-US">4.<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Domain Name<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l2 level1 lfo1; text-indent: -18.0pt;">
<span lang="EN-US">5.<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">OS Version<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l2 level1 lfo1; text-indent: -18.0pt;">
<span lang="EN-US"><br /></span></div>
<div class="MsoNormal">
<b><span lang="EN-US">Software
Requirements Specification<br /><br /><o:p></o:p></span></b></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l1 level1 lfo2; text-indent: -18.0pt;">
<span lang="EN-US">1.<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Aim: The aim of this project is to
provide a facility for the end user to remotely control their systems through
desktop or mobile based web application.<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l1 level1 lfo2; text-indent: -18.0pt;">
<span lang="EN-US">2.<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Purpose: The purpose of this project
is to implement a proof or concept of the same. And to show how easily it can
be done with .NET technology <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l1 level1 lfo2; text-indent: -18.0pt;">
<span lang="EN-US">3.<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Scope: The scope of this project is
very limited to controlling the system with few actions like Shutdown, Reboot,
Hibernate, Logoff, Force close all applications etc. The user registration is
done only at the client application and the it should be always running
in-order to control the system remotely. <o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l1 level1 lfo2; text-indent: -18.0pt;">
<span lang="EN-US"><br /></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l1 level1 lfo2; text-indent: -18.0pt;">
<span lang="EN-US">4.<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">User Characteristics: The Following things are taken into
consideration with this software development<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 72.0pt; mso-add-space: auto; mso-list: l1 level2 lfo2; text-indent: -18.0pt;">
<span lang="EN-US">a.<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Users can have multiple systems for
controlling. There is absolutely no limit in the number of systems being
controlled by the users.<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 72.0pt; mso-add-space: auto; mso-list: l1 level2 lfo2; text-indent: -18.0pt;">
<span lang="EN-US">b.<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">The user can either control her/his
systems through mobile or desktop based web application.<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="margin-left: 72.0pt; mso-add-space: auto; mso-list: l1 level2 lfo2; text-indent: -18.0pt;">
<span lang="EN-US">c.<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Each user can control his/her system
only and don’t have access to control others systems.<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="margin-left: 72.0pt; mso-add-space: auto; mso-list: l1 level2 lfo2; text-indent: -18.0pt;">
<span lang="EN-US">d.<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Right now there is only one type of
user of this system i.e. the System Administrators who will be using this
system to control or fetch additional information of the system on their own
interest.<o:p></o:p></span></div>
<b><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 11pt; line-height: 115%;"><br clear="all" style="mso-special-character: line-break; page-break-before: always;" />
</span></b>
<br />
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span lang="EN-US">Software
and Hardware Requirement<o:p></o:p></span></b></div>
<div class="MsoNormal">
<b><span lang="EN-US"><br /></span></b></div>
<div class="MsoNormal">
<b><span lang="EN-US">Software
Requirements:<o:p></o:p></span></b></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 15.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo3; tab-stops: list 36.0pt; text-indent: -18.0pt;">
<span style="font-family: Symbol; font-size: 10pt;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span>Operating system: Microsoft Windows XP / Win 7 / Vista<o:p></o:p></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 15.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo3; tab-stops: list 36.0pt; text-indent: -18.0pt;">
<span style="font-family: Symbol; font-size: 10pt;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span>.NET framework 4.0<o:p></o:p></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 15.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l0 level1 lfo3; tab-stops: list 36.0pt; text-indent: -18.0pt;">
<span style="font-family: Symbol; font-size: 10pt;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span>SQL Server 2008<o:p></o:p></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal">
<b><span lang="EN-US">Hardware
Requirements:<o:p></o:p></span></b></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 15.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l3 level1 lfo4; tab-stops: list 36.0pt; text-indent: -18.0pt;">
<span style="font-family: Symbol; font-size: 10pt;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span>Processor Pentium 4<o:p></o:p></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 15.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l3 level1 lfo4; tab-stops: list 36.0pt; text-indent: -18.0pt;">
<span style="font-family: Symbol; font-size: 10pt;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span>RAM- 256Mb<o:p></o:p></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 15.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l3 level1 lfo4; tab-stops: list 36.0pt; text-indent: -18.0pt;">
<span style="font-family: Symbol; font-size: 10pt;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span>HDD-10GB<o:p></o:p></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal">
<b><span lang="EN-US">Technologies
Used</span></b><b><span style="font-family: Arial, sans-serif; font-size: 10pt; line-height: 115%;"><o:p></o:p></span></b></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 15.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l3 level1 lfo4; tab-stops: list 36.0pt; text-indent: -18.0pt;">
<span lang="EN-US" style="font-family: Symbol; font-size: 10pt;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';">
</span></span><span lang="EN-US">Visual
Studio.NET<o:p></o:p></span></div>
<ul style="margin-top: 0cm;" type="disc">
<ul style="margin-top: 0cm;" type="circle">
<li class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-list: l3 level2 lfo4; tab-stops: list 72.0pt;"><span lang="EN-US">The
Client Application is developed with .NET C# Winform technology<o:p></o:p></span></li>
<li class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-list: l3 level2 lfo4; tab-stops: list 72.0pt;"><span lang="EN-US">The Server
side web application is developed with ASP.NET MVC3 technology. <o:p></o:p></span></li>
</ul>
</ul>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 72.0pt; margin-right: 0cm; margin-top: 0cm;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 15.0pt; margin-right: 0cm; margin-top: 0cm; mso-list: l3 level1 lfo4; tab-stops: list 36.0pt; text-indent: -18.0pt;">
<span lang="EN-US" style="font-family: Symbol; font-size: 10pt;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';">
</span></span><span lang="EN-US">Internet
based / Cloud based Microsoft SQL Server 2008<o:p></o:p></span></div>
<ul style="margin-top: 0cm;" type="disc">
<ul style="margin-top: 0cm;" type="circle">
<li class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm; mso-list: l3 level2 lfo4; tab-stops: list 72.0pt;"><span lang="EN-US">This
software is designed with Software as a Service model with a common
single cloud database which stores all the users and their system
information</span><span style="font-family: Arial, sans-serif; font-size: 10pt;">. </span><span lang="EN-US"><o:p></o:p></span></li>
</ul>
</ul>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal">
<b><span lang="EN-US">How does
the software functions?</span></b><b><span style="font-family: Arial, sans-serif; font-size: 10pt; line-height: 115%;"><o:p></o:p></span></b></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span lang="EN-US">Client
Application:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span lang="EN-US">When
you run the client application for the first time, you will have to register
yourself with the username and password. The same has to be provided as log on
information which will authenticate the user in client and server applications.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span lang="EN-US">Once
authenticated, the user has to click on the Start button for continuous
monitoring of the system behind the scene. The system registers by itself by
putting an entry in database (this happens only for the first usage of the client app)
so that the user can control that particular machine. When the user closes the client application,
the entry in the database for that system will be deactivated. For subsequent usable of the client application,
the system will be activated for monitoring and controlling.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span lang="EN-US">Server
Application:<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span lang="EN-US">It
is a web based application, on requesting the user will be authenticated. The
use has to provide the same username and password he/she has provided at the
time of user registration in client app. <o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm;">
<span lang="EN-US">On successful
authentication, the list of active systems will be displayed in a screen. The
user can select one and perform the actions like Shutdown, Reboot etc.<o:p></o:p></span></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<b><span style="font-family: Arial, sans-serif; font-size: 10pt; line-height: 115%;"><br clear="all" style="mso-special-character: line-break; page-break-before: always;" />
</span></b>
<br />
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm;">
<b><span style="font-family: Arial, sans-serif; font-size: 10pt;">Database Entity Relationship Design Diagram<o:p></o:p></span></b></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSeBlWLPa0Tf1Bbeu5NBxHNpy3IrWUNG6HcbFwf7AVfGpqQXH5JOGuA07oTdhgZAzugukvqybbQWJ0jcRY8Zch8hEV69IOyGm31lCDmGKygrnBlaw0Uy-Zqo5CRe5ifNrkRs-c8Bkkbe4/s1600/DatabaseEntityDiagram.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSeBlWLPa0Tf1Bbeu5NBxHNpy3IrWUNG6HcbFwf7AVfGpqQXH5JOGuA07oTdhgZAzugukvqybbQWJ0jcRY8Zch8hEV69IOyGm31lCDmGKygrnBlaw0Uy-Zqo5CRe5ifNrkRs-c8Bkkbe4/s1600/DatabaseEntityDiagram.png" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<b style="background-color: white; line-height: 12.75pt;"><span style="font-family: Arial, sans-serif; font-size: 10pt;">Snapshots of Client App</span></b></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUnUEaxPNk5pT3TjVjTLiRKrgSWENql6hW01sgXlVNbY8TVdHQS9NE3SYD3mbjGCk4OkjW3VtgE1uAG7xcB1zywVkG99DNH6wF3YP6RcT-8ohx4R_4-umTCg-KjC4q87EoJbfvpuzs-d0/s1600/LogOn.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="177" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUnUEaxPNk5pT3TjVjTLiRKrgSWENql6hW01sgXlVNbY8TVdHQS9NE3SYD3mbjGCk4OkjW3VtgE1uAG7xcB1zywVkG99DNH6wF3YP6RcT-8ohx4R_4-umTCg-KjC4q87EoJbfvpuzs-d0/s320/LogOn.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgz4-PmV5IOcrsF7okjZf90oYa3wowYM9UPXDFyfkLhwJ9FzFYp_DUPFk6-WgoiBAaPfsRI4TVIggYJyrwINNSj9LjkBa7DgQsmlJ7qo9G_FtFFS-qPzzr-MtruiMv1Edz1c0u0OSkheBM/s1600/RegisterUser.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="176" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgz4-PmV5IOcrsF7okjZf90oYa3wowYM9UPXDFyfkLhwJ9FzFYp_DUPFk6-WgoiBAaPfsRI4TVIggYJyrwINNSj9LjkBa7DgQsmlJ7qo9G_FtFFS-qPzzr-MtruiMv1Edz1c0u0OSkheBM/s320/RegisterUser.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimFNsCoS48LzHf7TNTlnz8xEn4_wrNxMZ_zq3fg_qKrACIBdXwkrbT-g7w11Qczr-Cn8jSoyxyP0qaAs3Mj3rEs8emHoObibuF-RSDIGZfuqk1rIEBWvfrSbc3REFjtWzui5POdbKpQJ0/s1600/StartMonitoring.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="215" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEimFNsCoS48LzHf7TNTlnz8xEn4_wrNxMZ_zq3fg_qKrACIBdXwkrbT-g7w11Qczr-Cn8jSoyxyP0qaAs3Mj3rEs8emHoObibuF-RSDIGZfuqk1rIEBWvfrSbc3REFjtWzui5POdbKpQJ0/s320/StartMonitoring.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<b style="background-color: transparent;"><span style="font-family: Arial, sans-serif; font-size: 10pt; line-height: 115%;">Snapshots of
Server Application</span></b></div>
<div class="MsoNormal">
<b><span style="font-family: Arial, sans-serif; font-size: 10pt; line-height: 115%;"></span></b><b><span style="font-family: Arial, sans-serif; font-size: 10pt; line-height: 115%;"> <o:p></o:p></span></b></div>
<div class="MsoNormal">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4tU8SRjM6aYvGufuCtZHD0I9pmwOi_NN6Ktlc_3M0lmWUTaKZUc6meB-ciuqr4wM_R05MVxyokM2L5GFAU1Z20HKoqpAziYv98uvBgQ-CGcYFqFs5OuPst4bNde4bQ1aB4J3nwsf4ygc/s1600/MobileLogon.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4tU8SRjM6aYvGufuCtZHD0I9pmwOi_NN6Ktlc_3M0lmWUTaKZUc6meB-ciuqr4wM_R05MVxyokM2L5GFAU1Z20HKoqpAziYv98uvBgQ-CGcYFqFs5OuPst4bNde4bQ1aB4J3nwsf4ygc/s320/MobileLogon.png" width="176" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaUSPa2Ghh7Ov___ECWELPDkwcyQTyjdmbIFWKWaDIJAxjcSH4M6DqDRySbh4610SofNz__P6zwypCBLj38HI_wDK1efdwoCx8t4eY3yHb51hWESzPIUaamzYiZsLfRoY9t7hvPWiBqkw/s1600/MobileSystemList.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaUSPa2Ghh7Ov___ECWELPDkwcyQTyjdmbIFWKWaDIJAxjcSH4M6DqDRySbh4610SofNz__P6zwypCBLj38HI_wDK1efdwoCx8t4eY3yHb51hWESzPIUaamzYiZsLfRoY9t7hvPWiBqkw/s320/MobileSystemList.png" width="172" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br /></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
<div class="MsoNormal" style="background: white; line-height: 12.75pt; margin-bottom: .0001pt; margin-bottom: 0cm;">
<br /></div>
</div>Ranjan Dailatahttp://www.blogger.com/profile/01485829723000549876noreply@blogger.com0tag:blogger.com,1999:blog-5117833261590722982.post-75345855298173711562012-01-19T10:16:00.000-08:002012-01-23T19:07:03.281-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;">Dependency Injection<o:p></o:p></span><br />
<span lang="EN-US" style="font-size: 14pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;">Dependency injection basically
allows us to create loosely coupled, reusable, and testable objects in your
software designs by removing dependencies</span>.<o:p></o:p><br />
<br /></div>
<div class="MsoNormal">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;">We will take a look into the
Object dependencies before digging in more.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;">Consider a scenario of fetching
an employee details and show display in UI. Let us say create a Business logic
layer class named EmployeeBAL and a data access layer class named EmployeeDAO <o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt;">
<span style="font-family: 'Courier New'; font-size: 9pt;"><br /></span><br />
<span style="font-family: 'Courier New'; font-size: 9pt;">public class EmployeeDao<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt;">
<span style="font-family: 'Courier New'; font-size: 9pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt;">
<span style="font-family: 'Courier New'; font-size: 9pt;"> //Some
code<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt;">
<span style="font-family: 'Courier New'; font-size: 9pt;">}<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt;">
<span style="font-family: 'Courier New'; font-size: 9pt;"><br /></span><br />
<span style="font-family: 'Courier New'; font-size: 9pt;">public class EmployeeBAL<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt;">
<span style="font-family: 'Courier New'; font-size: 9pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt;">
<span style="font-family: 'Courier New'; font-size: 9pt;"> var
employeeDAO = new EmployeeDao();<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt;">
<span style="font-family: 'Courier New'; font-size: 9pt;"> //Some
code<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt;">
<span style="font-family: 'Courier New'; font-size: 9pt;">}</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;">From the above code you will
notice one thing that we are creating EmployeeDAO instance inside the Business
logic layer class. So here comes the dependency<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;"><br /></span><br />
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;">What is wrong if we have a dependency?<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;"><br /></span><br />
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;">Think about whether your
code is unit testable. We cannot fully unit test the EmployeeBAL as it has a
dependency on Employee DAO. So we can say as long as the composition of the DAO
exists within the BAL we cannot unit test the EmployeeBAL.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;"><br /></span><br />
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;">You will also notice one more
thing here; with this type of implementation you will see a high coupling of
BAL and DAL.<span style="font-size: x-small;"><o:p></o:p></span></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;">How to make it loose coupling?<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;"><br /></span><br />
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;">The basic idea behind
Dependency Injection is that you should isolate the implementation of an object
from the construction of objects on which it depends</span>. <o:p></o:p><br />
<br /></div>
<div class="MsoNormal">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;">Coming to the example, we
should be isolating the implementation of EmployeeBAL object and the construction
of the dependent EmployeeDAO object. <o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;">We will see how we can make loosely
coupled objects in detail<o:p></o:p></span></div>
<div class="MsoListParagraph" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<span style="font-family: Arial, sans-serif; line-height: 115%;"><span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><br />
<span style="background-color: white; font-size: 9px; text-indent: -18pt;"> </span><u style="background-color: white; font-family: Arial, sans-serif; line-height: 115%; text-indent: -18pt;">Constructor based dependency injection</u><br />
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;"> </span><br />
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;"> We will
have to modify the EmployeeBAL to accept an EmployeeDAO instance within its
constructor.<span style="font-size: x-small;"><o:p></o:p></span></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; margin-left: 18pt; margin-right: 0cm; margin-top: 0cm;">
<span style="background-color: white; font-family: 'Courier New'; font-size: 9pt;"><br /></span><br />
<span style="background-color: white; font-family: 'Courier New'; font-size: 9pt;">public class EmployeeDao</span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; margin-left: 18pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: 'Courier New'; font-size: 9pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; margin-left: 18pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: 'Courier New'; font-size: 9pt;"> //Some
code<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; margin-left: 18pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: 'Courier New'; font-size: 9pt;">}<o:p></o:p></span></div>
<span style="font-family: 'Courier New'; font-size: 9pt; line-height: 115%;"><br clear="all" style="mso-special-character: line-break; page-break-before: always;" />
</span>
<br />
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; margin-left: 18pt; margin-right: 0cm; margin-top: 0cm;">
<br /></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; margin-left: 18pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: 'Courier New'; font-size: 9pt;">public class EmployeeBAL<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; margin-left: 18pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: 'Courier New'; font-size: 9pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; margin-left: 18pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: 'Courier New'; font-size: 9pt;"> EmployeeDao
employeeDAO;<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; margin-left: 18pt; margin-right: 0cm; margin-top: 0cm;">
<br /></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; margin-left: 18pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: 'Courier New'; font-size: 9pt;"> public EmployeeBAL(EmployeeDAO
employeeDao){<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; margin-left: 18pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: 'Courier New'; font-size: 9pt;"> this.employeeDAO = employeeDao; <o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; margin-left: 18pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: 'Courier New'; font-size: 9pt;"> }<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; margin-left: 18pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: 'Courier New'; font-size: 9pt;"> //Some
code<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; margin-left: 18pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: 'Courier New'; font-size: 9pt;">}</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoListParagraph" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;"><span style="font-size: x-small;"> </span><u>Property based dependency injection</u></span><span style="background-color: white; font-family: Arial, sans-serif; line-height: 115%;"><br /></span><br />
<span style="background-color: white; font-family: Arial, sans-serif; line-height: 115%;"> </span><br />
<span style="background-color: white; font-family: Arial, sans-serif; line-height: 115%;"> With
property based injection we will have a public getter and setter Property of
type EmployeeDao so that the dependency can be externally set.</span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; margin-left: 18pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: 'Courier New'; font-size: 9pt;"><br /></span><br />
<span style="font-family: 'Courier New'; font-size: 9pt;">public class EmployeeBAL<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; margin-left: 18pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: 'Courier New'; font-size: 9pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; margin-left: 18pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: 'Courier New'; font-size: 9pt;"> Public EmployeeDao EmployeeDataAccess{
get; set; } <o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; margin-left: 18pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: 'Courier New'; font-size: 9pt;">}</span><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; font-size: 10pt; line-height: 115%;"> <o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; margin-left: 18pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: 'Courier New'; font-size: 9pt;">var employeeBAL = new EmployeeBAL(); </span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt; margin-left: 18pt; margin-right: 0cm; margin-top: 0cm;">
<span style="font-family: 'Courier New'; font-size: 9pt;">EmployeeBAL.EmployeeDataAccess = new EmployeeDao();</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;">Wait!!!<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;"><br /></span><br />
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;">The above ones are just some
techniques of injecting the dependency. We are still yet to discuss one more interesting
thing Unit Testing.<o:p></o:p></span><br />
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;">Are you agreeing that we
have removed the DAO creation from the Business Logic EmployeeBAL? Yes it is
good but it still depends on the actual instance of EmployeeDao. <o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;"><br /></span><br />
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif; line-height: 115%;">Consider the below mentioned
implementation of the same sample senarios<o:p></o:p></span></div>
<pre style="background: white;"><code><span style="font-size: 9pt;">
</span></code></pre>
<pre style="background: white;"><code><span style="font-size: 9pt;">interface IDataAccess<o:p></o:p></span></code></pre>
<pre style="background: white;"><code><span style="font-size: 9pt;">{<o:p></o:p></span></code></pre>
<pre style="background: white;"><code><span style="font-size: 9pt;"> //Some code<o:p></o:p></span></code></pre>
<pre style="background: white;"><code><span style="font-size: 9pt;">}<o:p></o:p></span></code></pre>
<pre style="background: white;"><code><span style="font-size: 9pt;"> <o:p></o:p></span></code></pre>
<pre style="background: white;"><code><span style="font-size: 9pt;">class EmployeeDao : IDataAccess<o:p></o:p></span></code></pre>
<pre style="background: white;"><code><span style="font-size: 9pt;">{<o:p></o:p></span></code></pre>
<pre style="background: white;"><code><span style="font-size: 9pt;"> //Some code<o:p></o:p></span></code></pre>
<pre style="background: white;"><code><span style="font-size: 9pt;">}<o:p></o:p></span></code></pre>
<pre style="background: white;"><code><span style="font-size: 9pt;"> <o:p></o:p></span></code></pre>
<pre style="background: white;"><code><span style="font-size: 9pt;">public class EmployeeBAL<o:p></o:p></span></code></pre>
<pre style="background: white;"><code><span style="font-size: 9pt;">{<o:p></o:p></span></code></pre>
<pre style="background: white;"><code><span style="font-size: 9pt;"> private IDataAccess dataAccess;<o:p></o:p></span></code></pre>
<pre style="background: white;"><code><span style="font-size: 9pt;"> public BusinessFacade(IDataAccess dao)<o:p></o:p></span></code></pre>
<pre style="background: white;"><code><span style="font-size: 9pt;"> {<o:p></o:p></span></code></pre>
<pre style="background: white;"><code><span style="font-size: 9pt;"> dataAccess = dao;<o:p></o:p></span></code></pre>
<pre style="background: white;"><code><span style="font-size: 9pt;"> }<o:p></o:p></span></code></pre>
<pre style="background: white;"><code><span style="font-size: 9pt;">}<o:p></o:p></span></code></pre>
<pre style="background: white;"><code><span style="font-size: 9pt;"><o:p> </o:p></span></code></pre>
<pre style="background: white;"><span style="background-color: white; font-family: Arial, sans-serif;">You can notice we are doing a constructor dependency injection but most important thing here </span></pre>
<pre style="background: white;"><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif;">is we are using Interface type than creating a strongly typed object. </span></pre>
<pre style="background: white;"><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif;">
</span></pre>
<pre style="background: white;"><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif;">The advantage that we are getting here is we can have an In-memory data access object of</span></pre>
<pre style="background: white;"><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif;">IDataAccess interface type and we can </span><span style="background-color: white; font-family: Arial, sans-serif;">easily inject the dependency to the EmployeeBAL. </span></pre>
<pre style="background: white;"><span style="background-color: white; font-family: Arial, sans-serif;">By this way we need not inject the concrete instance of the data access object.</span></pre>
<pre style="background: white;"><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif;">
</span></pre>
<pre style="background: white;"><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif;">
Are you happy that we can unit test the BAL without the data access dependency?
<o:p></o:p></span></pre>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Arial, sans-serif;">Advantages of Dependency
Injection</span></b><span style="font-family: Arial, sans-serif;"><br />
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial;">The primary advantages of dependency injection
are:</span></span><span style="font-family: 'Times New Roman', serif;"><o:p></o:p></span></div>
<ul type="disc">
<li class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial;"><span style="font-family: Arial, sans-serif;">Loose coupling<o:p></o:p></span></li>
<li class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial;"><span style="font-family: Arial, sans-serif;">Centralized configuration<o:p></o:p></span></li>
<li class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial;"><span style="font-family: Arial, sans-serif;">Easily testable<span style="font-size: x-small;"><o:p></o:p></span></span></li>
</ul>
</div>Ranjan Dailatahttp://www.blogger.com/profile/01485829723000549876noreply@blogger.com0tag:blogger.com,1999:blog-5117833261590722982.post-50795137640704534172012-01-16T17:53:00.000-08:002012-01-17T18:03:38.203-08:003 Tier Architecture in .NET C#<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal">
<span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;"><br /></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPbNtbYLeblKMwhAV4kr_VQoiEHLVIMzGOeI-i2NPhO8_vMXpYx2DfEdazZ0tAZjRUWaO4BNMEl0QUitQjP9wwoqd4wbuxqtNOvTgRiQ43WLvASLKPVsvRzJWwMw0nAXJjwJIespxMtaU/s1600/N-TireSnapshot.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPbNtbYLeblKMwhAV4kr_VQoiEHLVIMzGOeI-i2NPhO8_vMXpYx2DfEdazZ0tAZjRUWaO4BNMEl0QUitQjP9wwoqd4wbuxqtNOvTgRiQ43WLvASLKPVsvRzJWwMw0nAXJjwJIespxMtaU/s320/N-TireSnapshot.png" width="286" /></a></div>
<div class="MsoNormal">
<span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">3-Tier architecture generally contains User
Interface (UI) or Presentation Layer, Business Access/Logic Layer (BAL) and
Data Access Layer (DAL).<span class="apple-converted-space"> </span><br />
<br />
<b>Presentation Layer (UI)</b><span class="apple-converted-space"> </span><br />
<br />
<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">Presentation layer is responsible for
displaying the views. Contains windows forms or ASP.NET pages, where data is
presented to the user or input is taken from the user.<span class="apple-converted-space"> We will consider a sample Windows form
application which will show the Authors information and details in the UI. </span><br />
<br />
<b>Business Access Layer (BAL) or Business Logic Layer<span class="apple-converted-space"> </span></b><br /><br />
</span></div>
<div class="MsoNormal">
<span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">BAL contains business logic, validations or calculations related with the data<o:p></o:p></span></div>
<div class="MsoNormal">
<b><span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;"><br /></span></b></div>
<div class="MsoNormal">
<b><span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">Business Entities<o:p></o:p></span></b></div>
<div class="MsoNormal">
<span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">Business entities are reusable entities
developed as per the application. We are making use of these entities in BAL
and DAL. The data access layer fetches the data and converts the data say to a
List of business entity. Ex: When we are retrieving a list of Authors details,
the DAL will fetch all the authors and returns List<AuthorsBE> list of author’s
business entities.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;"><br />
<b>Data Access Layer (DAL)</b><span class="apple-converted-space"> </span><br /><br />
</span></div>
<div class="MsoNormal">
<span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">DAL contains methods that helps business layer to connect the data and perform
required action, might be returning data or manipulating data (insert, update,
delete etc). For this demo pubs sample application, the BAL makes a call to
data access to get all the list of authors i.e GetAllAuthors(), to get all the
list of author titles GetAuthorTitleDetails(string authorID)<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">Advantages of N-Tier
Application<o:p></o:p></span></b></div>
<div class="MsoNormal">
<b><span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;"><br /></span></b></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">1.<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">Decoupling the logic: By loose coupling the logics of
Presentation, Business and Data access suppose if there is a change in the UI
layer, you will only have to worry about the modifications in the Presentation
layer. Right now it is using SQL Server database , if in future you are changing your mind in is using other databases , we will only have to modify the logic within the Data access
layer and nothing else is required.<b><o:p></o:p></b></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">2.<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">With layered architecture you can do the software development in
Parallel. That means you can code each layers independently<b><o:p></o:p></b></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">3.<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">Easy to Test: The testability of the software increases by
decoupling the logics into multiple layers. You can independently Unit Test the
logics of different layers<b><o:p></o:p></b></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l0 level1 lfo1; text-indent: -18.0pt;">
<span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">4.<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">Re usability of components<b><o:p></o:p></b></span></div>
<br />
<b><span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;"><br clear="all" style="mso-special-character: line-break; page-break-before: always;" />
</span></b>
<br />
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">How to run the sample<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpFirst" style="mso-list: l1 level1 lfo2; text-indent: -18.0pt;">
<span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">1)<span style="font: normal normal normal 7pt/normal 'Times New Roman';">
</span></span><span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">Download pubs database sample
from <a href="http://www.microsoft.com/download/en/details.aspx?id=23654"><span style="color: black; text-decoration: none;">http://www.microsoft.com/download/en/details.aspx?id=23654</span></a>
link<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l1 level1 lfo2; text-indent: -18.0pt;">
<span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">2)<span style="font: normal normal normal 7pt/normal 'Times New Roman';">
</span></span><span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">Open SQL Management studio and
execute the stored procedures with in the DataAccessLayer - > Scripts folder
in Pubs database.<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l1 level1 lfo2; text-indent: -18.0pt;">
<span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">3)<span style="font: normal normal normal 7pt/normal 'Times New Roman';">
</span></span><span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">Open PubsSamplePresentation.sln
Solution from VS 2010 or VS2011<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l1 level1 lfo2; text-indent: -18.0pt;">
<span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">4)<span style="font: normal normal normal 7pt/normal 'Times New Roman';">
</span></span><span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">Go to PubsSamplePresentation
and open App.config<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpMiddle" style="mso-list: l1 level1 lfo2; text-indent: -18.0pt;">
<span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">5)<span style="font: normal normal normal 7pt/normal 'Times New Roman';">
</span></span><span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">Change the connection string (PubsConnectionString)
value appropriately<o:p></o:p></span></div>
<div class="MsoListParagraphCxSpLast" style="mso-list: l1 level1 lfo2; text-indent: -18.0pt;">
<span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">6)<span style="font: normal normal normal 7pt/normal 'Times New Roman';">
</span></span><span style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">Run the Windows Form
application (PubsSamplePresentation) <o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<o:p><a href="http://electrofriends.com/wp-content/uploads/2012/01/PubsSamplePresentation.zip">Download Pubs Sample Application</a></o:p></div>
<div class="MsoNormal">
<br /></div>
</div>Ranjan Dailatahttp://www.blogger.com/profile/01485829723000549876noreply@blogger.com0tag:blogger.com,1999:blog-5117833261590722982.post-78179572265196622132012-01-16T17:43:00.000-08:002012-01-16T17:48:26.669-08:00<div dir="ltr" style="text-align: left;" trbidi="on">
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfU5zkvW-JyHKpwEAkgq9PBaJiqoDQKkFhDO10T-rYgJdvcpAFTRRA195hKR0wPg_zbkbA6zuQtKERhGrdlyRfDpQHcXZksLVuRaWzvUsS7uF4eMFLw-Ox-Ineg-jRymC0DljlRFQpZMo/s1600/ClassDiagram.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfU5zkvW-JyHKpwEAkgq9PBaJiqoDQKkFhDO10T-rYgJdvcpAFTRRA195hKR0wPg_zbkbA6zuQtKERhGrdlyRfDpQHcXZksLVuRaWzvUsS7uF4eMFLw-Ox-Ineg-jRymC0DljlRFQpZMo/s640/ClassDiagram.png" width="564" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Class Diagram of Logger Library</td></tr>
</tbody></table>
<br />
<br />
<div class="MsoNormal">
<b><span style="font-family: Verdana, sans-serif; font-size: 13pt; line-height: 115%;">Delegates</span></b><span style="font-size: 14pt; line-height: 115%;"> <span lang="EN-US"><o:p></o:p></span></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt;"><br /></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt;">A delegate in C# is similar to
a function pointer in C or C++. Using a delegate allows the programmer to
encapsulate a reference to a method inside a delegate object. The delegate
object can then be passed to code which can call the referenced method, without
having to know at compile time which method will be invoked.<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt;">The signature of a single cast
delegate is shown below:</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial;">
<b><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;">delegate
result-type identifier ([parameters]);</span></b><span style="font-family: 'Courier New'; font-size: 10pt;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial;">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt;">where:</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"><o:p></o:p></span></div>
<ul type="circle">
<li class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial;"><span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt;">result-type: The result type, which matches
the return type of the function.</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"><o:p></o:p></span></li>
<li class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial;"><span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt;">identifier: The delegate name.</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"><o:p></o:p></span></li>
<li class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial;"><span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt;">parameters: The Parameters that the function
takes.</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"><o:p></o:p></span></li>
</ul>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">Delegates allow a clearer separation
of specification and implementation. A delegate specifies the signature of a
method, and authors can write methods that are compatible with the delegate
specification.<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial;">
<a href="http://www.blogger.com/blogger.g?blogID=5117833261590722982" name="Multicast_delegates"><b><span style="color: #004cd5; font-family: Verdana, sans-serif; font-size: 13pt;"><br /></span></b></a></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial;">
<b style="background-color: white; font-family: Verdana, sans-serif; font-size: 17px;">Multicast Delegate</b></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">With multicast delegate, it is
just like a normal delegate but it can point to multiple functions so </span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">on invocation of such delegate it will invoke all
the methods and functions associated with the same one after another
sequentially.</span><span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial;">
<b><span style="color: #004cd5; font-family: Verdana, sans-serif; font-size: 13pt;"><br /></span></b></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial;">
<b><span style="font-family: Verdana, sans-serif; font-size: 13pt;">Events<span style="color: #004cd5;"><o:p></o:p></span></span></b></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">Events are wrapper around the
delegate. It sits on top of the delegate and provides only the necessary
encapsulation so that the destination objects can subscribe to the Event and
not have full control on the delegate object.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">Events are declared using
delegates. The delegate object encapsulates a method so that it can be called
anonymously. An event is a way for a class to allow clients to give it
delegates to methods that should be called when the event occurs. When the
event occurs, the delegate(s) given to it by its clients are invoked.<br clear="all" />
We will consider an example implementation of Logger application, which can be
used to log messages in Console, File or Database etc.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">We will declare a delegate
named LogWriteDelegate which accepts one parameter named message.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 115%;">public</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt; line-height: 115%;"> </span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 115%;">delegate</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt; line-height: 115%;"> </span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 115%;">void</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt; line-height: 115%;"> </span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #2b91af; font-family: Consolas; font-size: 9.5pt; line-height: 115%;">LogWriteDelegate</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt; line-height: 115%;">(</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 115%;">string</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt; line-height: 115%;"> message);</span><span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">Next we will declare an Event
of type LogWriteDelegate<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 115%;">public</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt; line-height: 115%;"> </span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 115%;">event</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt; line-height: 115%;"> </span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #2b91af; font-family: Consolas; font-size: 9.5pt; line-height: 115%;">LogWriteDelegate</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt; line-height: 115%;"> LogWriteEvent;</span><span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span style="font-family: Verdana, sans-serif; font-size: x-small;"><span style="line-height: 14px;"><br /></span></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">In our sample Logger the
FileLogger and ConsoleLogger will subscribe or register to the above mentioned
event so that when the Write method of logger is called the respective logic
within the Write method of FileLogger and ConsolLogger will also gets invoked.<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: blue; font-family: Consolas; font-size: 9.5pt;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: blue; font-family: Consolas; font-size: 9.5pt;">using</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt;"> (</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: blue; font-family: Consolas; font-size: 9.5pt;">var</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt;"> logger = </span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: blue; font-family: Consolas; font-size: 9.5pt;">new</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt;"> </span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #2b91af; font-family: Consolas; font-size: 9.5pt;">Logger</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt;">(</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #a31515; font-family: Consolas; font-size: 9.5pt;">"testing"</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt;">, </span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #2b91af; font-family: Consolas; font-size: 9.5pt;">EntryType</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt;">.Debug))<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt;">
logger.LogWriteEvent += </span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: blue; font-family: Consolas; font-size: 9.5pt;">new</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt;"> </span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #2b91af; font-family: Consolas; font-size: 9.5pt;">Logger</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt;">.</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #2b91af; font-family: Consolas; font-size: 9.5pt;">LogWriteDelegate</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt;">(consoleLogger.Write);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt;">
logger.LogWriteEvent += </span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: blue; font-family: Consolas; font-size: 9.5pt;">new</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt;"> </span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #2b91af; font-family: Consolas; font-size: 9.5pt;">Logger</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt;">.</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: #2b91af; font-family: Consolas; font-size: 9.5pt;">LogWriteDelegate</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt;">(fileLogger.Write);<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt;">
logger.Write();<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt; line-height: 115%;">}</span><span style="font-family: Consolas; font-size: 9.5pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">You can notice here a
multicast delegate; the LogWriteEvent is being registered with Console and File
log write methods.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">While firing an Event within
the Logger object, it is always a good practice to check whether the event is
registered or not. <o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: blue; font-family: Consolas; font-size: 9.5pt;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: blue; font-family: Consolas; font-size: 9.5pt;">public</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt;"> </span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: blue; font-family: Consolas; font-size: 9.5pt;">void</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt;"> Write()<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt;">{<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt;"> </span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: blue; font-family: Consolas; font-size: 9.5pt;">if</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt;"> (LogWriteEvent != </span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; color: blue; font-family: Consolas; font-size: 9.5pt;">null</span><span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt;">)<o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt;">
LogWriteEvent(ToString());<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; font-family: Consolas; font-size: 9.5pt; line-height: 115%;">}</span><span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">Here the LogWriteEvent holds
the address of the methods console.Write and fileLogger.Write. When firing an
event it will sequentially call the respective methods which are pre-registered
to this Event. <o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">Note: The Logger application
is designed in the way that in future you can have multiple implementations of
Loggers. Right now we have Console and File Logger; if you are interested in
implementing a Database logger we can create a new Class named DatabaseLogger
which will implement ILogger interface. Provide necessary Write method logic so
that it will log messages to database.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;">Ones you have done with the
DatabaseLogger implementation, you just have to create an instance and register
the event as we have done for Console and File Loggers.</span><span style="font-family: Consolas; font-size: 9.5pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-family: Verdana, sans-serif; font-size: 10pt; line-height: 115%;"><a href="http://electrofriends.com/wp-content/uploads/2012/01/LoggerLibrary.zip">Download Sample Logger Application</a></span></div>
</div>Ranjan Dailatahttp://www.blogger.com/profile/01485829723000549876noreply@blogger.com0tag:blogger.com,1999:blog-5117833261590722982.post-85899753663878000022012-01-16T17:37:00.000-08:002012-01-16T17:37:31.038-08:00Aggregation, Composition and Association<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 16.0pt; line-height: 115%; mso-ansi-language: EN-US;">Association<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US">“Association
represents the static relationship shared among the objects of two classes. “So
any relationship between object of two classes is called association</span><span style="background: #FEFFFE; color: #27231b; font-size: 9.0pt; line-height: 115%; mso-ascii-font-family: Calibri; mso-bidi-font-family: Calibri; mso-hansi-font-family: Calibri;">.</span><span lang="EN-US" style="font-size: 16.0pt; line-height: 115%; mso-ansi-language: EN-US;"><o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US">An
association says there is some kind of dependency between the objects. It can
either be a weak or Strong dependency. <o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US">Consider an
example of Teacher and Student classes. Multiple students can associate with
single teacher and single student can associate with multiple teachers. This is
a kind of a weak relationship because there is no ownership between the student
and teacher and the life cycle are maintained by themselves. <o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 16.0pt; line-height: 115%; mso-ansi-language: EN-US;">Composition<o:p></o:p></span></div>
<div class="MsoNormal">
<i><span lang="EN-US"><br /></span></i></div>
<div class="MsoNormal">
<i><span lang="EN-US">Composition</span></i><span lang="EN-US"> is <b>specialized</b> form
of <b>aggregation</b> and we can call this as a “<b>life and death</b>”
relationship. It is a strong type of <b>aggregation</b>. Child object does
not have their life-cycle and if parent object deletes all child objects will
also be deleted.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US">Consider an
example of a set of classes Engine and Car. The object Engine is said to be
composed with in the Car object as the Engine cannot leave without the Car
object and the relationship is said to be whole because the Engine is a part of
the Car object. Here the life cycle of Engine is managed by the Car object. If
the Car gets destructed the associated composite object like Engine will also get
destroyed.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US">Thus a
composition relationship specifies that the lifetime of the part classifier is
dependent on the lifetime of the whole classifier.<o:p></o:p></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: KN; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><br /></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: KN; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">public class</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"> </span><span style="color: teal; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: KN; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Engine</span><span style="color: blue; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: KN; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><br />
</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;">{<br />
. . .<br />
}</span><span style="color: blue; font-family: "Verdana","sans-serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: KN; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: KN; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><br /></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: KN; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">public</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"> </span><span style="color: blue; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: KN; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">class</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"> </span><span style="color: teal; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: KN; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">Car</span><span style="color: blue; font-family: "Verdana","sans-serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: KN; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana, sans-serif; font-size: 10pt;">{</span><span style="color: blue; font-family: "Verdana","sans-serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: KN; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana, sans-serif; font-size: 10pt;"> Engine
e = </span><span style="color: blue; font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: KN; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;">new</span><span style="font-family: Verdana, sans-serif; font-size: 10pt;"> Engine();</span><span style="color: blue; font-family: "Verdana","sans-serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: KN; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana, sans-serif; font-size: 10pt;"> .......</span><span style="color: blue; font-family: "Verdana","sans-serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: KN; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana, sans-serif; font-size: 10pt;">}</span><span style="color: blue; font-family: "Verdana","sans-serif"; font-size: 12.0pt; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: KN; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN;"><o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="EN-US">Yet another
example for Composite relationship is, consider a set of classed Person, Leg
and Hand. The objects Leg and Hand are composed within the Person object. The
life cycle of Leg and Hand objects are maintained by Person object. Also you
can see the Leg and Hand object cannot leave independently without the Person
object. And note there is a strong relationship of Leg and Hand object with the
Person.<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<!--[if gte vml 1]><v:shapetype id="_x0000_t75"
coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe"
filled="f" stroked="f">
<v:stroke joinstyle="miter"/>
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0"/>
<v:f eqn="sum @0 1 0"/>
<v:f eqn="sum 0 0 @1"/>
<v:f eqn="prod @2 1 2"/>
<v:f eqn="prod @3 21600 pixelWidth"/>
<v:f eqn="prod @3 21600 pixelHeight"/>
<v:f eqn="sum @0 0 1"/>
<v:f eqn="prod @6 1 2"/>
<v:f eqn="prod @7 21600 pixelWidth"/>
<v:f eqn="sum @8 21600 0"/>
<v:f eqn="prod @7 21600 pixelHeight"/>
<v:f eqn="sum @10 21600 0"/>
</v:formulas>
<v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/>
<o:lock v:ext="edit" aspectratio="t"/>
</v:shapetype><v:shape id="Picture_x0020_1" o:spid="_x0000_i1025" type="#_x0000_t75"
alt="Description: image" style='width:232pt;height:190.5pt;visibility:visible;
mso-wrap-style:square'>
<v:imagedata src="file:///C:\Users\ranjand\AppData\Local\Temp\msohtmlclip1\01\clip_image001.png"
o:title="image"/>
</v:shape><![endif]--><!--[if !vml]--><!--[endif]--><span lang="EN-US"><o:p></o:p></span></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRf0SW-k3uEP4Z3px__m0XTBb7lJIDQWimilZAWSiTWVOtJxePcFt2mNEETelx4tQcvdczhXmk_gcv3SwdpDXOR1KCnMwAU_1pUlFFUqk55um7u_QNLA3447pEU5PWvT5YrhFZn7AlShM/s1600/Composition.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRf0SW-k3uEP4Z3px__m0XTBb7lJIDQWimilZAWSiTWVOtJxePcFt2mNEETelx4tQcvdczhXmk_gcv3SwdpDXOR1KCnMwAU_1pUlFFUqk55um7u_QNLA3447pEU5PWvT5YrhFZn7AlShM/s1600/Composition.png" /></a></div>
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<span lang="EN-US" style="font-size: 16.0pt; line-height: 115%; mso-ansi-language: EN-US;">Aggregation<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US"><br /></span></div>
<div class="MsoNormal">
<span lang="EN-US">The
difference between aggregation and composition is the object which can exists
independently uses aggregation and an object that has no meaning outside of the
relationship uses composition<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US">Let’s take
an example of Department and teacher. A single teacher cannot belong to
multiple departments, but if we delete the department, the teacher object will
not destroy. We can think about “has-a” relationship.<o:p></o:p></span></div>
<div class="MsoNormal">
<span lang="EN-US">Let us take
another example of Company and Employee classes. The employee is said to be
aggregated with the Company. The Employee is working for a company and has a
relationship with the company. The
employee object can still survive even if say the Company object does not
exists.</span><span style="font-family: Verdana, sans-serif; font-size: 12pt; line-height: 115%;"><o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt;">
<span style="font-family: Verdana, sans-serif; font-size: 12pt;">Conclusion <o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt;">
<span lang="EN-US">I
will conclude here by taking a real world example which has aggregation and
compositions.<o:p></o:p></span></div>
<div class="MsoNormal" style="background-attachment: initial; background-clip: initial; background-color: white; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal">
<span lang="EN-US">Consider a
scenario of a University which owns various departments (e.g., physics,
chemistry) and each department has a number of professors. If the university
closes, the departments will no longer exist, but the professors in those
departments will continue to exist. Therefore, a University can be seen as a
composition of departments, whereas departments have an aggregation of
professors. In addition, a Professor could work in more than one department,
but a department could not be part of more than one university.<o:p></o:p></span></div>
<div class="MsoNormal">
<br /></div>
</div>Ranjan Dailatahttp://www.blogger.com/profile/01485829723000549876noreply@blogger.com0