<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' version='2.0'><channel><atom:id>tag:blogger.com,1999:blog-15194192</atom:id><lastBuildDate>Mon, 28 Apr 2008 17:30:29 +0000</lastBuildDate><title>Hasith Yaggahavita's Blog</title><description/><link>http://www.hasith.net/blog/blogger.html</link><managingEditor>Hasith Yaggahavita</managingEditor><generator>Blogger</generator><openSearch:totalResults>28</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-15194192.post-760158113530480438</guid><pubDate>Sat, 15 Mar 2008 15:31:00 +0000</pubDate><atom:updated>2008-03-15T08:55:09.403-07:00</atom:updated><title>Propagating Identity Information with Thread Local Variables</title><description>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.hasith.net/blog/uploaded_images/Sigiriya-718071.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://www.hasith.net/blog/uploaded_images/Sigiriya-718056.JPG" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Often in our web applications we need to pass the logged in user identity down to business and data layers. This is mostly required when the business processes need to behave differently for different users/roles.&lt;br /&gt;&lt;br /&gt;Straight forward mechanism would be to pass user identity as a parameter for every business process method, but can quickly become verbose and painful.&lt;br /&gt;&lt;br /&gt;Another option is to use &lt;a title="'session based singleton'" href="http://aspalliance.com/70" id="y:jm"&gt;'session based singleton'&lt;/a&gt; to store the user identity. Once the user is authenticated we use this session based singleton to store the user identity. Business processes can access this session based singleton to obtain the same. Even though this works, the bi-directional dependency introduced (as explained below) limits the usefulness of this approach.&lt;br /&gt;&lt;br /&gt;Session based singleton uses the http-session for storing/retrieving information. i.e it has a dependency upon the web ui libraries. The business processes depends on the session based singleton to obtain the user identity. This makes the business processes to be dependent on web ui libraries. As naturally web uis are dependent on the business layer this causes a bi-directional dependency between web ui and the business layer.&lt;br /&gt;&lt;br /&gt;Use of thread local variables presents a viable alternative design to achieve the requirement. The thread locals stores information local to a particular thread. Variables placed by one thread is can be accessed only by the same thread (Each thread can have a separate value for the variable).&lt;br /&gt;&lt;br /&gt;Remaining section of the post looks in to the details of a thread local variable implementation for achieving the user identity propagation in Java. Mainly there are two parts of the implementation, a servlet filter and custom 'ThreadContext' class.&lt;br /&gt;&lt;br /&gt;Servlet filter is responsible of protecting the web application from unauthenticated access. Any request without a user identity (IUser instance) in the session are directed to "login.jsp" which places a user identity in the session after successful authentication. What is important for our discussion is the fact that this filter is also responsible of attaching the user identity to the request thread (see below).&lt;br /&gt;&lt;pre&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;public class AuthFilter implements Filter {&lt;br /&gt;&lt;br /&gt;public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) {&lt;br /&gt;    HttpServletRequest httpServletRequest = (HttpServletRequest) request;&lt;br /&gt;    HttpServletResponse httpServletResponse = (HttpServletResponse) response;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: rgb(56, 118, 29);"&gt;  // get the user from session&lt;/span&gt;&lt;br /&gt;    IUser user=(IUser)httpServletRequest.getSession().getAttribute(IUser.class.getName());&lt;br /&gt;    if (user == null ) {&lt;br /&gt;        &lt;span style="color: rgb(56, 118, 29);"&gt;//user is not in the session, not authenticated&lt;/span&gt;&lt;br /&gt;        httpServletResponse.sendRedirect("login.jsp");&lt;br /&gt;    } else {&lt;br /&gt;&lt;span style="color: rgb(56, 118, 29);"&gt;            //Authenticated, lets store the user in the thread context&lt;/span&gt;&lt;br /&gt;        &lt;span style="background-color: rgb(255, 229, 153);"&gt;ThreadContext.setUser(user);&lt;/span&gt;&lt;br /&gt;        try {&lt;br /&gt;&lt;span style="color: rgb(56, 118, 29);"&gt;                // call rest of the filters&lt;/span&gt;&lt;br /&gt;            chain.doFilter(request, response);&lt;br /&gt;        }finally {&lt;br /&gt;&lt;span style="color: rgb(56, 118, 29);"&gt;                // remove the thread local variable&lt;/span&gt;&lt;br /&gt;            &lt;span style="background-color: rgb(255, 229, 153);"&gt;ThreadContext.setUser(null);&lt;/span&gt;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void init(FilterConfig filterConfig) throws ServletException {}&lt;br /&gt;public void destroy() {}&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;In the above code if the user is authenticated then we call "&lt;span style="background-color: rgb(255, 255, 255);"&gt;ThreadContext.setUser(user)&lt;/span&gt;" to save the user information to the current thread local store. Once the processing is over (i.e after &lt;span style="color: rgb(11, 83, 148);"&gt;chain.doFilter()&lt;/span&gt;) we remove the user from the current thread bu calling "&lt;span style="background-color: rgb(255, 255, 255);"&gt;ThreadContext.setUser(null)&lt;/span&gt;".&lt;br /&gt;&lt;br /&gt;Now lets look in to the other part of the implementation, i.e ThreadContext class. Not much of coding is required here.&lt;br /&gt;&lt;pre&gt;&lt;span style="color: rgb(11, 83, 148);"&gt;public class ThreadContext {&lt;br /&gt;  private static ThreadLocal&lt;iuser&gt; threadLocalUser = new ThreadLocal&lt;iuser&gt;();&lt;br /&gt;&lt;br /&gt;  public static IUser getUser() {&lt;br /&gt;      return threadLocalUser.get();&lt;br /&gt;  }&lt;br /&gt;  public static void setUser(IUser user) {&lt;br /&gt;      if (user == null ) {&lt;br /&gt;          threadLocalUser.remove();&lt;br /&gt;      }&lt;br /&gt;      threadLocalUser.set(user);&lt;br /&gt;  }&lt;br /&gt;}&lt;/iuser&gt;&lt;/iuser&gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;You can see the static variable "&lt;span style="color: rgb(11, 83, 148);"&gt;threadLocalUser&lt;/span&gt;" is responsible of storing and managing the user identity for all the threads. Depending on the thread which calls the methods of the above class, appropriate IUser instances are selected by the "&lt;span style="color: rgb(11, 83, 148);"&gt;ThreadLocal&lt;/span&gt;" class.&lt;br /&gt;&lt;br /&gt;Even though the thread local variables are really powerful construct you need to be very careful in using them. If the variables are not cleared at the end of the process (finally block) that memory can be leaked. Also this should not be used as an alternative to parameter passing but should only be used for contextual information propagation.&lt;br /&gt;&lt;br /&gt;One other cool use of this would be to propagate transactions in declarative transaction management frameworks. I'm planning to release an new version of "&lt;a title="Easy Data Access Framework" href="http://sourceforge.net/projects/ecdb/" id="aw4c"&gt;Easy Data Access Framework&lt;/a&gt;" which makes use of thread local variables that completely hide the transaction instances from the developers.&lt;br /&gt;&lt;br /&gt;Microsoft .NET framework has built-in support for passing the user identity through the thread. "&lt;a title="System.Threading.Thread.CurrentPrincipal" href="http://msdn2.microsoft.com/en-us/library/system.threading.thread.currentprincipal.aspx" id="kwav"&gt;System.Threading.Thread.CurrentPrincipal&lt;/a&gt;" can be used to get or set the user identity to the current thread.</description><link>http://www.hasith.net/blog/2008/03/propagating-identity-information-with.html</link><author>Hasith Yaggahavita</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-15194192.post-7488439728523547362</guid><pubDate>Mon, 07 Jan 2008 17:18:00 +0000</pubDate><atom:updated>2008-01-07T09:54:07.822-08:00</atom:updated><title>Eurocenter BI Framework White Paper</title><description>We at &lt;a title="Eurocenter" target="_blank" href="http://www.eurocenterddc.com/" id="n6ee"&gt;Eurocenter&lt;/a&gt; were working hard to build few middleware frameworks throughout the past year. One of the most popular is 'Eurocenter Business Intelligence - ECBI' framework.            We already have few customers using ECBI framework and are expecting to get in to the market strongly this year.&lt;br /&gt;&lt;br /&gt;I was writing a product white paper on our ECBI framework during last week (Thanks &lt;a title="Uchitha" target="_blank" href="http://uchiblogsat.blogspot.com/" id="xnqh"&gt;Uchitha&lt;/a&gt; and Samudra for reviews). I thought of sharing the first draft through my blog. You can access the full draft &lt;a title="here" target="_blank" href="http://hasith.net/documents/ECBI_White_Paper.pdf" id="ho-d"&gt;here&lt;/a&gt;. Following is the introductory chapter of the white paper.&lt;br /&gt;&lt;blockquote&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;a name="_Toc187497759"&gt;&lt;/a&gt;&lt;span style="font-size:130%;"&gt;&lt;a name="_Toc187244611"&gt;&lt;span style="font-family:Calibri;"&gt;&lt;b&gt;Challenge for &lt;/b&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:Calibri;"&gt;&lt;b&gt;Today’s Business Intelligence&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:Calibri;"&gt;Historically business intelligence was considered as a largely manual, back office work performed by high tech professionals. Data from different sources was periodically integrated in to a set of defined reports and forwarded to business users for their decision making. &lt;p&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:Calibri;"&gt;&lt;p&gt; &lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:Calibri;"&gt;Due to the ever increasing competition, the business world has demanded the technology to deliver much dynamic information for faster/better decision making. Over last 5 years business intelligence feature set had rapidly grown and the definition of business intelligence shifted to mean much more front office related activities by the information end users. During the period, numerous products appeared in the industry delivering lot of advanced and sophisticated features.&lt;/span&gt;&lt;img id="gk9-" style="margin: 1em 1em 0pt 0pt; float: left; width: 333px; height: 381px;" src="http://docs.google.com/File?id=dczn7766_29gphjx6g8" /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:Calibri;"&gt;Although these products empowered users to make better decisions, most of the business intelligence products have unfortunately ignored an important fact. That is, ‘80 percent of the information users in a typical organization are often non-technical decision makers’. The complications introduced by the advanced feature set make these products to be overly difficult for end decision makers. According to our observations, it is only less than 20 percent of the available features are effectively used by business users in day-today decision making. &lt;p&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:Calibri;"&gt;&lt;p&gt; &lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:Calibri;"&gt;Evidently, the well-known 80-20 rule has a negative struck on the business intelligence product domain too. Overcoming this problem is becoming one of the most important challenges for BI products today. We believe that the business intelligence industry is now at its next maturity transition which can take the products to focus on ‘effective features’ by getting out of ‘features chaos’. &lt;p&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:Calibri;"&gt;&lt;p&gt; &lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:Calibri;"&gt;&lt;div id="r8z4" style="padding: 1em 0pt; text-align: left;"&gt;&lt;img style="width: 592px; height: 61px;" src="http://docs.google.com/File?id=dczn7766_30f2m227c8" /&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:Calibri;"&gt;&lt;p&gt; &lt;/p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-family:Calibri;"&gt;Proper channeling of right features to right users for right decision making is what is expected from the next generation business intelligence products. As a result, organizations are on the lookout for simpler and more focused BI products from the marketplace today.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;br /&gt;Note: Credit for building this fantastic framework should go to Eurocenter BI Team lead by Samudra  (Samudra, Ravith, Hiran, Eranga, Prashanthan, Vindya, Prasad, Janith, Lalinda, Rajive, Sandrina).</description><link>http://www.hasith.net/blog/2008/01/we-at-eurocenter-were-working-hard-to.html</link><author>Hasith Yaggahavita</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-15194192.post-5266583537463641495</guid><pubDate>Sun, 30 Dec 2007 13:23:00 +0000</pubDate><atom:updated>2007-12-30T06:11:55.264-08:00</atom:updated><title>Conserns for large scale integration architectures</title><description>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.hasith.net/blog/uploaded_images/waterfall-701066.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://www.hasith.net/blog/uploaded_images/waterfall-701060.JPG" alt="" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;During last couple of days I was writing a report on some existing academic research papers as a part of my postgraduate studies. I selected to write on one of my favorite topics, 'Integration Architectures'. Following is an abstract (Introduction Chapter) of my report. You can access the full report &lt;a href="http://hasith.net/documents/InteroperabilityReport.pdf"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;ABSTRACT:&lt;blockquote&gt;&lt;p class="MsoNormal" style="text-align: justify;"&gt;Most of the organizations today live by the slogan &lt;i style=""&gt;“Buy the best, build the rest”.&lt;/i&gt; Cost and risk of building from ground-up has made most organizations to consider buying commercial-off-the-shelf (COTS) products. Effective integration of these purchased IT systems has become the main responsibility of IT managers today. &lt;/p&gt;    &lt;p class="MsoNormal" style="text-align: justify;"&gt;Unfortunately, it is not very common for an organization to find all the required systems to be homogeneous. Often they are from different vendors having diverse architectures and operating on different platforms. The schema of the information model can widely differ from one system to another. At all these complexities, a seamless integration and smooth business process flow is what expected from the IT infrastructure. &lt;/p&gt;    &lt;p class="MsoNormal" style="text-align: justify;"&gt;According to Pollock (2001), robust integration architecture should support both &lt;i style=""&gt;‘Application Integration’&lt;/i&gt; as well as &lt;i style=""&gt;‘Information Integration’&lt;/i&gt; against heterogeneity. ‘Application Integration’ is the process of linking different software systems to become a part of a larger system. This is the technical solution that decides the level of integration (data level, application level, transaction level, process level, or human level) and technology of communication. Therefore ‘Application Integration’ mainly deals with the transportation of data/objects/messages between heterogeneous systems. &lt;/p&gt;    &lt;p class="MsoNormal" style="text-align: justify;"&gt;On the other hand, ‘Information Integration’ deals with the meaning and semantics of the communication. The meta-data, business rules and domain schema of one party should be understood by the other party for the integration to be successful. Maximum exchange of meanings by transformation of one entire domain representation schema to another partially compatible domain representation schema is the challenge of ‘Information Integration’.&lt;/p&gt;    &lt;p class="MsoNormal" style="text-align: justify;"&gt;‘Application Integration’ aspects are primary requirements that need to be satisfied by any integration architecture. But that is still only half of the total picture. Most integration architectures fall in to the trap of focusing on much of these technical aspects but forget the quality aspects of ‘Information Integration’. Simple integration requirements may be full filled by architectures biased to one arena, but complex integrations definitely require lot of attention and balance of both these aspects.&lt;span style=""&gt;   &lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style="text-align: justify;"&gt;Despite the number of integration technologies and patterns exists, the extent to which the above goal is realized is debatable. This report looks in to and evaluates two such integration architectures published in order to solve the integration puzzle. The selected two architectures present two dissimilar approaches towards enterprise integration. Main focus of the evaluation is to study the two architectural patterns to assess their support for ‘Application Integration’ and ‘Information Integration’ aspects as set by Pollock (2001) in his white paper. &lt;/p&gt;&lt;br /&gt;&lt;/blockquote&gt;</description><link>http://www.hasith.net/blog/2007/12/conserns-for-large-scale-integration.html</link><enclosure type='application/pdf' url='http://hasith.net/documents/InteroperabilityReport.pdf' length='0'/><author>Hasith Yaggahavita</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-15194192.post-2601872892354328298</guid><pubDate>Wed, 01 Aug 2007 04:02:00 +0000</pubDate><atom:updated>2007-12-30T06:31:05.857-08:00</atom:updated><title>Structuring .NET Windows Installations</title><description>How to structure the application installation directories and how the assemblies should be placed becomes much important when you have a suit of applications with several related apps. For this type of situations, it is very natural to have few core assemblies common for more than one app.&lt;br /&gt;&lt;br /&gt;If you come from COM background, one immediate solution that come to mind may be to store in the GAC (Global Assembly Cache). But if you are coming from Java background (like me)  then you may probably like to have your application to have minimum windows dependencies.  The you would prefer a  application which works simply when you copy the files to a destination folder. (still GAC has it's own share of advantages like assembly versioning)&lt;br /&gt;&lt;br /&gt;If you want a non GAC solution, design your solution installation folder to support holding the common executables. You may have your installation structure as following:&lt;br /&gt;&lt;br /&gt;&lt;img src="http://docs.google.com/File?id=dczn7766_7cpgpx4gj" /&gt;   &lt;div style="padding: 1em 0pt; text-align: left;"&gt;Here all the executables are placed in the root installation   directory and dependencies are placed in sub directories. Then in   .config files you should specify the dependency probe paths:&lt;br /&gt;    &lt;span style="font-style: italic;"&gt;&amp;lt;configuration&amp;gt;&lt;/span&gt;    &lt;div style="margin-left: 40px;"&gt;&lt;span style="font-style: italic;"&gt;&amp;lt;runtime&amp;gt;&lt;/span&gt; &lt;/div&gt;&lt;div style="margin-left: 80px;"&gt;&lt;span style="font-style: italic;"&gt;&amp;lt;assemblyBinding   xmlns="urn:schemas-microsoft-com:asm.v1"&amp;gt;&lt;/span&gt; &lt;/div&gt;   &lt;div style="margin-left: 120px;"&gt;&lt;span style="font-style: italic;"&gt;&amp;lt;probing   privatePath="Common_DLLs"/&amp;gt;&lt;/span&gt; &lt;/div&gt;   &lt;div style="margin-left: 80px;"&gt;&lt;span style="font-style: italic;"&gt;&amp;lt;/assemblyBinding&amp;gt;&lt;/span&gt; &lt;/div&gt;   &lt;div style="margin-left: 40px;"&gt;&lt;span style="font-style: italic;"&gt;&amp;lt;/runtime&amp;gt;&lt;/span&gt; &lt;/div&gt;   &lt;span style="font-style: italic;"&gt;&amp;lt;/configuration&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;But what if you want a much more modular structure with every application   having a separate directory but common dlls are located in a separate dir, then you may have the following structure&lt;br /&gt;&lt;div style="padding: 1em 0pt; text-align: left;"&gt;     &lt;img src="http://docs.google.com/File?id=dczn7766_8njpkr7d4" /&gt;&lt;br /&gt;  In this case, "&lt;span style="font-style: italic;"&gt;&amp;lt;probing     privatePath="Common_DLLs"/&amp;gt;&lt;/span&gt;" will not work as now the dependencies     are not stored in a sub directory of your executables. You have to use     "&lt;span style="font-style: italic;"&gt;&amp;lt;codeBase/&amp;gt;&lt;/span&gt;" directive in your     configuration files. One important thing to note is that you have to make     your dependency assemblies strong named in this case. Have the following in     your .config files.&lt;br /&gt;&lt;br /&gt;  &lt;span style="font-style: italic;"&gt;&amp;lt;configuration&amp;gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&amp;lt;runtime&amp;gt;&lt;/span&gt;      &lt;div style="margin-left: 40px;"&gt;&lt;span style="font-style: italic;"&gt;&amp;lt;assemblyBinding     xmlns="urn:schemas-microsoft-com:asm.v1"&amp;gt;&lt;/span&gt; &lt;/div&gt;     &lt;div style="margin-left: 80px;"&gt;&lt;span style="font-style: italic;"&gt;&amp;lt;dependentAssembly&amp;gt;&lt;/span&gt; &lt;/div&gt;     &lt;div style="margin-left: 120px;"&gt;&lt;span style="font-style: italic;"&gt;&amp;lt;assemblyIdentity     name="Common_DLL_1"  culture="neutral"     publicKeyToken="96c6ab020ca54674"/&amp;gt;&lt;/span&gt; &lt;/div&gt;     &lt;div style="margin-left: 120px;"&gt;&lt;span style="font-style: italic;"&gt;&amp;lt;codeBase version="1.0.0.0"     href="..Common_DLLsCommon_DLL_1.dll"/&amp;gt;&lt;/span&gt; &lt;/div&gt;     &lt;div style="margin-left: 40px;"&gt;&lt;div style="margin-left: 40px;"&gt;&lt;span style="font-style: italic;"&gt;&amp;lt;/dependentAssembly&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="margin-left: 40px;"&gt;&lt;div style="margin-left: 40px;"&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&amp;lt;dependentAssembly&amp;gt;...&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&amp;lt;/dependentAssembly&amp;gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt; &lt;/div&gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;span style="font-style: italic;"&gt;     &lt;/span&gt;&lt;div style="margin-left: 40px;"&gt;&lt;span style="font-style: italic;"&gt;&amp;lt;/assemblyBinding&amp;gt;&lt;/span&gt; &lt;/div&gt;     &lt;span style="font-style: italic;"&gt;&amp;lt;/runtime&amp;gt;&lt;/span&gt;      &lt;span style="font-style: italic;"&gt;&amp;lt;/configuration&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  If I had to select between, I would prefer second approach to the first one     as this allows me to better structure my solution installation. Also strong     naming can help avoiding much of the bad 'dll hell' experiences.&lt;br /&gt;&lt;br /&gt;  There are more interesting stuff to discuss here such as how you manage     common configurations (in .config files) across these related applications.     For an example if all the applications are connecting to a common database,     then how do we keep connection string in a single location is a problem to     solve (If you do not want to store in the Windows Registry either). I'm hoping     to discuss this on a separate post.&lt;br /&gt;&lt;/div&gt;    &lt;/div&gt;</description><link>http://www.hasith.net/blog/2007/07/structuring.html</link><author>Hasith Yaggahavita</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-15194192.post-6623579434795760492</guid><pubDate>Sat, 30 Jun 2007 15:43:00 +0000</pubDate><atom:updated>2007-08-12T09:36:10.058-07:00</atom:updated><title>Selling or Consulting?</title><description>Today is the last day of my 7 day visit to Norway for meeting 4 of our   customers. We have managed to successfully conclude every meeting resulting a   new project to us :). We were mainly focusing on presenting our new reporting   and business-intelligence(BI) frameworks to the prospective customers.  &lt;p&gt;     &lt;/p&gt; &lt;p&gt;   In one of the meetings I learnt one important lessons for my career. &lt;/p&gt; &lt;p&gt;     &lt;/p&gt; &lt;p&gt;   We met a customer who has already purchased one of the world's leading BI   tools. Even though our BI framework was better in terms of simplicity,   portal features and return on investment; the product our customer has   purchased had lot more features and power. Anyway we were able to convince the   value addition of our tool making it difficult for him to take a decision   on whether to buy our tool or to continue with what he purchased. &lt;/p&gt; &lt;p&gt;     &lt;/p&gt; &lt;p&gt;   But for me I was feeling uncomfortable as I actually believed that it makes   his systems complicated if he buys our tool, as he has already purchased a   tool for his organization. I step out of my sales mode and informed him that I   honestly think that he should not buy our tool but should stick to what ever   he already purchased. I also presented some new cool products that are   recently released by that BI product company. &lt;/p&gt; &lt;p&gt;     &lt;/p&gt; &lt;p&gt;   Even my colleague was bit surprised to see me doing that. But that resulted a   very open discussion as trust level has well improved. He wanted us to start   working on a data warehousing solution for his company which will be a much   bigger project compared to BI implementation. We have opened up a new business   direction for our company as data warehousing seems to be promising with   possible "Data Explosions" in the industry. I ended up as a happy techie since   I think that was the correct thing to do to advice him not to buy out tool. &lt;/p&gt; &lt;p&gt;     &lt;/p&gt; &lt;p&gt;   This incident opened my mind to think between "Selling" and "Consultancy". &lt;/p&gt;</description><link>http://www.hasith.net/blog/2007/06/selling-vs-consulting-today-is-last-day_30.html</link><author>Hasith Yaggahavita</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-15194192.post-6741848328916824739</guid><pubDate>Sat, 21 Apr 2007 18:30:00 +0000</pubDate><atom:updated>2007-08-12T09:36:38.585-07:00</atom:updated><title>Success in your Organization</title><description>&lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-family:Georgia;"&gt;&lt;/span&gt; &lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-family:Georgia;"&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-family:Georgia;"&gt;Being successful in their organization is every employee’s dream. There are few advices I normally provide to the juniors coming in to leadership roles in our organization. For me these qualities have helped a lot during my carrier. &lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-family:Georgia;"&gt;&lt;/span&gt; &lt;/p&gt; &lt;p class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-family:Georgia;"&gt;&lt;/span&gt;&lt;/p&gt; &lt;ul&gt; &lt;li&gt; &lt;div class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-family:Georgia;"&gt;&lt;b&gt;&lt;u&gt;Believe the organization:&lt;/u&gt; &lt;/b&gt;If you are hoping to be in the core team of your organization, then you must have a good trust towards the organization. If your heart does not trust the organization, then you are not in the correct place to act a leadership role. Either you give up being a leader or update your CV. &lt;/span&gt;&lt;span style="font-family:Georgia;"&gt;When I mean trusting that doesn’t mean you should agree to every action your organization takes. But you should be certain that the organization’s acts are genuine and done with a good will. &lt;/span&gt;&lt;span style="font-family:Georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt; &lt;/li&gt;&lt;li&gt; &lt;div class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-family:Georgia;"&gt;&lt;b&gt;&lt;u&gt;Plan to grow with the organization:&lt;/u&gt; &lt;/b&gt;There is common mistake I see from most of the youngsters. They plan their growth decoupled from the organization’s growth. My advice is that you should contribute the organization to grow then normally you grow in a much better rate within the organization.&lt;br /&gt;&lt;/span&gt;&lt;/div&gt; &lt;/li&gt;&lt;li&gt; &lt;div class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-family:Georgia;"&gt;&lt;b&gt;&lt;u&gt;It is not the technical things that matters most:&lt;/u&gt;&lt;/b&gt; Many of my employees I see running behind the technologies blindly. But in my experience, the one who climb the ladder is not the best techie, but the one who is the most valuable in his context. For an example look at a team whose responsibility is to deliver a project. The one, who builds the team spirit, help others, takes responsibility, troubles less and make the delivery to happen is the most valuable one and will be given the best promotion. So never fall back if someone is more technical than you are! Technology is not the key to success.&lt;br /&gt;&lt;/span&gt;&lt;/div&gt; &lt;/li&gt;&lt;li&gt; &lt;div class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-family:Georgia;"&gt;&lt;strong&gt;&lt;u&gt;Build and trust your second level:&lt;/u&gt; &lt;/strong&gt;If you do not build your second&lt;b&gt; &lt;/b&gt;level to take over from you, you will never be promoted, because no one is there to do your job. You have to start delegating your work as much as possible. You may not get the quality you expect at first, but close one eye and continue delegating. After sometime they will start performing better that you. Let your management style to be delegate-train-review.&lt;br /&gt;&lt;/span&gt;&lt;/div&gt; &lt;/li&gt;&lt;li&gt; &lt;div class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-family:Georgia;"&gt;&lt;b&gt;&lt;u&gt;Manage frustrations:&lt;/u&gt;&lt;/b&gt; As a leader never discuss or communicate your frustrations to your team. Bring up frustrations you have to your superior but not to the team. Also solve your team’s frustrations as soon as possible if any. I have seen leaders failing just because they spread their frustration to the team and then end up with a highly de-motivated team which doesn’t perform.&lt;/span&gt;&lt;span&gt;&lt;span style="font-family:Georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt; &lt;/li&gt;&lt;li&gt; &lt;div class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-family:Georgia;"&gt;&lt;b&gt;&lt;u&gt;Never challenge other’s ego:&lt;/u&gt;&lt;/b&gt; There are times you need to put your foot down and be hard on your team. In such situations always go by logics and facts, never challenge the others ego. For an example if you say “How many times I have told you this? Why can’t you grasp this simple concept?” that may hurt the listeners ego. Instead you may explain the bad consequences of him not listening to you well and help him to improve the situation.&lt;br /&gt;&lt;/span&gt;&lt;/div&gt; &lt;/li&gt;&lt;li&gt; &lt;div class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-family:Georgia;"&gt;&lt;b&gt;&lt;u&gt;Argue but don’t fight:&lt;/u&gt;&lt;/b&gt; From my view point, the difference between a fight and an argument is how you conclude the discussion. If both of you end the conversation with respecting each other that will be an argument. But if any of you are hurt at the end of the conversation, then that is a fight. The good news is even if you fight with someone still you can end it as an argument before you finish with it.&lt;br /&gt;&lt;/span&gt;&lt;/div&gt; &lt;/li&gt;&lt;li&gt; &lt;div class="MsoNormal" style="margin: 0in 0in 0pt;"&gt;&lt;span style="font-family:Georgia;"&gt;&lt;b&gt;&lt;u&gt;Identify your greatest asset:&lt;/u&gt; &lt;/b&gt;Some of the leaders are afraid of their subordinates who are smarter than themselves. But they are the greatest assets you can use to climb your ladder. You may effortlessly get them to play your role and start acting at one level above your current role. This is the easiest way to grow. Never be afraid to hand over your current role to a smarter one in your team, because that is the best thing that can happen to an effective leader. &lt;/span&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ul&gt;</description><link>http://www.hasith.net/blog/2007/04/success-in-your-organization-being.html</link><author>Hasith Yaggahavita</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-15194192.post-5411534410132033117</guid><pubDate>Tue, 06 Feb 2007 03:10:00 +0000</pubDate><atom:updated>2007-08-12T09:38:40.074-07:00</atom:updated><title>Software Architecture Attribute Checklist</title><description>&lt;span style="font-size:100%;"&gt;&lt;p class="MsoNormal"&gt;After using RUP templates for software architecture specification for few years, we at Eurocenter have decided to build our own set of templates for Software Architecture and for Software Design specifications. The new templates needed to provide enough meta-information to the author for better analyze the system as well as not to miss any important design aspect. There I did some research to identify as much as possible architectural attributes (checklist) which may be important for a designer to consider in developing architecture. Before dive in to the checklist, as a background information let me explain the design documentation we prepare at various stages of a project. &lt;/p&gt; &lt;p class="MsoNormal"&gt;     &lt;/p&gt; &lt;p class="MsoNormal"&gt;   In fact practically within Eurocenter we use 4 types of design documentations. At very initial stage of the project (proposal and scope stages) we develop &lt;b style=""&gt;‘Architecture Overview Document’ &lt;/b&gt;which presents the very abstract view of our recommended architecture to solve the customer problem as well as several alternative architectures with merits/demerits. This is where we demonstrate our understanding of the problem to our customers (this is particularly helpful in our presale activities). &lt;/p&gt; &lt;p class="MsoNormal"&gt;     &lt;/p&gt; &lt;p class="MsoNormal"&gt;   The next document on the pipeline is the &lt;b style=""&gt;‘Software Architecture Specification’&lt;/b&gt;, describing the meta-structure of all software structures. Our approach in this document is based on 4+1 views described by Philippe Kruchten. &lt;/p&gt; &lt;p class="MsoNormal"&gt;     &lt;/p&gt; &lt;p class="MsoNormal"&gt;   Next we perform a detail design analysis based on UML notations to bridge the gap between system architecture and implementation. We call this document the &lt;b style=""&gt;‘Software Design Specification’&lt;/b&gt;. &lt;/p&gt; &lt;p class="MsoNormal"&gt;     &lt;/p&gt; &lt;p class="MsoNormal"&gt;   The final design document we prepare is called &lt;b style=""&gt;‘Developer Guideline Documentation’&lt;/b&gt; which serves the purpose of documenting miscellaneous guidelines for the developers. This section may include some best practices, version controlling guide lines, project specific knowledge base, etc. This practice is very close to maintaining a project Wiki, but much organized and get delivered to the customer for reference at the end of the project (note that all our customers are software organizations). &lt;/p&gt; &lt;p class="MsoNormal"&gt;     &lt;/p&gt; &lt;p class="MsoNormal"&gt;   Now, enough back ground. Let’s have a look at the key attributes in developing a software architecture specification. You may use the following as a checklist to verify that you do not miss any important architectural aspect. Basically these are related with the non-functional goals of your architecture. Perfect system architecture may describe the expected level and realization strategy for each of the following attributes. &lt;/p&gt; &lt;p class="MsoNormal"&gt;     &lt;/p&gt; &lt;ul style="margin-top: 0in;" type="circle"&gt;   &lt;li class="MsoNormal" style=""&gt;     Performance   &lt;/li&gt;   &lt;ul style="margin-top: 0in;" type="circle"&gt;     &lt;li class="MsoNormal" style=""&gt;       Response time     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Throughput     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Scalability (supporting increasing loads – load balancing)     &lt;/li&gt;   &lt;/ul&gt;   &lt;li class="MsoNormal" style=""&gt;     Operational   &lt;/li&gt;   &lt;ul style="margin-top: 0in;" type="circle"&gt;     &lt;li class="MsoNormal" style=""&gt;       Availability     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Manageability (How to manage executing components like Caches)     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Upgradeability     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Reliability     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Recoverability (Fault Tolerance)     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Flexibility (Ability to support multiple configurations, workflows, etc)     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Transparency (Hide the complexities)     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Distribution, Concurrency and Conflict resolution     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Integration (Connectivity to other systems)     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Resources (Constraints and requirements)     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       System configurations     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Offline Operations     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Stability, Consistency and Accuracy     &lt;/li&gt;   &lt;/ul&gt;   &lt;li class="MsoNormal" style=""&gt;     Maintainability   &lt;/li&gt;   &lt;ul style="margin-top: 0in;" type="circle"&gt;     &lt;li class="MsoNormal" style=""&gt;       Portability     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Complexity     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Understandability     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Duplication     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Fragility (possibility of breaking the system due to a change)     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Extensibility     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Debugging     &lt;/li&gt;   &lt;/ul&gt;   &lt;li class="MsoNormal" style=""&gt;     Security   &lt;/li&gt;   &lt;ul style="margin-top: 0in;" type="circle"&gt;     &lt;li class="MsoNormal" style=""&gt;       Integrity     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Authentication     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Authorization     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Safety (System may not cause the Monitor to explode)     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Secrecy     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Accountability (who did what and when)     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Verifications and Validations     &lt;/li&gt;   &lt;/ul&gt;   &lt;li class="MsoNormal" style=""&gt;     Other   &lt;/li&gt;   &lt;ul style="margin-top: 0in;" type="circle"&gt;     &lt;li class="MsoNormal" style=""&gt;       Internationalization     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Configurations     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Testability (No entity beans, lets use Hibernate)     &lt;/li&gt;     &lt;li class="MsoNormal" style=""&gt;       Usability (effective HCI)     &lt;/li&gt;   &lt;/ul&gt; &lt;/ul&gt; &lt;p class="MsoNormal"&gt;     &lt;/p&gt; &lt;p class="MsoNormal"&gt;   I hope this list may help you in designing and documenting your new architectures. If I have missed any attribute let me know so that I can add those to the list. Happy architecting… &lt;/p&gt; &lt;p class="MsoNormal"&gt;     &lt;/p&gt; &lt;p class="MsoNormal"&gt;     &lt;/p&gt;&lt;/span&gt;</description><link>http://www.hasith.net/blog/2007/02/after-using-rup-templates-for-software.html</link><author>Hasith Yaggahavita</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-15194192.post-2254771508258068131</guid><pubDate>Thu, 23 Nov 2006 10:15:00 +0000</pubDate><atom:updated>2007-08-12T09:39:29.620-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>connection</category><category domain='http://www.blogger.com/atom/ns#'>close</category><category domain='http://www.blogger.com/atom/ns#'>database</category><title>Automating Database Connection Management</title><description>One of the most frustrating problems in software development is this database connection exceeding due to non closed db connection usage. Things getting worse especially when we do not discover this problem at the development/testing phase (as we may not be continuously running the development/testing systems for very long periods). But frustrating enough the problem is going to appear in the production site.&lt;div class="Section2"&gt;&lt;p class="MsoNormal"&gt;What can we do about this? One way is to thoroughly test the application for non closed connections. Yes this requires developer concentration and can be time consuming if you do not use proper tools. More effective solution is to use a database access platform that can automatically take care of closing the opened database connections. But what if our simple project requires use of direct database access technologies (such as pure JDBC or pure &lt;st1:stockticker st="on"&gt;ADO&lt;/st1:stockticker&gt;.&lt;st1:stockticker st="on"&gt;NET&lt;/st1:stockticker&gt;)?&lt;/p&gt;&lt;p class="MsoNormal"&gt;Let’s look at a small code fragment which we can use to employ a very simple data access framework to take care of this problem. In short we are going to write a base database action class which can provide and manage database connection to its sub classes. We use sub classing to write data access code (data actions) we need. Below is an example for the base action class written on VB.NET.&lt;/p&gt;&lt;p class="MsoNormal"&gt;  &lt;/p&gt;&lt;p class="MsoNormal" style=""&gt;&lt;span style=""&gt;Public&lt;/span&gt;&lt;span style=""&gt; &lt;span style="color:blue;"&gt;MustInherit&lt;/span&gt; &lt;span style="color:blue;"&gt;Class&lt;/span&gt; ActionBase(&lt;span style="color:blue;"&gt;Of&lt;/span&gt; T)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style=""&gt;&lt;span style=""&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;Protected&lt;/span&gt; &lt;span style="color:blue;"&gt;MustOverride&lt;/span&gt; &lt;span style="color:blue;"&gt;Function&lt;/span&gt; Body(&lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; conn &lt;span style="color:blue;"&gt;As&lt;/span&gt; DbConnection) &lt;span style="color:blue;"&gt;As&lt;/span&gt; T&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style=""&gt;&lt;span style=""&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;Public&lt;/span&gt; &lt;span style="color:blue;"&gt;Function&lt;/span&gt; Execute() &lt;span style="color:blue;"&gt;As&lt;/span&gt; T&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-indent: 0.5in;"&gt;&lt;span style=""&gt;' Create a database connection&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-indent: 0.5in;"&gt;&lt;span style=""&gt;Dim&lt;/span&gt;&lt;span style=""&gt; conn &lt;span style="color:blue;"&gt;As&lt;/span&gt; DbConnection = ConnectionProvider.GetConnection()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-indent: 0.5in;"&gt;&lt;span style=""&gt;' Call the body method by providing the connection&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-indent: 0.5in;"&gt;&lt;span style=""&gt;Body(conn)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-indent: 0.5in;"&gt;&lt;span style=""&gt;' Close the connection&lt;/span&gt;&lt;span style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-indent: 0.5in;"&gt;&lt;span style=""&gt;Conn.Close()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=""&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;End&lt;/span&gt; &lt;span style="color:blue;"&gt;Function&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style=""&gt;&lt;span style=""&gt;End&lt;/span&gt;&lt;span style=""&gt; &lt;span style="color:blue;"&gt;Class&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;All the sub classes need to implement the abstract method “&lt;b style=""&gt;&lt;span style=""&gt;Body(&lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; conn &lt;span style="color:blue;"&gt;As&lt;/span&gt; DbConnection)&lt;/span&gt;&lt;/b&gt;”. As a method parameter, a connection instance will be available to the implementing method and that can be used by the sub class method to perform data access logic. Above base class is written as a generic class and subclasses should provide the template class name which should be the expected return object type of the sub class. For an example, a data access action that retrieve a &lt;b style=""&gt;‘User’ &lt;/b&gt;instance will like follows:&lt;/p&gt;      &lt;p class="MsoNormal" style=""&gt;&lt;span style=""&gt;Friend&lt;/span&gt;&lt;span style=""&gt; &lt;span style="color:blue;"&gt;Class&lt;/span&gt; RetrieveUserAction&lt;o:p&gt;&lt;/o:p&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;Inherits&lt;/span&gt; ActionBase(&lt;span style="color:blue;"&gt;Of&lt;/span&gt; User)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style=""&gt;&lt;span style=""&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;span style="color:blue;"&gt;Private&lt;/span&gt; _userId &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;String&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style=""&gt;&lt;span style=""&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;span style="color:blue;"&gt;Public&lt;/span&gt; &lt;span style="color:blue;"&gt;Sub&lt;/span&gt; &lt;span style="color:blue;"&gt;New&lt;/span&gt;(&lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; userId &lt;span style="color:blue;"&gt;As&lt;/span&gt; &lt;span style="color:blue;"&gt;String&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=""&gt;&lt;span style=""&gt;       &lt;/span&gt;&lt;span style="color:blue;"&gt;Me&lt;/span&gt;._userId = userId&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=""&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;span style="color:blue;"&gt;End&lt;/span&gt; &lt;span style="color:blue;"&gt;Sub&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style=""&gt;&lt;span style=""&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;Protected&lt;/span&gt; &lt;span style="color:blue;"&gt;Overrides&lt;/span&gt; &lt;span style="color:blue;"&gt;Function&lt;/span&gt; Body(&lt;span style="color:blue;"&gt;ByVal&lt;/span&gt; conn &lt;span style="color:blue;"&gt;As&lt;/span&gt; DbConnection) &lt;span style="color:blue;"&gt;As&lt;/span&gt; User&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-indent: 0.5in;"&gt;&lt;span style=""&gt;Dim &lt;/span&gt;&lt;span style=""&gt;user as User = new User()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-indent: 0.5in;"&gt;&lt;span style=""&gt;' Use connection to fetch user info and populate ‘user’ instance&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="text-indent: 0.5in;"&gt;&lt;span style=""&gt;Return&lt;/span&gt;&lt;span style=""&gt; user&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=""&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style="color:blue;"&gt;End&lt;/span&gt; &lt;span style="color:blue;"&gt;Function&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal" style=""&gt;&lt;span style=""&gt;End&lt;/span&gt;&lt;span style=""&gt; &lt;span style="color:blue;"&gt;Class&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;As you can see we write sub classes to execute database operation on the database. Developers will not have to look for database connections. It will be provided in the “&lt;b style=""&gt;&lt;span style=""&gt;Body()&lt;/span&gt;&lt;/b&gt;”method parameter. Also the developers are free from the burden of closing the connections as framework itself will take care of it. &lt;/p&gt;    &lt;p class="MsoNormal"&gt;Let’s look at how one can make use of the above written class to retrieve the user with id=12.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;Dim&lt;/span&gt;&lt;span style=""&gt; action &lt;span style="color:blue;"&gt;AS&lt;/span&gt; new RetrieveUserAction(12)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;Dim&lt;/span&gt;&lt;span style=""&gt; user &lt;span style="color:blue;"&gt;As&lt;/span&gt; User = Action.Execute()&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Even though this simple framework is pretty useful in managing connection, this has some limitations also. Developers are not able to spawn threads and pass the connection in to it for further processing. Also the results will be always disconnected, you cant pass resultsets to upper layers for presessing (but I think this enforces a good practice). &lt;/p&gt;    &lt;p class="MsoNormal"&gt;Also one major thing to consider is whether actually database resources getting released by closing the connections. In Oracle with JDBC connection close will not release database resources and you need to close the ‘Statement’ instance to release database resources. In such situations we can ammend the framework to provide us statement objects instead of providing connections. &lt;/p&gt;  &lt;/div&gt;</description><link>http://www.hasith.net/blog/2006/11/automating-database-connection.html</link><author>Hasith Yaggahavita</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-15194192.post-7518871538678563745</guid><pubDate>Mon, 20 Nov 2006 05:13:00 +0000</pubDate><atom:updated>2007-08-12T09:40:17.348-07:00</atom:updated><category domain='http://www.blogger.com/atom/ns#'>estimates</category><category domain='http://www.blogger.com/atom/ns#'>process</category><category domain='http://www.blogger.com/atom/ns#'>estimations</category><category domain='http://www.blogger.com/atom/ns#'>cost</category><title>Estimating Estimations</title><description>&lt;b style=""&gt;&lt;span style="font-size:16;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;    &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;During last few days I was doing a research on how to perform effective estimations. There are a few interesting points I have learnt in doing the research. One good theory I learnt was the “Cone of Uncertainty”.&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.hasith.net/blog/uploaded_images/cone_of_uncertainity_estimations-777133.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 439px; height: 275px;" src="http://www.hasith.net/blog/uploaded_images/cone_of_uncertainity_estimations-776845.JPG" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;The above picture depicts how the level of uncertainty changes during the project life cycle. As you can see the uncertainty reduces as project progresses. This may not be news to most of us, but the problem is how many of us use this instinctive knowledge in our estimation practices? For an example is we provide an estimation in the project agreement level, the deviation of actual effort can be 4 times the estimation. &lt;b style=""&gt;“Later you estimate, higher the accuracy will be”&lt;/b&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;Also if we look at the project failure (or overrun) rates, market research shows that the success p&lt;span style="font-size:100%;"&gt;robability is high for small projects. &lt;/span&gt;&lt;/p&gt;    &lt;table class="MsoNormalTable" style="width: 574px; height: 208px;" border="0" cellpadding="0" cellspacing="0"&gt;  &lt;tbody&gt;&lt;tr style="height: 32.25pt;"&gt;   &lt;td  style="border-style: solid; padding: 0in; background: rgb(204, 153, 0) none repeat scroll 0% 50%; width: 161.6pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; height: 32.25pt;color:black;" valign="top" width="215"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;Project Size (lines of code)&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td  style="border-style: solid; padding: 0in; background: rgb(204, 153, 0) none repeat scroll 0% 50%; width: 45.5pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; height: 32.25pt;color:black;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;Early&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td  style="border-style: solid; padding: 0in; background: rgb(204, 153, 0) none repeat scroll 0% 50%; width: 45.45pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; height: 32.25pt;color:black;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;On Time&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td  style="border-style: solid; padding: 0in; background: rgb(204, 153, 0) none repeat scroll 0% 50%; width: 45.4pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; height: 32.25pt;color:black;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;Late&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td  style="border-style: solid; padding: 0in; background: rgb(204, 153, 0) none repeat scroll 0% 50%; width: 45.55pt; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; height: 32.25pt;color:black;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;Failed&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 24.75pt;"&gt;   &lt;td  style="border-style: solid; padding: 0in; width: 161.6pt; height: 24.75pt;color:black;" valign="top" width="215"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;1000 LOC&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border: 1pt solid black; padding: 0in; width: 45.5pt; height: 24.75pt;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;11%&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border: 1pt solid black; padding: 0in; width: 45.45pt; height: 24.75pt;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;81%&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border: 1pt solid black; padding: 0in; width: 45.4pt; height: 24.75pt;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;6%&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td  style="border-style: solid; padding: 0in; width: 45.55pt; height: 24.75pt;color:black;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;2%&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 24.75pt;"&gt;   &lt;td  style="border-style: solid; padding: 0in; width: 161.6pt; height: 24.75pt;color:black;" valign="top" width="215"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;10,000 LOC&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border: 1pt solid black; padding: 0in; width: 45.5pt; height: 24.75pt;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;6%&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border: 1pt solid black; padding: 0in; width: 45.45pt; height: 24.75pt;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;75%&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border: 1pt solid black; padding: 0in; width: 45.4pt; height: 24.75pt;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;12%&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td  style="border-style: solid; padding: 0in; width: 45.55pt; height: 24.75pt;color:black;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;7%&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 24.75pt;"&gt;   &lt;td  style="border-style: solid; padding: 0in; width: 161.6pt; height: 24.75pt;color:black;" valign="top" width="215"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;100,000 LOC&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border: 1pt solid black; padding: 0in; width: 45.5pt; height: 24.75pt;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;1%&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border: 1pt solid black; padding: 0in; width: 45.45pt; height: 24.75pt;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;61%&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border: 1pt solid black; padding: 0in; width: 45.4pt; height: 24.75pt;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;18%&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td  style="border-style: solid; padding: 0in; width: 45.55pt; height: 24.75pt;color:black;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;20%&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 24.75pt;"&gt;   &lt;td  style="border-style: solid; padding: 0in; width: 161.6pt; height: 24.75pt;color:black;" valign="top" width="215"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;1,000,000 LOC&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border: 1pt solid black; padding: 0in; width: 45.5pt; height: 24.75pt;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;1%&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border: 1pt solid black; padding: 0in; width: 45.45pt; height: 24.75pt;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;28%&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="border: 1pt solid black; padding: 0in; width: 45.4pt; height: 24.75pt;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;24%&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td  style="border-style: solid; padding: 0in; width: 45.55pt; height: 24.75pt;color:black;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;48%&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style="height: 24.75pt;"&gt;   &lt;td  style="border-style: solid; padding: 0in; width: 161.6pt; height: 24.75pt;color:black;" valign="top" width="215"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;10,000,000 LOC&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td  style="border-style: solid; padding: 0in; width: 45.5pt; height: 24.75pt;color:black;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;0%&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td  style="border-style: solid; padding: 0in; width: 45.45pt; height: 24.75pt;color:black;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;14%&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td  style="border-style: solid; padding: 0in; width: 45.4pt; height: 24.75pt;color:black;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;21%&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td  style="border-style: solid; padding: 0in; width: 45.55pt; height: 24.75pt;color:black;" valign="top" width="61"&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;65%&lt;/span&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;One reason for this fact is that it is difficult to estimate a lar&lt;/span&gt;ge project than a small one (of course there are many other reasons also). If you have a large system to develop try to break it in to several small projects. &lt;b style=""&gt;“Smaller the project, higher the success probability”&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;        &lt;p class="MsoNormal"&gt;Another common mistake we make is the bias towards so called ‘Expert Judgment’. How many of us believe our experience and knowledge is the best source for estimations? Probably many of us think so. But the researches have proven the converse. Expert judgment is one of the worst methodologies to derive an estimate. So what would give us a better estimate? Often the historical data provide us a better estimation than any other method. Historical data can be in 3 forms:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;&lt;!--[if !supportLists]--&gt;Industry average data&lt;/li&gt;&lt;li&gt;&lt;!--[if !supportLists]--&gt;Organization average data&lt;/li&gt;&lt;li&gt;&lt;!--[if !supportLists]--&gt;&lt;!--[endif]--&gt;Project local data&lt;/li&gt;&lt;/ul&gt;        &lt;p class="MsoNormal"&gt;Needless to say the data accuracy is higher in project data than industry average data. We should build an estimation process that uses historical data. It is better to use several industry accepted estimation methodologies (customized with historical data) instead of a one methodology. Simple models with less control knobs have proven to deliver effective results. &lt;b style=""&gt;“Never trust expert judgments, use count and compute methods empowered with historical data”&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;One other common mistake is forgetting many of the required software activities at the estimation time. It is very preferred to have omitted activity list and go through it at the estimation time. Also allow several individual estimators to work independently and then converge those to get the final estimate. The derived estimate should not be a single value but should be presented with a variance. Three point estimation techniques is a good place to start working on estimation probability.&lt;/p&gt;    &lt;p class="MsoNormal"&gt;I hope these hits will help you in making a proper estimation process for your organization. You probably need to build a customized process that match with your organization practices. Try to use estimations throughout the project life cycle after end of every phase. Also make sure to asses and improve the estimation process. Cost of over running a project for several times will be definitely higher than your estimation effort. “&lt;b style=""&gt;Invest on estimations. It always paybacks”&lt;/b&gt;&lt;/p&gt;&lt;span style="font-weight: bold;"&gt;References:&lt;br /&gt;&lt;/span&gt;&lt;a href="http://www.amazon.com/exec/obidos/tg/detail/-/0735605351/"&gt;&lt;span class="sans"&gt;Software Estimation: Demystifying the Black Art &lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.amazon.com/Software-Measurement-Estimation-Quantitative-Engineering/sim/0471676225/2"&gt;&lt;span class="sans"&gt;Software Measurement and Estimation: A Practical Approach&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.standishgroup.com/sample_research/chaos_1994_1.php"&gt;CHAOS Report&lt;/a&gt;</description><link>http://www.hasith.net/blog/2006/11/estimating-estimations-during-last-few.html</link><author>Hasith Yaggahavita</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-15194192.post-114846501966830618</guid><pubDate>Wed, 24 May 2006 09:33:00 +0000</pubDate><atom:updated>2007-08-12T09:42:23.902-07:00</atom:updated><title>SQLite as an Embeddable Database</title><description>&lt;div style="text-align: left;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.hasith.net/blog/uploaded_images/trees_in_lake-743548.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://www.hasith.net/blog/uploaded_images/trees_in_lake-742180.JPG" alt="" border="0" /&gt;&lt;/a&gt;These days I'm involved in designing a ‘Smart Client Application’ architecture for one of our customers. These smart client applications require fair amount of offline capabilities, fast data access and low network utilization. To achieve the objectives most of the data is cached and persisted on the client side. This required us to look at data manipulation, persisting and synchronization mechanisms at the client side.&lt;o:p&gt;&lt;/o:p&gt;     &lt;p class="MsoPlainText"&gt;&lt;o:p&gt;&lt;/o:p&gt;The first alternative we had was to maintain XML serialized objects on the client side to cache data. This had the problems like Data querying difficulties, Security issues, Thread safe access issues, High memory consumption and Implementation difficulties.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;     &lt;p class="MsoPlainText"&gt;&lt;o:p&gt;&lt;/o:p&gt;Next we have decided to use an embeddable database for storing data. Our first candidate was &lt;a href="http://msdn.microsoft.com/sql/express/"&gt;MS SQL Express&lt;/a&gt; database, as our project is mainly based on VB.NET with MS technologies. Even though it has some &lt;a href="http://www.microsoft.com/sql/editions/express/features.mspx"&gt;limitations&lt;/a&gt;, SQL Express is a very feature rich database which can be invoked in the similar way you invoke SQL Server database (with SPs, Views, Functions, full ADO.NET support, etc…). This was a major plus point for us as we could reuse the same data access layer components on the client side. It also supported database replication so that the cached data syncing could be done even at the database level.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;     &lt;p class="MsoPlainText"&gt;&lt;o:p&gt;&lt;/o:p&gt;But the problem was the high installation requirements of the SQL Express database. Also configuration of the database seemed to be fairly complex for our requirements.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;     &lt;p class="MsoPlainText"&gt;&lt;o:p&gt;&lt;/o:p&gt;Next alternative we looked at was the open source database &lt;a href="http://www.sqlite.org/"&gt;SQLite&lt;/a&gt;. It has an incredibly small foot print of less than 400Kb and &lt;a href="http://sqlite.phxsoftware.com/forums/622/ShowPost.aspx"&gt;performance was impressive&lt;/a&gt; as a small single user database. &lt;a href="http://sourceforge.net/projects/sqlite-dotnet2"&gt;ADO.NET 2.0 data provider&lt;/a&gt; was also available for SQLite and can be integrated to Visual Studio 2005 easily. It has implemented most of the SQL92 standard with few &lt;a href="http://www.sqlite.org/omitted.html"&gt;exceptions&lt;/a&gt;. SQLite is really a zero configuration single-file database which runs in-process of your application.&lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;     &lt;p class="MsoPlainText"&gt;Having said the plus points, it is now the time to look at the limitations also. One main problem is that, the only locking level it supports is at database level. This can be a problem when multiple processes accessing the database simultaneously. Since smart clients are generally used by a single user, this shouldn’t be a big problem as an embedded database. But in our case, the smart client application might be deployed on a Cytrix Server and may have many users connecting over consoles. &lt;o:p&gt;&lt;/o:p&gt;&lt;/p&gt;     &lt;p class="MsoPlainText"&gt;Having honored by “2005 Open Source Award from Google and O'Reilly”, I think we should seriously consider using SQLite as an embedded database for our smart client architectures.&lt;/p&gt;  &lt;/div&gt;</description><link>http://www.hasith.net/blog/2006/05/sqlite-as-embeddable-database-these.html</link><author>Hasith Yaggahavita</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-15194192.post-114744126774182398</guid><pubDate>Fri, 12 May 2006 13:17:00 +0000</pubDate><atom:updated>2007-08-12T09:01:48.018-07:00</atom:updated><title>Maintaining Database-Application Versioning</title><description>&lt;span style="font-size:130%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;div style="text-align: center;"&gt; &lt;div style="text-align: left;"&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size:130%;"&gt;Maintaining Database-Application Versioning&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;   &lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.hasith.net/blog/uploaded_images/000_2897-720714.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://www.hasith.net/blog/uploaded_images/000_2897-718995.JPG" alt="" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;One major challenge in product development is managing/tracking the database changes and versioning it. There are many things to consider developing a proper strategy for database version controlling.&lt;br /&gt;&lt;ul&gt;   &lt;li&gt;Application should be able to identify the database version it is using&lt;/li&gt;   &lt;li&gt;If the database is not up-to-date, the application should handle the problem gracefully with out bringing surprises to the users (either gracefully exit or upgrade the database). &lt;/li&gt;   &lt;li&gt;Database also should be upgraded if the ‘Online Update’ (such as in ‘no-touch deployment’) strategy is used in the application. &lt;/li&gt;   &lt;li&gt;If application has capabilities to upgrade the database then preferably it should be able to update the databases in various versions. &lt;/li&gt;   &lt;li&gt;System should be able to track any improper database changes (e.g. uncontrolled manual changes by the customer)     &lt;/li&gt; &lt;/ul&gt;&lt;br /&gt;After a little thought I came up with a model to solve the issue. Still I couldn’t experiment this in a real world project. Here is an outline of the model:&lt;br /&gt;&lt;ul&gt;   &lt;li&gt;Obviously the database should contain a Metadata Table keeping the current version of it. This version is unique for a particular state of the (database schema + system data) in the database &lt;/li&gt;   &lt;li&gt;Any version change (db upgrade) should increment the database version number and should be performed through a set of scripts. That is for any two adjacent versions are associated with a set of scripts performing that version upgrade. &lt;/li&gt;   &lt;li&gt;For example bringing database from version 2.3.5 to version 2.3.7 requires running two sets of scripts, one to upgrade from 2.3.5 to 2.3.6 and another to upgrade from 2.3.6 to 2.3.7. At the end of this script, it should properly change the db version to indicate the current db version. &lt;/li&gt;   &lt;li&gt;Now we need to have a database level trigger to alter the db version number if any uncontrolled change is done to the database schema in an improper way. Additionally system data tables can also be protected with the same trigger mechanism which changes the db version if any uncontrolled change is happened to the system tables. &lt;/li&gt;   &lt;li&gt;This trigger will change the db version to a state such as “NOT-DEFINED” so that the application may inform the user regarding the uncontrolled database state. &lt;/li&gt;   &lt;li&gt;Additionally if we need to make automatic db upgrades to happen with the application upgrades, then we can build a small class library which will check the database version at the application startup and if the database needs an upgrade run the necessary upgrade scripts. &lt;/li&gt;   &lt;li&gt;For this we can use the ‘Command Pattern’ to have individual command classes which can upgrade the database from one version to the next adjacent version. For an example to upgrade database from version 2.3.5 to version 2.3.7, application will run two command objects one responsible for upgrading from 2.3.5 to 2.3.6 and another for upgrading from 2.3.6 to 2.3.7. &lt;/li&gt; &lt;/ul&gt; This may not be the ultimate model for managing database versions. But I feel this would do well if implemented and controlled consciously.&lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;/span&gt;&lt;/p&gt;</description><link>http://www.hasith.net/blog/2006/05/maintaining-database-application.html</link><author>Hasith Yaggahavita</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-15194192.post-113997822453298960</guid><pubDate>Wed, 15 Feb 2006 04:35:00 +0000</pubDate><atom:updated>2007-08-12T09:02:19.932-07:00</atom:updated><title>Composite UI Application Block</title><description>&lt;p style="font-weight: bold;" class="MsoNormal"&gt;&lt;span style="font-size:130%;"&gt;&lt;a name="OLE_LINK1"&gt;Composite UI Application Block&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;   &lt;span style=""&gt;&lt;/span&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;Another Microsoft Application Blocks is available for downloading now. This new ‘Composite UI Application Block’ provides a long awaited smart client application framework for .&lt;st1:stockticker&gt;NET&lt;/st1:stockticker&gt; technologies. That is the ‘pluggable component architecture’ for smart client applications. This plugability is required in many applications to provide features such as:&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;    &lt;ul&gt;   &lt;li&gt;providing multiple versions of application with different feature sets (e.g. enterprise version, standard version, etc) &lt;span style=""&gt; &lt;/span&gt;&lt;/li&gt;   &lt;li&gt;creating the application as a composition of loosely coupled reusable modules &lt;/li&gt;   &lt;li&gt;providing personalization capability for the application&lt;/li&gt;   &lt;li&gt;Easily adding, updating, configuring sub modules of the application (e.g. online updating and versioning)&lt;/li&gt; &lt;/ul&gt;                      &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;Few months ago, Microsoft has released a portal framework with the new ASP.&lt;st1:stockticker&gt;NET&lt;/st1:stockticker&gt; 2.0 release, enabling web applications to enjoy many of the above features. Also several Java implementations provide similar frameworks for Smart Client application development. Eclipse framework is one of the major competitors in this area with a very powerful plug-in engine. Sun’s Netbeans application platform also provides a development framework with a pluggable architecture. &lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;For some time, I have been waiting for a similar kind of framework to appear in the .&lt;st1:stockticker&gt;NET&lt;/st1:stockticker&gt; arena as well. Few of our customers had similar kind of requirements for their smart client applications and I was wondering how to provide this plug-in capability in .&lt;st1:stockticker&gt;NET&lt;/st1:stockticker&gt; platform. So I’m really excited with the .&lt;st1:stockticker&gt;NET&lt;/st1:stockticker&gt; ‘Composite UI Application Block’ and hope that this will be the first step towards a feature rich .&lt;st1:stockticker&gt;NET&lt;/st1:stockticker&gt; plugging framework for smart client applications.&lt;/p&gt;</description><link>http://www.hasith.net/blog/2006/02/composite-ui-application-block-another.html</link><author>Hasith Yaggahavita</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-15194192.post-113854150788817939</guid><pubDate>Sun, 29 Jan 2006 13:06:00 +0000</pubDate><atom:updated>2007-08-12T09:40:52.583-07:00</atom:updated><title>Impressing Customers on their own ground</title><description>&lt;span style="font-size:180%;"&gt;&lt;/span&gt;These days I’m back in Norway for some pre-project activities. This is really a different experience for me being in the winter time (last time it was the summer). We had some interesting ‘Skying’ sessions and as a result I have a broken knee now :D.&lt;br /&gt;&lt;p class="MsoNormal"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.hasith.net/blog/uploaded_images/hasith_snow-704980.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://www.hasith.net/blog/uploaded_images/hasith_snow-701302.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;  &lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span style=""&gt; &lt;/span&gt;Alright… now back on the business… Last few days we had very interesting sessions with few of our prospective customers. It was really a challenging task to impress them on their own ground (specially as they are software companies who know their business and the technology very well). Also being a technical guy it was really difficult to just forget the technology and concentrate on the business requirements. Anyhow during this visit I have learned many tactics of how to impress customers on their own ground.&lt;/p&gt;     &lt;p class="MsoNormal"&gt;The most important thing to do is, we should make them feel that we understand their business very well. This is a challenge as all the customers were in the business for many years and they have knowledge which they think obvious (implicit knowledge) but being a third party that is not so for us. So here are few guidelines which we learned and used to capture the business domain knowledge during the few meetings we had.&lt;br /&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Let them describe the business domain they are working on. This is not about their company processes but about the industry as a whole. Here we need to understand where our customer stands in the industry (E.g. Market share).&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;   &lt;li&gt;Take the main business process of the company and discuss it with the customer. We have to identify where in the process IT fits in to. Use of activity diagrams was very useful in our discussions. Also ask them to take few common variations of this process if any exists (This is effective if the customer is a vendor of a product which is used by several of his customers).&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;It is really important to keep a balance between automated and manual processes, as most of the companies add value to their process through manual processing (Use of human intelligence in the process). These manual processes may give them an edge in competing with other firms. So we need to be care full in proposing IT automations of the process components. &lt;/li&gt;  &lt;/ul&gt; &lt;ul&gt;   &lt;li&gt;Discuss the importance of IT to their organization. Guide the discussion such a way it reveals lot of non functional requirements such as performance, robustness, error handling, and scalability of the proposed system.&lt;/li&gt; &lt;/ul&gt; &lt;ul&gt;   &lt;li&gt;Talk about the current IT infrastructure. Discuss the strengths and weaknesses of the current system.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Talk about the competitors. This generally led to a really interesting discussion and reveals most of the expectations of the customer. Discuss the IT infrastructure owned by the competitors, which processes they perform better and what to learn from those.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Discuss the income break down of the company. That is which part of the business is bringing more income to the company, which parts are weaker and how IT can help them to grow. One thing we need to remember is that, at the end of the day it is all about profit and incomes (providing cool and nice features which do not bring any profit to the company are out of the interest).&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;li&gt; Most importantly discuss what make their business to grow. For an example attracting more suppliers, attracting more customers and making the internal processes efficient may be the growth factors of a business. So the proposed system needs to address those factors to make the business to grow.&lt;/li&gt;    &lt;/ul&gt;  &lt;p class="MsoNormal"&gt;Actually working with prospects is fairly different and difficult compared to a traditional requirement gathering session. To win the project we need to focus well and impress them on our capabilities and understanding of the business. Trust building is the key to win a project. Good concentration focused questions, professional answers and well thought improvement proposals helps to build this trust. Also never forget to talk about your dog and his cat to build a good personnel relationship…&lt;/p&gt;</description><link>http://www.hasith.net/blog/2006/01/impressing-customers-on-their-own.html</link><author>Hasith Yaggahavita</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-15194192.post-113646250193964487</guid><pubDate>Thu, 05 Jan 2006 11:37:00 +0000</pubDate><atom:updated>2007-08-12T09:12:34.535-07:00</atom:updated><title>War between typed datasets and custom entities</title><description>&lt;span style="font-weight: bold;font-size:130%;" &gt;War between typed datasets and custom entities&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In Eurocenter currently we are preparing for a new project-kickoff which is going to be based on the .NET platform. Among many other design decisions we are currently considering an implementation technology for our domain model. We have to decide between "typed datasets" and "custom entities". Both the methods has their own pros and cons. I have done a small research on this and I thought of sharing those information through this blog post.&lt;br /&gt;&lt;br /&gt;Here are some major reasons where I think datasets are better in some situations.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Database integration of the domain objects is very simple. DataAdaptor classes take care of the most of the database operations of the dataset. Also dataset has ability to remember the original values making the dirty object identification very easy.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;   &lt;li&gt;Easy serialization of data entities to XML&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;   &lt;li&gt;Easy binding to most of the UI components&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;   &lt;li&gt;Easy integration with other tools and components (E.g. Biztalk Server)&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;   &lt;li&gt;Very good documentation and community support&lt;/li&gt; &lt;/ul&gt;Antway saying all those plus points of datasets, there are very strong arguments why and where we should not use datasets but go with custom objects.&lt;br /&gt;&lt;ul&gt;   &lt;li&gt;      &lt;p class="MsoNormal"&gt;Datasets makes the system less object oriented (as business methods are separated from the domain model)&lt;br /&gt;&lt;/p&gt;   &lt;/li&gt;   &lt;li&gt;      &lt;p class="MsoNormal"&gt;Too much of generated code of datasets causes code duplication and lesser maintainability.&lt;/p&gt;    &lt;/li&gt;   &lt;li&gt;      &lt;p class="MsoNormal"&gt;Exposing datasets as SOA can make services less interoperable.&lt;/p&gt;    &lt;/li&gt;   &lt;li&gt;      &lt;p class="MsoNormal"&gt;Custom class approach is much cleaner and clear.&lt;/p&gt;    &lt;/li&gt;   &lt;li&gt;      &lt;p class="MsoNormal"&gt;Unit testing is pretty much easy with custom class approach as data is easily bound to the operations.&lt;/p&gt;    &lt;/li&gt;   &lt;li&gt;      &lt;p class="MsoNormal"&gt;Use of DataReaders, SPs and Custom Entities seems to perform better in the sense of memory usage and data fetch time.&lt;/p&gt;    &lt;/li&gt; &lt;/ul&gt;   &lt;p class="MsoNormal"&gt;In my opinion, we need to make sure that we use right tool at the right scenario. In a complex application (lots of integrations), I would prefer going with custom entities. If the application is a data driven or when the application is a disconnected data centered desktop application I would consider using datasets. &lt;span style=""&gt; &lt;/span&gt;&lt;/p&gt;</description><link>http://www.hasith.net/blog/2006/01/blog-post.html</link><author>Hasith Yaggahavita</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-15194192.post-113522154449268420</guid><pubDate>Thu, 22 Dec 2005 03:15:00 +0000</pubDate><atom:updated>2007-08-12T09:13:15.370-07:00</atom:updated><title>Stateless Session beans kill Object Orientation??</title><description>&lt;span style="font-weight: bold;font-size:130%;" &gt;Stateless Session beans kill Object Orientation??&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Recently I had a chance to have close look at OO principles as I had to prepare to deliver a lecture for a ‘advanced OO development’ course. This allowed me to have a back look on OO after working in several commercial J2EE projects. I started thinking… in those projects, have we used proper OO with real encapsulation, inheritance and polymorphism principles??? Answer was “NOP”…&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In most of the J2EE projects people tend to use more service oriented approach rather than going for a object oriented approach due to the J2EE technology limitations. For an example most of the business objects are just plain DTOs where Stateless session beans acts as service providers for those DTO business objects (as an EJB best practice, DTOs are used to transfer entity bean data across tiers :D ). Most of the so called “DTO business objects” are just having a bunch of getters setters encapsulating the attributes. Is this real encapsulation??? No… we need to have the object operations to encapsulate the attributes of our objects. But with DTO business objects we are separating out the object data from its operations causing less encapsulated objects. Making the things worse, stateful session beans did not proved itself in the industry, making OO much away from the J2EE projects.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;At least do we get inheritance properly? Session beans do not support direct inheritance making polymorphism also to be impossible. Having no polymorphism in our business objects directly affects the design quality. We end up with lot of if-else clauses handling different variations of our business object types. It is true that there are tips and tricks to get around with EJB inheritance problems, but that is not we need as poor OO programmers. We need tools (J2EE) to help us; we don’t have much time here to help the tools…&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So where are we heading??? EJB 3 seems a good improvement but still it doesn’t provide all we need. Some times it seems to be bias at J2EE server vendors but not at the java developers (may be as the spec committee is mostly driven by application server vendors). Anyway I wish to talk more on EJB 3 and OO principles in another post.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Considering all, for me it seems going for Spring Framework is still a better approach, especially when you do not need your system to be distributed across several VMs. In my opinion, stateless session beans still are a superior technology for a locally distributed system (When it is not local there are much better solutions like XML over HTTP). When we think of such locally distributed systems we should think those distributed components as services, not as objects. Internally within components we have to follow clean OO principles. In summery we can develop our logic on plain well object oriented object model and expose the operations (if needed) as services over stateless session bean. I believe that approach gives us a better, and maintainable system.</description><link>http://www.hasith.net/blog/2005/12/stateless-session-beans-kill-object.html</link><author>Hasith Yaggahavita</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-15194192.post-113341050305896234</guid><pubDate>Thu, 01 Dec 2005 03:55:00 +0000</pubDate><atom:updated>2007-08-12T09:13:50.828-07:00</atom:updated><title>Add Business Intelligence to Your System</title><description>&lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;font-size:130%;" &gt;Add Business Intelligence to Your System&lt;/span&gt;&lt;span style="font-size:14;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;     &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;o:p&gt;&lt;/o:p&gt;Recently I involved in designing a reporting system and hence have done fair bit of research on the available reporting mechanisms and frameworks. Although the requirement was to use .NET and Windows technologies, I thought of looking in to some other reporting platforms (in java and open source world) as well.&lt;br /&gt;&lt;br /&gt;First thing I got in to my mind was &lt;span style="font-style: italic;"&gt;'Eclipse BIRT framework'&lt;/span&gt;. I remembered looking at the BIRT proposal and architecture about a year back. Also I remembered it had proposed a complete reporting life cycle management system. So I visited Eclipse site and saw that they have released the first stable version of the system and it seemed to be very promising. You can access Eclipse BIRT home page &lt;a href="http://www.eclipse.org/birt/"&gt;here &lt;/a&gt;and a very cool flash demo &lt;a href="http://download.eclipse.org/birt/downloads/examples/misc/BIRT/BIRT_demo_Camv3.html"&gt;here&lt;/a&gt;. (java programmers must see this demo if Microsoft was able to surprisee you with their Visual Studio productivity features :D ) &lt;/span&gt; &lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;Eclipse &lt;a style="font-style: italic;" href="http://www.eclipse.org/birt/index.php?page=intro/intro02.html"&gt;BIRT architecture&lt;/a&gt;&lt;span style="font-style: italic;"&gt; &lt;/span&gt;provided me with a very good understanding of the functionality of a report system. Then I thought of having a look at &lt;a style="font-style: italic;" href="http://jasperreports.sourceforge.net/"&gt;'Jasper Reports'&lt;/a&gt;&lt;span style="font-style: italic;"&gt;.&lt;/span&gt; Jasper also seems to be a rich reporting framework and I got a good understanding of reporting internals by looking at report samples and tutorials of Jasper reports. &lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;So after looking in to couple of open source reporting frameworks then I was ready to get in to my real job, which is to explore .NET related reporting technologies. Visual Studio 2005 comes with two major reporting approaches. One approach is to use &lt;span style="text-decoration: underline; font-style: italic;"&gt;'&lt;/span&gt;&lt;a style="font-style: italic;" href="http://www.businessobjects.com/solutions/crystalreports/default.asp"&gt;Crystal Reports'&lt;/a&gt;&lt;span style="font-style: italic;"&gt; &lt;/span&gt;version shipped with Visual Studio. This is a limited version compared to&lt;span style="font-style: italic;"&gt; 'Crystal Reports XI'&lt;/span&gt; but good enough for most of the reporting requirements. The&lt;span style="font-style: italic;"&gt; 'CrystalReportViewer'&lt;/span&gt; component provides easy embedding of reports to web forms or win forms. Basically if you have a good&lt;span style="font-style: italic;"&gt; 'Crystal Reports'&lt;/span&gt; experience and working knowledge on Visual Studio, you will be able to generate quality reports and embed them in to your web or windows application. One great this I noticed was that Crystal Reports engine is able to generate quality HTML reports having cross-browser support even in complex report navigation requirements (which &lt;span style="font-style: italic;"&gt;ASP.NET 2.0&lt;/span&gt; is failed to do in some cases). &lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;The other approach is to use&lt;span style="font-style: italic;"&gt; &lt;/span&gt;&lt;a style="font-style: italic;" href="http://www.gotreportviewer.com/"&gt;'Microsoft Visual Studio 2005 Reporting'&lt;/a&gt; features with or without &lt;a style="font-style: italic;" href="http://www.microsoft.com/sql/technologies/reporting/default.mspx"&gt;'SQL Server Reporting Services'&lt;/a&gt;. In this approach Visual Studio provides a ÂReportViewerÂ component which can be used either in local-mode (no reporting server involved) or in remote-mode (with SQL Server Reporting Serviback-endning as a backend report server). &lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;Local-mode is seems overlapping with the&lt;span style="font-style: italic;"&gt; 'Visual Studio 2005 Crystal Reports' &lt;/span&gt;and good for simple reporting architectures. Local-mode provides you with more control over the data as you can bind datasets, custom objects in to your reports. If you want more complex/extensible system having report servers running you need to look in to&lt;span style="font-style: italic;"&gt; 'SQL Server Reporting Services'&lt;/span&gt; and use&lt;span style="font-style: italic;"&gt; 'ReportViewer' &lt;/span&gt;remote-mode. In this mode the data binding and report rendering is done within the report server and the report will be exposed as a web service consumable by &lt;span style="font-style: italic;"&gt;'ReportViewer'&lt;/span&gt; components embedded in web forms or win forms. Also SQL Server Reporting services can directly expose html reports with out a separate UI layer in place. Microsoft has done many improvements to their previous &lt;span style="font-style: italic;"&gt;'SQL Server 2000 Reporting Services' &lt;/span&gt;with their new releases of &lt;span style="font-style: italic;"&gt;'SQL Server 2005'&lt;/span&gt; and &lt;span style="font-style: italic;"&gt;'Visual Studio 2005'&lt;/span&gt;. Even though these technologies are not very matured as &lt;span style="font-style: italic;"&gt;'Crystal Reports'&lt;/span&gt;, they seem to be very powerful and robust with the good industry impression they have on the&lt;span style="font-style: italic;"&gt; 'SQL Server 200 Reporting Services'&lt;/span&gt;.&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;One thing I noticed after doing this research is that the reporting technologies have become much matured today with all sorts of user/developer friendly tools and complex/extensible architectural-styles. So it seems the true sense of the word 'Business Intelligence' is not so far from today...&lt;/span&gt;&lt;/p&gt;</description><link>http://www.hasith.net/blog/2005/11/add-business-intelligence-to-your_30.html</link><author>Hasith Yaggahavita</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-15194192.post-113134547939128665</guid><pubDate>Mon, 07 Nov 2005 06:25:00 +0000</pubDate><atom:updated>2007-08-12T09:14:49.353-07:00</atom:updated><title>Automate Your Builds and Tests</title><description>&lt;p class="MsoNormal"&gt;&lt;span style="font-size:130%;"&gt;Automate Your Builds and Tests&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;This is going to be an ice-breaking post on my blog after a long silence. Couldn't write a post for some time as I was bit busy with a lot of work after coming back to Sri Lanka. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;Last few days I was involved in automating build process of a J2EE project in &lt;a href="http://eurocenterddc.com/"&gt;Eurocenter&lt;/a&gt;. The project basically has a Struts based web front end, EJB/JDBC based db/business tier and a web service (XML over HTTP) interface for mobile devices. We have come up with an automation plan which will be implemented within next month and it seems progressing well curruntly. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;      &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;                  &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;So I thought of sharing some stuffs on the automation implementation of our project as it might help someone else in automating their products. As the first step we have to have a rough plan of our automation process. The plan used in our project goes as follows:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;     Write a one-step build script:&lt;/span&gt; Use &lt;a href="http://ant.apache.org/"&gt;Ant &lt;/a&gt;or Ant variants to come-up with a build file with will generate the complete build in one command. You may even consider using Ruby build scripts (&lt;a href="http://www.martinfowler.com/articles/rake.html"&gt;Rake&lt;/a&gt;) for this purpose. (But we should be careful is selecting a immature technology for a core part like the build system of a project.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;Add unit-test execution to the script:&lt;/span&gt; You should carefully select the unit tests which are properly written to run as stand alone tests. If you have followed my previous postings I have discussed some techniques explaining how to make your code testable. We can have an ant task which will run the unit test cases/suits on the compiled code.&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;Come up with a push button release:&lt;/span&gt; Once we have the build script we can extend it to produce single command releases. Basically this involves checking-out the code from a CVS tag and running the build task. This extended build script can be used by the build manager in producing builds for QA testing as well as producing production builds.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;Schedule builds with automation engine:&lt;/span&gt; Here we go with automation. First we need to decide on a build engine. In the open source world there are several good automation engines such as ‘&lt;a href="http://cruisecontrol.sourceforge.net/"&gt;Cruise Control&lt;/a&gt;’, ‘&lt;a href="http://www.urbancode.com/projects/anthill/default.jsp"&gt;AntHill&lt;/a&gt;’ and ‘&lt;a href="http://buildbot.sourceforge.net/"&gt;BuildBot&lt;/a&gt;’. We have decided to go with ‘Cruise Control’ as it seems to be the most popular choice in the java community. In this step we configure our build engine to checkout all the code from CVS periodically (only if any modification is done after the last build) and build the product and run the unit tests. Once we have completed this step we track any build failures (such as compile errors) and unit test failures. In our project we have scheduled builds to run every one hour and this helps capturing introduced bugs within a period of one hour.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;Establish reporting mechanisms:&lt;/span&gt; Through out the process we should be having basic notification mechanisms like Email and web console for reporting build status and failure notifications. All the build engines support these basic reporting mechanisms and all we have to do is to configure those services to suit the need. For an example if a build failed we can configure ‘Cruise Control’ to send notification emails to the developers who have committed code to CVS after the last successful build.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;Automate integration testing:&lt;/span&gt; Here we attempt sub component integration in a test environment. In our project we wanted to make sure that the product components are integrating and deployable on the server. The integration testing will ensure that all the components are properly deployable (e.g. EJB testing) and the component communication channels (e.g. JMS queue testing, database connections) are established correctly. Most of the tests in this stage can be considered as in-container testing and test frameworks like ‘Cactus’ are good candidates to support the testing in this stage. In this stage we run “JBoss’ as our application server then deploy our application there and run integration test scripts.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;Automate functional/acceptance testing:&lt;/span&gt; In this stage we add end-to-end testing to our automation. In our case basically this means performing tests on the web UI and web service interfaces. These test cases are written based on the end-user actions (based on use cases). Example test case is ‘user log-in to the system and changing his password’. In our product ‘HttpUnit’ test cases are written to simulate and validate user actions. Where ever response time is critical we may add performance test scripts written using ‘JMeter’, ‘JUnitPref’, etc… to ensure system response time.&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal" style="margin-left: 0.5in; text-indent: -0.25in;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold;"&gt;Add code analyzers:&lt;/span&gt; Here with each build a code analyzer will inspect the code for “smelly code pieces”. With each build the team lead will get code analyzer report on any added/changed code fragments.&lt;br /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;    &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;      &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;   &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;After coming up with an automation plan we can start implementing the plan. Once implemented, we get a set of actions which will run in a sequence in every scheduled build cycle. For you to get better understanding I will summarize the action steps we have in our project build cycle.&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="MsoNormal"&gt;&lt;span style="font-size:100%;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;span style="font-size:100%;"&gt;1. Checkout sources from CVS&lt;br /&gt; &lt;/span&gt;&lt;span style="font-size:100%;"&gt;2. Build the application from scratch&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;3. Execute build verification tests (unit tests)&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;4. Run code analyzer tool scripts&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;5. Install a ‘JBoss’ server instance&lt;/span&gt;&lt;br /&gt;6. Configure the ‘JBoss’ instance&lt;span style="font-size:100%;"&gt;&lt;br /&gt;7. Create the test database&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;8. Populate test database with test data &lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;9. Deploy the product over the JBoss/file system&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;10. Startup the server&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;11. Monitor log files for successful server startup&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;12. Execute integration test scripts&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;13. Execute acceptance test scripts&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;14. Shutdown the server&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;15. Clean up the build resources&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;br /&gt;16. Report build/test results&lt;/span&gt;&lt;/blockquote&gt;&lt;span style="font-size:100%;"&gt;&lt;/span&gt;&lt;p&gt;&lt;/p&gt; &lt;span style="font-size:100%;"&gt;&lt;br /&gt;Once we got all the basics in place this is the time to play around extreme automation experiments. For example I have heard some project teams having flashing red bulbs in the development environment if a build failed. Trying these kind of extreme practices can bring team moral up towards testing/automation as well as can take attention of the rest of the project teams (in a good sense&lt;/span&gt;&lt;span style="font-size:100%;"&gt;).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;</description><link>http://www.hasith.net/blog/2005/11/automate-your-builds-and-tests-this-is.html</link><author>Hasith Yaggahavita</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-15194192.post-112768983129863915</guid><pubDate>Sun, 25 Sep 2005 22:55:00 +0000</pubDate><atom:updated>2007-08-12T09:17:31.772-07:00</atom:updated><title>Security with Java Cryptography Architecture</title><description>&lt;span style="font-weight: bold;font-size:130%;" &gt;Security with Java Cryptography Architecture&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In the last week I was going through some discussions on how to provide security on our new application we are building at Scali AS. In our architecture the server is a C deamon which uses OpenSSL for security where as the client is a Java RCP which uses JSSE.&lt;br /&gt;&lt;br /&gt;One observation I had in working with java security frameworks is that Java has lot of Security components, but most of the developers has no very clear understanding of where those components fits in to the application requirement they have. So I thought of having a blog post which introduces the Java security components and their usage.&lt;br /&gt;&lt;br /&gt;Here we go... Broadly there are several components belonging to the &lt;a href="http://java.sun.com/j2se/1.5.0/docs/guide/security/"&gt;Java Cryptography Architecture (JCA)&lt;/a&gt;&lt;a href="http://java.sun.com/j2se/1.5.0/docs/guide/security/"&gt; &lt;/a&gt;&lt;span style="font-style: italic;"&gt;(or simply Java Security)&lt;/span&gt;.  JCA can be divided in to several sub categories as follows :&lt;br /&gt;&lt;br /&gt;a)    &lt;a href="http://java.sun.com/j2se/1.5.0/docs/guide/security/jaas/JAASRefGuide.html"&gt;Java Authentication and Authorization Services (JAAS)&lt;/a&gt;&lt;br /&gt;b)    &lt;a href="http://java.sun.com/j2se/1.5.0/docs/guide/security/jsse/JSSERefGuide.html"&gt;Java Secure Socket Extension (JSSE)&lt;/a&gt;&lt;br /&gt;c)    &lt;a href="http://java.sun.com/j2se/1.5.0/docs/guide/security/jce/JCERefGuide.html"&gt;Java Cryptography Extension (JCE)&lt;/a&gt;&lt;br /&gt;d)    &lt;a href="http://java.sun.com/j2se/1.5.0/docs/guide/security/jgss/tutorials/index.html"&gt;General Security Services (Java GSS-API)&lt;/a&gt;&lt;br /&gt;e)    &lt;a href="http://java.sun.com/j2se/1.5.0/docs/guide/security/certpath/CertPathProgGuide.html"&gt;Java Certification Path API&lt;/a&gt;&lt;br /&gt;f)    &lt;a href="http://java.sun.com/j2se/1.5.0/docs/guide/security/sasl/sasl-refguide.html"&gt;Java Simple Authentication and Secure Layer (Java SASL)&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;JAAS is the Java solution (framework) for authenticating and authorization uses and services. JAAS provides user-centric as well as code-centric access control mechanisms. JAAS can be considered as a framework and an API focused mainly for non-connection oriented (stand-alone) application security. It is not about encrypting data but it is a implementation neutral API for authentication and authorization (For an example if we decide to move our usernames/passwords from a properties file to a database, still JAAS wil allow us to do this with out changing application code).&lt;br /&gt;&lt;br /&gt;JAAS authentication mechanism is pluggable so vendors/users may write there own ‘login modules’ to read/validate authentication credentials from their preferred source (e.g. database, directory service). As I know, JDK does not provide many default ‘login modules’ but generally application servers come-up with several reusable login modules such for reading “prop-files”, “simple database tables”, etc...&lt;br /&gt;&lt;br /&gt;JSSE provides a framework and implementation for securing your data in network communications by introducing security later on top of TCP/IP. J2SDK 1.4 onwards supports SSL 3.0 and TCL 1.0 protocols. The most popular SSL model used on internet is to authenticate only the server identity and use encryption on data. Client identity is authenticated using username/password provided by the client (e.g. a typical e-commerce web-site) JSSE provides a convenient API on top of java sockets for enabling your TCP connection security.&lt;br /&gt;&lt;br /&gt;JCE consists of a framework defining java security components such as data encriptors, key generators, etc… Sun has provides a default implementation called “SunJCE” for this framework (For example RSA, DES encryption algorithms, DES key generators are provided with the ‘SunJCE’ provider). We may use this default SunJCE (any other third party provider) to provide some cryptographic operation such as encrypting a data stream using “DES symmetric key” encryption.&lt;br /&gt;&lt;br /&gt;Java GSS-API allows java developers to make their programs to work with Kerberos based authentication. Similar to JSSE, GSS-API provides authentication, encryption and integrity protection on your data. The underline mechanism used is the widely known Kerberos security model. Kerberos provides strong token based security and supports single sign-on capabilities for the applications. (GSS API mechanism is defined as a Internet Standard under &lt;a href="http://www.ietf.org/rfc/rfc2853.txt"&gt;RFC2853&lt;/a&gt;)&lt;br /&gt;&lt;br /&gt;Java Certification path consists of abstract framework classes which allows user to create, validate, manipulate ‘Certification Chains’. Certification chain is a ordered list of certificates which will establish a trustable mapping from ones identity to his ‘public key’. Java Certification Path API also consists of a default implementation for working with X.509 certificates.&lt;br /&gt;&lt;br /&gt;Java SASL is the java implementation of the SASL internet standard defined under &lt;a href="http://www.ietf.org/rfc/rfc2222.txt"&gt;RFC2222&lt;/a&gt;. As the name suggest the SASL standard also provides authentication and secure transmission of data (so it also can be categorize with GSS and JSSE). SASL is defined to be a light weight protocol and used by LDAP and IMAP implementations. Thus any application intended to work with those applications may need Java SASL API for security integration.&lt;br /&gt;&lt;br /&gt;Thus the bottom line is that, we should decide on the technology to be used based on our application context. As a rough example if my application is TCP socket based I may go for JSSE, if my organization security is Kerberos based then I go for GSS-API, if I need to communicate with a LDAP service I may need to consider Java SASL API and so on…</description><link>http://www.hasith.net/blog/2005/09/secure-your-data-with-java.html</link><author>Hasith Yaggahavita</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-15194192.post-112707978117600354</guid><pubDate>Sun, 18 Sep 2005 21:34:00 +0000</pubDate><atom:updated>2007-08-12T09:17:53.343-07:00</atom:updated><title>Ruby blocks, C# delegates, C function pointers and Java inner classes</title><description>&lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Ruby blocks, C# delegates, C function pointers and Java inner classes&lt;/span&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;span style="font-size:100%;"&gt;During the weekend I spent some time to look in to the &lt;a href="http://www.ruby-lang.org/en/"&gt;Ruby  &lt;/a&gt;'Blocks'. Blocks are a Ruby language construct which adopts the concept of method references in a very useful manner. Even though this is not a new idea I haven’t seen a language adapting and using method references to the extent as Ruby does. Let’s look at how Ruby adapts this concept. One of the Ruby’s powers is that it takes fewer lines of codes compared to most of the other languages. For an example in Ruby iterating on an array and printing the elements will look like the following:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;     &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:Arial;font-size:100%;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;span style="font-style: italic;"&gt;array.each { |animal| puts animal }&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:Arial;font-size:100%;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;Actually what happens here is, to the "Array.each" method we pass the code block "{ |animal| puts animal }" so “array.each” method will call the passed code block for each element of the array (&lt;a href="http://www.ruby-doc.org/docs/ProgrammingRuby/html/intro.html"&gt;more information&lt;/a&gt;). As u may see this is not exactly passing methods as references. Instead of passing an external method as a parameter, in Ruby we write our code inline as a code block. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:Arial;font-size:100%;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;Let’s look at some other languages to see the way they allow developers to pass code blocks as parameters of a method.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:Arial;font-size:100%;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;In C# we may gain the same power with Delegates. Delegate is a type that describes a method signature. Methods with the same signature can be stored in a delegate and can be passed as parameters or be invoked. But delegates are more structured, complex and requires more coding compared to Ruby blocks.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:Arial;font-size:100%;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;Function pointers of C allows developers to pass functions as parameters to other functions. They are not type safe as C# delegates so the developers are able to pass functions with different signatures as parameters.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:Arial;font-size:100%;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;Java has no concept called method references and it does that using interfaces and classes. We need to define our code block inside a class and pass that class to the method as a parameter. For an example we use this in implementing listeners, callback routines, and to pass utility code blocks such as compare routines to ‘sorting’ algorithms. Mostly we see these code blocks are implemented as inner classes or anonymous inner classes in java.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:Arial;font-size:100%;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;If you are a regular reader of my blog you may remember the pos&lt;span style="font-size:100%;"&gt;t “&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;a href="http://www.hasith.net/blog/2005/08/intermediate-representations-vs.html"&gt;Intermediate Representations vs Software Performance&lt;/a&gt;&lt;/span&gt;&lt;span style=";font-family:Arial;font-size:100%;"  &gt;&lt;span style="font-size:100%;"&gt;”. There I have explained how to pass a code block to a DAO so that as and when the DAO encounters &lt;/span&gt;a database record it will invoke the passed code block. If you look at the way of Ruby’s “array.each” method works you can see both these implementations share the same concept to a some extent. &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;     &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:Arial;font-size:10;"  &gt;&lt;span style="font-size:100%;"&gt;&lt;o:p&gt; &lt;/o:p&gt;So I may say ruby has adopted the concept of passing code blocks to a method and made it a really useful construct in the language.&lt;/span&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;</description><link>http://www.hasith.net/blog/2005/09/ruby-blocks-c-delegates-c-function.html</link><author>Hasith Yaggahavita</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-15194192.post-112648034642802023</guid><pubDate>Sun, 11 Sep 2005 23:10:00 +0000</pubDate><atom:updated>2007-08-12T09:18:44.345-07:00</atom:updated><title>JMeter in Web Application Testing</title><description>&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;JMeter in Web Application Testing&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Last week I was discussing with &lt;a href="http://www.purpleace.com/en/people.html"&gt;Kartik  &lt;/a&gt;on performing JMeter performance testing on the &lt;a href="http://ripplevault.purpleace.com/"&gt;Ripple&lt;/a&gt; product. They were facing some difficulties in HTTP session handling in their JMeter test plan. This conversation allowed me to refresh my knowledge on this powerful testing framework. So I thought of making a note about &lt;a href="http://jakarta.apache.org/jmeter/index.html"&gt;JMeter &lt;/a&gt;on my blog. This will be a quick and short overview on some of the general JMeter capabilities.&lt;br /&gt;&lt;br /&gt;When considering the non functional testing we often hear people talking about different types of tests. Some of those are “Load testing”, “Performance Testing” or “Stress Testing” on the application under test. First of all it is important to know the meaning and differences of these terms used in application testing.&lt;br /&gt;&lt;br /&gt;a)    Load testing is applying a heavy load on the application and monitors the behavior of it under a heavy load.&lt;br /&gt;&lt;br /&gt;b) Performance testing may be carried out to ensure the application responses within acceptable timing on the requests it’s getting.&lt;br /&gt;&lt;br /&gt;c) Stress testing is for ensuring fault tolerance capability of the application. For an example we may restart the database while application is in operation and check whether the application can recover under such a condition.&lt;br /&gt;&lt;br /&gt;Let's have a quick look at JMeter. JMeter can be readily used in Load and performance testing. The test scripts we may create are called ‘Test Plans’. We can have create several test plans to test our application. These test plans can be used even as automated tests by running JMeter in non graphical mode.&lt;br /&gt;&lt;br /&gt;There are several types of elements in a JMeter test plan. JMeter uses ‘Samplers’ to produce requests. It has ‘Logic controllers’ so we can control our test flow with them (e.g. to repeat a request). ‘Listeners’ are used to capture test results. Delays may be introduced by its ‘Timer’ elements.&lt;br /&gt;&lt;br /&gt;Session handling is an important activity in any practical test plan. For general cookie based sessions we may use a Cookie manager to keep our cookie based session information across the requests. But when URL-Rewriting is used in session management we have to use “HTTP URL-Rewriting Modifier’ to keep session information across requests.&lt;br /&gt;&lt;br /&gt;For me one of the most interesting elements in JMeter is its assertions. For an example returning HTTP 200 by our server doesn’t always mean that the request has been served successfully. That may be a user friendly error message returned by the server when a critical error occurred. We need to be more specific and probably wants to check the returned html to validate the server response. This is made possible with ‘Assertions’ in JMeter.&lt;br /&gt;&lt;br /&gt;When configuring our test plan sometimes we face difficulties in simulating the exact browser behavior with JMeter. One handy tool that would help here is ‘TCPMON’ tool comes with &lt;a href="http://ws.apache.org/axis/"&gt;Axis &lt;/a&gt;utilities. We can capture and compare http communications of JMeter with the communications of browser easily with this tool.&lt;br /&gt;&lt;br /&gt;It is really interesting seeing JMeter as a part of a automated testing environment together with JUnit and HTTPUnit test frameworks…&lt;br /&gt;&lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;</description><link>http://www.hasith.net/blog/2005/09/jmeter-in-web-application-testing-last.html</link><author>Hasith Yaggahavita</author></item><item><guid isPermaLink='false'>tag:blogger.com,1999:blog-15194192.post-112599251973378673</guid><pubDate>Tue, 06 Sep 2005 07:41:00 +0000</pubDate><atom:updated>2007-08-12T09:19:23.246-07:00</atom:updated><title>Use of Visitors in Producing Data Streams</title><description>&lt;span style="font-weight: bold;font-size:130%;" &gt;Use of Visitors in Producing Data Streams&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Few days ago I saw a cool implementation of WBXML parser by &lt;a href="http://uchiblogsat.blogspot.com/"&gt;Uchitha &lt;/a&gt;combining Visitor pattern and Composite pattern. This blog is a note on how we can use Visitor Pattern in producing output streams in a flexible manner.&lt;br /&gt;&lt;br /&gt;We will take a specific example of data manipulation to demonstrate the idea. Assume a client and server communicating via a TCP socket. Server expects a specific protocol from the clients communicating with it. In our example assume clients can request two operations from the server.&lt;br /&gt;&lt;br /&gt;a)    read files from the server&lt;br /&gt;b)    execute commands on server&lt;br /&gt;&lt;br /&gt;Further assume, before doing any of the above operations clients need to login to the server, and after the operation client logout from the server. We use Java TCP socket to send/receive data from/to server.&lt;br /&gt;&lt;br /&gt;Say for an example we need to read a file from the server. Assume steps specified in the protocol are as follows:&lt;br /&gt;&lt;br /&gt;1)      send to server “&lt;span style="font-style: italic; font-weight: bold;"&gt;LOGIN [username]&lt;/span&gt;”&lt;br /&gt;2)     read from server’s “&lt;span style="font-style: italic; font-weight: bold;"&gt;WELCOME&lt;/span&gt;”&lt;br /&gt;3)     send to server “&lt;span style="font-weight: bold; font-style: italic;"&gt;READ /tmp/myfile.txt&lt;/span&gt;”&lt;br /&gt;4)     read from server “&lt;span style="font-weight: bold; font-style: italic;"&gt;FILE-LENGTH=245&lt;/span&gt;”&lt;br /&gt;5)     read from server next 245 bytes (which is the actual file data)&lt;br /&gt;6)     send to server “&lt;span style="font-weight: bold; font-style: italic;"&gt;THANKS&lt;/span&gt;”&lt;br /&gt;7)     read from server “&lt;span style="font-weight: bold; font-style: italic;"&gt;BYE&lt;/span&gt;”&lt;br /&gt;&lt;br /&gt;All these commands are ASCII encoded and send/receive through a TCP socket created with the server. If we look at above conversation&lt;br /&gt;step 1, 2 are related to ‘login’,&lt;br /&gt;step 3, 4, 5 are related to ‘file read’ and&lt;br /&gt;step 6,7 are related to ‘logout’ protocols.&lt;br /&gt;&lt;br /&gt;By separating those steps in to separate entities we allow reuse of entities as well as we may combine them to perform more complex communication patterns. Ok… So far so good… but where is the visitor pattern?&lt;br /&gt;&lt;br /&gt;Basic idea here is we have a visitor (Java TCP Socket) visiting a set of entities (Login, Read Files, Execute and Logout protocol handlers) to perform a certain task. All the protocol handlers have implemented a simple interface called “IVisitableEntity”. “accept” method is ready to welcome a visitor which will be the socket instance in this case.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;strong&gt;public&lt;/strong&gt; &lt;strong&gt;interface&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;IVisitableEntity&lt;/span&gt; &lt;span style="color: rgb(68, 68, 255);"&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;public&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;Object&lt;/span&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;accept&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;&lt;strong&gt;(&lt;/strong&gt;&lt;/span&gt;&lt;span style="color: rgb(32, 64, 160);"&gt;Socket&lt;/span&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;visitor&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;&lt;strong&gt;)&lt;/strong&gt;&lt;/span&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(68, 68, 255);"&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Concrete classes of this interface will be LoginProtocol, FileReadProtocol, ExecProtocol and LogoutProtocol. Here is an example implementation of LoginProtocol. This will handle the steps 1 and 2 specified above.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;strong&gt;public&lt;/strong&gt; &lt;strong&gt;class&lt;/strong&gt; &lt;span style="color: rgb(32, 64, 160);"&gt;LoginProtocol&lt;/span&gt; &lt;strong&gt;implements&lt;/strong&gt; &lt;spa