Smack my build up

Posted on November 29th, 2006 in Software Process by dennis

Here at Jteam we had some discussion about breaking the build. On purpose that is!
We’re using maven2 builds with plugins like checkstyle and pmd, which we use to improve the quality of our software.

Main question is :

Should or shouldn’t the build actually fail whenever plugins like checkstyle or pmd encounter errors during the build process.

In my point of view, it shouldn’t. Breaking the build is not something you want to do here whenever your javadoc is not as it should be or you have too many unused variables. I agree on the fact that we should enforce the quality by using this kind of checks and we want some sort of action to be taken when your build doesn’t comply to these standards, but I don’t think breaking the build is the way to go.

Your product is perfectly fine. The compiler didn’t encounter any problems, your tests (unit, integration, functional) all run fine, and thus the build succeeds. Why let this build fail, when your product is fine, but only under the hood (the things only the developer can see) things are not as they should? It’s not an invalid product, only the quality could be improved.

I think it is much like writing a storyboard for a movie. Suppose your script is not really well documented but partly in the head of the director (incomplete javadoc) and the storyboard uses inconsistent naming conventions for your main characters (checkstyle). Will this block the production of the movie? The viewer wouldn’t even know the ‘errors’, because there are none. Only for the filmcrew the quality of the documents can be improved, for them to ease their work.

On the other hand, an argument like : “We should break it otherwise no one will enforce these rules, and will forget about conventions” , makes sense.

This leaves me with the following question:

How do we enforce quality and on the other hand rather not break the build ?

If you have an opinion on it, or even better, have any experience on this subject, I would really like to hear about it. I’d appreciate any comments.

Software Virtualization Solution

Posted on October 25th, 2006 in Tools by dennis

I recently wanted to check out Internet Explorer 7 (IE7), to check what new features were added, but mainly to check if my developed applications worked as they should in Microsoft’s new browser.

IE Logo

Unfortunately the installation of IE7 resulted in IE6 being sort of upgraded or removed from my system, and left me with the new browser. I couldn’t use the two together. Since I wanted to use both of them, cause I wanted to check my developed website in as much as browsers as I could, I had to figure out some a way to use them both.

On my search for a solution on the internet I stumbled upon virtualization. For the ones not familiar with the term: with this kind of technology you can launch e.g. an operating system as an application on your current operating system. No need for rebooting, dual booting, you just start it up and you can use it, along with all the hardware that is in your pc. It is a very cool subject by the way and I urge you to look at VMware or Virtual PC, which both have a free version available and all kinds of ready to go installatons like linux/ubunto and the likes.

Back to the subject. Making a virtual machine was not that hard by using VMware, but that meant I had to install a second operating system in my virtualization tool (like VMware) and install IE7 in there. A solution, but a tedious one. Thankfully I stumpled upon another virtualization tool which i had never heard of before: Altiris Software Virtualization Solution (SVS). What VMware means for complete operating systems, SVS is for applications.

From the site:

Altiris® Software Virtualization Solution™ (SVS) is a revolutionary approach to software
management. By placing applications and data into managed units called Virtual
Software Packages, Software Virtualization Solution lets you instantly activate,
deactivate or reset applications and to completely avoid conflicts between applications
without altering the base Windows installation.

In short it means that your applications are installed not directly into your machine, but in layers. So no direct changes to your registry/ desktop or whatever are made. It is all virtual. When the layer is deactivated, you wouldn’t even know you had the application installed. But when you activate it, de desktop icons appear and the system is prepared so you can use the application.

Using this application I managed to use both ie7 and ie6 at the same time. You can find a step-by-step tutorial here
and the additional files you need are here http://juice.altiris.com/node/689. SVS itself can be download at several places, but you can get it here http://www.svsdownloads.com/. Like VMware there are certain distributions which are already created for you and ready to use. At the same location you can find pre configured layers (applications) like FireFox, Thunderbird, Miranda Instant Messenger and OpenOffice.

This tool will help you test (beta) applications before you actually decide to use it, without cluttering your desktop and registry, messing up your system and prevents you from the well known DLL-hell.

Note: When using SVS, it is important that you understand how data files are handled. Otherwise you may inadvertently lose data. Please take a minute to read some documentation on this.

You can read more about svs here :
http://www.altiris.com/Products/SoftwareVirtualizationSolution.aspx
Download SVS from here :
http://www.svsdownloads.com/
or a direct link
http://www.svsdownloads.com/download.php?filename=svs/SVS_20_Personal.zip

Go With the Flow

Posted on June 30th, 2006 in Java, Spring by dennis

Introduction
As a frequent user of the Spring MVC framework, I had the opportunity to work with another “Model 2″ framework of Spring, namely Webflow.
Working with Webflow was a great experience for me, as it showed me a different point of view regarding handling view logic, and I like to share some experiences and opinions with you.

If you want to know more about the technical realization of using Webflow in your application, I advise you to read the articles referred to at the bottom of this post.

Workings
The main goal of Webflow is to make it easier for the programmer to handle navigation through the website under development. Nowadays a programmer can get really overwhelmed with all the files that make up his flow through a website. To get a clear picture of the flow he needs to, in the case of Spring MVC, browse through several JSP files, look for the controllers mapped to URLs, and check what view those will return. A tedious process.

Spring Webflow solves this ‘problem’ by letting you define the navigation through a website using a natural, predefined, flow. The advantage of this is that you have a full, and clear, overview of some navigational paths in your application together in one (or more) files, not bothering you with other concerns. I explicitly say ‘some navigational paths’, because you simply cannot model all the paths in your application: Webflow’s primary goal is to support the flow and navigation through a business process, where the user is bound to the predefined flow. These predefined flows are the scope of Webflow. More on this later on.

In code this flow is constructed, for example, using an XML file.


<webflow id="buyArticle" start-state="obtainArticleInfoAction">
   <action-state id="obtainArticleInfoAction">
      <action bean="articleActions" method="bindAndValidate"/>
         <transition on="success" to=" showArticlesView "/>
   </action-state>

   <view-state id="showArticlesView" view="articleOverview">
     <transition on="submit" to="isUserLoggedInDecision"/>
   </view-state>

   <decision-state id="isUserLoggedInDecision">
      <action bean="securityUtils" method="isUserLoggedIn"/>
         <transition on="yes" to="orderItemsActions "/>
         <transition on="no" to="LoginView "/>
   </decision-state>

   <action-state id="orderItemsActions">
      <action bean="ArticleActions" method="orderArticles "/>
         <transition on="success" to="ThanksForYourOrder "/>
         <transition on="error" to="errorView"/>
   </action-state>

   <end-state id="ThanksForYourOrder" view="thankYou" />
</webflow>


As you can see, we have 4 types of states.
1. Action-state
2. Decision-state
3. View-state
4. End-state

There is one more,m but this one is not shown in the example.

5. Subflow-state

• A view state will simply show you a webpage, and waits for input. This state can be compared by a MVC ‘View’.
• In an action state you can call a method on your business layer to perform some actions; retrieve data to populate your shop, place an order or login a user. If the action completes it will redirect you to another state, like a view state, so you can show data you retrieved in the action state. This state can be compared with a MVC ‘controller’.
• Within a decision state you can validate your data, like a conditional statement (if/else, switch). Is the user already logged in? Has he reached his order limit? Depending on the outcome you can direct the user to another state.
• The end state is the final state the flow will enter. Its main purpose is to let the user know his order was processed (or not), and the flow is done. When reaching this state, all resources associated with the flow are cleaned up.
• The subflow state spawns another flow as a subflow.

To sum up: You define your flow in states, in which you can do certain actions. By chaining the states, you create a flow in which the user hops from state to state while navigating through the site.

Experiences
The biggest advantage of Webflow is getting a clear overview of the business processes and how they are implemented as a flow throughout your application. In standard MVC web applications, you were forced to perform the tedious task of navigation through a lot of files to get a clear understanding of the page flow. You had to click through your JSP, find the mapping to the controller, look what view it returns, and browse to that view (over and over again) – all these just to visualize the page flow of the application (Note: there might be a better way; however I haven’t found it yet). With Webflow you can have an oversight of the flow in one file.

One positive side effect of the clear overview of Webflow is that the sketches you used to make to visualize the flow of your application can actually be used here. The flow of the application can be drawn in an UML diagram or even a flowchart, so everybody can look at it and understand it. A business analyst can create the flowchart, where the developer, after that, can use it to code the flow definition in XML. Personally, I prefer using this flowchart principle, because it is the most commonly understood. Your developers, business analysts, even your customers have seen a flowchart once in their lives. So using it makes communicating to, and between, these groups much easier.

Another positive experience comes out of the fact that it is much easier to reuse certain parts (actions) of your project. Where in classic MVC frameworks the executed actions depend on the actual URL called and parameters passed (so a controller is tightly coupled with the view), in Webflow you can reuse a state and use it somewhere else. They are self-contained components and are not (per definition) coupled to a view.

One thing you need to keep in mind though is that Webflow will not replace your presentation framework, it cannot render the view itself, and thus needs a complementary framework that can, like struts or Spring MVC. Spring Webflow is just there to aid you in your development of your presentation logic; for a clear overview and definition of the whole page flow.

One small disadvantage I encountered using Webflow is that it is meant to be used for websites which require an outlined flow, a standard path, like ordering an article for example. These kinds of paths are often determined and controlled by a business processes and usually need a certain amount of steps, which the user needs to traverse, to finish the process. This is called a controlled navigation. Webflow is not suited for applications like online communities or blogs, because there aren’t any pre-defined paths the user needs to follow there. The user can just click on any link and visit any page he wants to. As the user is free to browse to whatever page he wants, you cannot define the flow anymore.

Note: As Webflow was not meant to support this kind of free browsing, it cannot really be seen as a true disadvantage of the product. However it would be nice if it was somehow supported, because the product really helps in creating a clear overview of your page flow.

(Dis)Advantages summary
+ A business analyst can make the flowcharts needed for the flow. He understands the business logic the best so he can model it to the views without the need of any technical skills.

+ It is complementary to other presentation frameworks like struts and Spring MVC. You are not bound to one technology to create your views.

+ The ability to reuse states as black-box components.

- It is not ideally suited for web sites that require a lot of free browsing. It is more suited for a business process, like ordering an article (controlled navigation).

Other resources
If you want to read more about the technical workings of Webflow and how to use it in you application I suggest the following pages. Some are a bit outdated, but still very handy for giving you an introduction how Webflow works.

Spring Web Flows: A Practical Guide
Complete tutorial of a simple Webflow application.
http://www.ervacon.com/products/springwebflow/article/article.html

Spring Web Flow Examined
Technical article by Steven Devijver of Interface21
http://www.javalobby.org/articles/spring-webflow/

Managing Web Conversations with Spring Web Flow
Powerpoint presentation by Keith Donald
JavaZone, 2005
http://opensource.atlassian.com/confluence/spring/download/…

Confluence homepage of the Webflow project
http://opensource.atlassian.com/confluence/spring/display/WEBFLOW/Home