Archive for 2009
Wicket Ramblings
Several months ago, I was assigned the task of developing a web application for a Fortune 500 company. The specific purpose of the application was to allow certain transportation providers to submit claims directly, something they had previously been doing though e-mail. Once submitted, a provider would then be notified with regards to status changes in their claim as it made its way through the company’s revenue system. A provider could then re-log back into the web application to review the particulars of that change.
What made the assignment notable from others was the fact this company had recently set architectural guidelines restricting new web application development to use only the Wicket framework. As some of you already know, Wicket is component based framework competing in the same space as JavaServer Faces (JSF) and Tapestry. Having never worked with Tapestry before, I did have prior experience with JSF. I had been on two previous projects using Apache’s MyFaces, and by the end of my second project, I had some real reservations about recommending JSF as a web application framework. If I had to sum it up at the time, JSF just seemed inconsistent when predicting how you would think it would behave. There were occasions where if you did two similar things in different parts of your application, they wouldn’t necessarily behave similarly. One would be slightly off kilter, requiring you to make tweaks to your code that weren’t required in the other spot to get the same sort of operation. I’ll be first to admit, this might have been in large part due to the third-party JSF components that were purchased for the latter project. So it was with some apprehension that I started this project with yet another component based framework.
Now that I’m near the completion of that project, I’m happy to say that Wicket as a component based framework pretty much flat out works. It may not be perfect, and I believe there aren’t any, but compared to some other offerings, it works. So I thought I share a few top level concepts that I think are core to evaluating and understanding this framework.
But before I begin, learning a component based framework can be daunting, especially if your background is only one of the classical request-response frameworks, like Struts or Spring MVC. It can represent a significant paradigm shift in how you solve the problems at hand. So to help you in that process, I recommend reading the Manning’s publication ‘Wicket in Action’. It’s authored by two of the framework’s committers, so without doubt you can consider them to be experts on the subject. The material they present is done in such a manner so as to keep building on previous concepts, such that you never have the feeling you missed a turn somewhere. By the end of the book you should have a reasonably good understanding of the framework to tackle a moderately complex web application, assuming of course you have previous experience. I say moderately complex, because the book won’t explain how to use some of the more advanced Wicket components, like data grids and accordions that so many web applications are now expected to have. That unfortunately, you’ll have to do that on your own – but hey, you gotta start somewhere.
Now on to some key observations. When learning Wicket, the first thing you’re going to have to understand is models. Without understanding models, you’re never going to get anywhere. Models are the glue between the components and the objects containing the information your app is expected to use. Simply put, they are placeholders that you share with the component. It allows you, the developer, to even change the data object with a different instance while keeping the component completely oblivious. Wicket has several different models, but of all of them, knowing when to use the LoadableDetachableModel is important. Here’s why.
One of Wicket’s key features is its solution to one of the ‘Holy Grails’ of web applications – built-in support for the back button. It does so by serializing each and every page, which basically means the components and the models they reference, to a Wicket abstraction called a PageMap. PageMaps themselves can be written to disk, so as to limit the amount of HTTP session being used. When you hit the back button all that you’re really doing is restoring that page’s state as previously captured in the PageMap. Sounds expensive, but it’s not nearly as bad as it could be if you are using a LoadableDetachableModel. What a LoadableDetachableModel will allow you to do is control what gets serialized. So what if your model references an entity, which is typically a row in a database. Then it makes sense that all you would want to do is serialize the primary key. Why? Well like most component based frameworks, Wicket has several distinct phases it goes through with each request – response cycle. At the end of a response, Wicket will call the detach method on all components using a LoadableDetachableModel. This will set your entity object in the model to null before things get serialized. Then at the start of the next request, when the component requests the entity, it will get restored. How? Well the LoadableDetachableModel sees that the entity is still null, so it calls a method that you supplied called ‘load’. Of course by now the primary key you had previously stored is already deserialized. All you have to do is get the entity back from the database before Wicket does anything to it, like binding new values posted from the browser. Pretty slick!
All web applications are expected to do Ajax these days, and Wicket does not disappoint. It has a well integrated Ajax framework that’s easy to use and easy to control. It’s as simple as using an ‘Ajaxified’ component, or adding an Ajax behavior to a component that isn’t to initiate an Ajax request. Then all you have to do is decide what components should be updated as a result of receiving the request. Let me give an example. In the web app I built for my client, there was need to allow the user to search for current and previous claims. The business owners wanted to supply two distinct methods of searching, by allowing the user to either fill out one set of fields and search, or fill out the other set and search. To make the user interface less confusing, I decided to use a dropdown with a simple description of each of the search methods. I also encapsulated the fields associated with each of the searches into a Panel. A Panel is nothing more than a component that can act as a container for other components. But more important is that you can also associate with the panel its own html fragment for displaying what’s in it, the search fields in this case. And a Panel can also provide the necessary validation and business logic that may be required for those fields. This really makes it nice when you want to reuse them throughout your application. But here’s how the rest of the design unfolds.
I used a DropDownChoice component, and as you can probably already guess, it was used to represent my dropdown. Because this component isn’t inherently ‘Ajaxified’, some are and some aren’t, I had to add an AaxFormComponentUpdatingBehavior to instruct the component to make an Ajax request with each ‘onchange’ event of the dropdown. Behaviors, like models, is something else you will need to know. They are often used to add new capabilities to a component – like Ajax. Anyway when the search page is initially displayed, only one search panel is shown. When the user doesn’t want that one, he makes a new selection in the dropdown. This creates an Ajax request where it will be received back at the behavior’s handler on the server. All I had to do at this point inside the handler was determine the new state of the dropdown, select the appropriate panel to be shown, and tell Wicket to render this one and not the other. When it was all said and done, the panel swapping amounted to just a few lines of code. All of the nitty-gritty update details and Ajax plumbing was handled by the framework. Sweet!!
I have just one last thing I’d like to mention about Wicket, and that’s its excellent templating and page layout features. What makes Wicket different is how you associate your page’s HTML with the java code. It’s through the class hierarchy. So wherever you create a class to be used as the code for the page, you also create an HTML file in the same package with the same class name, but instead with a ‘html’ file extension. So whenever your class gets instantiated by the framework, it also knows if there is an html file with same class name, then this is the HTML to be used.
Big deal, right? Well read on a little further. What the Wicket folks have cleverly done is not only load the html with this class, but any html associated with any of the classes up the hierarchy, basically allowing you to nest the html that is lower in the hierarchy into the html that is higher. All through the use of the Wicket tags <wicket:extend> and <wicket:child>. So how do you use this to your advantage?
Well like working with other web frameworks, you generally create a base class that serves as an extension point for the rest of your classes, and with Wicket WebPage it is no different. But what you’ll want to do with this base class is also create an html file with the same name that defines the overall look and feel of your web pages. It may display the application’s title at the top, maybe a place to put menus to the left, etc. This page will basically act as your application’s template. Any class that extends this base class and provides its own html can place it inside of this template. Cool! Gone are the days of all those nasty Tiles’ definitions. As a matter of fact, throughout the entire development of my app did I ever once have to create a single XML file for Wicket! I just followed the conventions and things worked.
If your thinking about venturing into the realm of component based frameworks and you have been searching around, please give Wicket some serious consideration. It may not be easy at first, but I think once you get over the hump you’ll learn to appreciate what it can do for you.
By: Mark Raterman
Bind XML message to Java objects using JiBX – JiBX binding tutorial
JiBX binding tutorial
Companies are moving more and more towards service oriented architecture (SOA) and SOA services communicate with well formatted XML message. If you are working in an SOA Java environment one of your development goal is to bind XML message to Java objects. Jibx is a great open source tool for binding XML data to Java objects. Two main components of Jibx are Binding compiler and Binding runtime. Binding Compiler use binding definition document to specify how Java objects are converted to or from XML. Binding compiler can be linked to your Ant build script and executing the build script does bytecode enhancements on already compiled java classes. Enhanced class files generated by Binding Compiler user Binding Runtime to build objects from XML document and vice versa.
This is a code block from my ant build script that executes jibx binding compiler on complied java classes. Order-Request.xml and Order-Reply.xml are the binding definition documents i have used for XML messages of a request reply messaging pattern.
<path>
<pathelement location=”${basedir}/lib/lib/jibx-run.jar”/>
<pathelement location=”${basedir}/lib/jibx-bind.jar”/>
</path>
<target depends=”compile” description=”Run Binding Compiler on compiled java class”>
<echo message=”Running binding compiler…”/>
<java classname=”org.jibx.binding.Compile” fork=”yes” classpathref=”binding-classpath” failonerror=”true”>
<classpath>
<pathelement location=”${project.classes.dir}”/>
</classpath>
<arg value=”${project.classes.dir}/com/dj/bookorder/Order-Request.xml”/>
<arg value=”${project.classes.dir}/com/dj/bookorder/Order-Reply.xml”/>
</java>
</target>
Runtime uses Jibx BindngFactory to construct Marshalling and Unmarshalling contexts , which can be used to convert XML message to Java object or vice versa. Jibx BindingFactory is obtained by passing any of the classes defined by the mapping in your binding definition document using methods defined in the Jibx BindingDirectory class.
Unmarshalling example:
public BookOrder getUnMarshalledBookOrderRequest(String xmlMsg)throws Exception{
BookOrder bookOrder = null;
IBindingFactory bfact = BindingDirectory.getFactory(BookOrder.class);
IUnmarshallingContext uctx = bfact.createUnmarshallingContext();
Object obj = uctx.unmarshalDocument( new ByteArrayInputStream(xmlMsg.getBytes()), null);
if(obj instanceof BookOrder)bookOrder =(BookOrder)obj;
return bookOrder;
}
Marshalling example:
public String getMarshalledBookOrderReply(Object obj)throws Exception{
IBindingFactory bfact = BindingDirectory.getFactory(BookOrderReply.class);
IMarshallingContext mctx = bfact.createMarshallingContext();
StringWriter writer = new StringWriter();
mctx.setOutput(writer);
mctx.marshalDocument(obj);
return writer.toString();
}
Jibx Binding Definition: Jibx Binding definition document is the core part of using Jibx and let’s see how do we write binding definition document for the following XML.
<?xml version=”1.0″ encoding=”UTF-8″?>
<book-order>
<books>
<book>
<isbn>45127833211</isbn>
<book-name>Cooking for Dummies</book-name>
<order-date>20090912</order-date>
<order-amount>20.56</order-amount>
<shipping-date>20090922</shipping-date>
<payment-type>
<card-payment>
<auth-code>98</auth-code>
<expire-date>20130925</expire-date>
</card-payment>
</payment-type>
<billing-address>
<address>200 Links Dr</address>
<city>Dardenne Prairie</city>
<state>MO</state>
<zip-code>63368</zip-code>
<country>US</country>
</billing-address>
</book>
<book>
<isbn>95127833211</isbn>
<book-name>Art for Dummies</book-name>
<order-date>20090912</order-date>
<order-amount>10.56</order-amount>
<shipping-date>20090922</shipping-date>
<payment-type>
<check-payment>
<check-number>123456783621</check-number>
</check-payment>
</payment-type>
<billing-address>
<address>200 Links Dr</address>
<city>Dardenne Prairie</city>
<state>MO</state>
<zip-code>63368</zip-code>
<country>US</country>
</billing-address>
</book>
</books>
</book-order>
Following is the binding definition I am using for the above XML. We will come to the elements in a while.
<binding package=”com.dj.bookorder”>
<mapping>
<collection field=”bookList” usage=”optional”>
<structure flexible=”true” ordered=”false”>
<value field=”isbn”/>
<value field=”bookName”/>
<value field=”orderDate” deserializer=”com.dj.bookorder.binding.util.JibxHelper.deserializeDate”/>
<value field=”orderAmount”/>
<value field=”shippingDate” deserializer=”com.dj.bookorder.binding.util.JibxHelper.deserializeDate”/>
<structure field=”paymentType”/>
<structure field=”billingAddress”/>
</structure>
</collection>
</mapping>
<mapping choice=”true” ordered=”false”>
<structure field=”cardPayment” usage=”optional”/>
<structure field=”checkPayment” usage=”optional”/>
</mapping>
<mapping>
<value field=”authCode” />
<value field=”expireDate” deserializer=”com.dj.bookorder.binding.util.JibxHelper.deserializeDate”/>
</mapping>
<mapping>
<value field=”checkNumber” />
</mapping>
<mapping>
<value field=”address” />
<value field=”city” />
<value field=”state” />
<value field=”zipCode” /
<value field=”country” />
</mapping>
</binding>
Given below is the reply xml message and binding definition
Reply xml message:
<book-order-reply><process-date>20091112</process-date></book-order-reply>
Binding definition for reply message:
<binding package=”com.dj.bookorder”>
<mapping>
<value field=”orderProcessDate” serializer=”com.dj.bookorder.binding.util.JibxHelper.serializeDate”/>
</mapping>
</binding>
Jibx binding definition elements:
<binding> element: This element is the root of a binding definition document and defines characteristics of the whole definition document.
<mapping> element: Mapping element defines the binding used for every objects within the context.
<collection> element: Collection element defines binding for a Java collection. In the example XML <book-order> can have any number of <book> elements inside a <books> element. In the binding definition document <books> element is bound to a java collection bookList.
<structure> element: This element can take various forms. One is where the structure is an xml element which is linked to an object property of a containing object. In the example binding definition document , structure billing Address is mapped to <billing-address> element which is bound to BillingAddress property of containing object Book. Another variation is where <structure> element is linked to an object of a collection. In the example book structure is linked to Book object of books collection.
Custom serializer and deserializer:
For more control over JiBX binding behavior you can write custom serializer and deserializer code for conversion. Given below code gives you flexibility of converting a date to any date format you like public class JibxHelper.
{ public static Date deserializeDate (String value) throws ParseException
{ return new SimpleDateFormat(“yyyyMMdd”).parse(value);
}
public static String serializeDate(Date value) throws ParseException {
return new SimpleDateFormat(“yyyyMMdd”).format(value);
}
}
Here is an example implementation of Jibx marshalling and unmarshalling
// getBookRequest() get xml String message – This can be from the SOAP request , JMS message or from a file in your hard disk
String xmlMsg = getBookRequest();
MessageUtil util = new MessageUtil();
// getUnMarshalledBookOrderRequest method defenition is given at the section titled ‘Unmarshalling example:’ in this blog.
BookOrder order = util.getUnMarshalledBookOrderRequest(xmlMsg);
for(Iterator it=order.getBookList().iterator();it.hasNext();){
System.out.println(((Book)it.next()).getBookName());
}
BookOrderReply orderReply = new BookOrderReply();
orderReply.setOrderProcessDate(new Date());
// getMarshalledBookOrderReply method defenition is given at the section titled ‘Marshalling example:’ in this blog.
System.out.println(“Reply Message :”+util.getMarshalledBookOrderReply(orderReply));
Above example parse an XML string , convert to Java object , iterate through a collection and print Book name. Also convertes object to an XML string as well, which can be passed as the reply to incoming request message. Example generates the given below out put.
Cooking for Dummies
Art for Dummies
Reply Message :<book-order-reply><process-date>20090917</process-date></book-order-reply>
Given below is Java object defenition of BookOrder and Book classes used in this example.
public class BookOrder implements java.io.Serializable
{
private ArrayList bookList = new ArrayList();
// To Do – Add setter and getter methods
}
public class Book implements java.io.Serializable
{
private String isbn;
private String bookName;
private BillingAddress billingAddress;
private Date orderDate;
private BigDecimal orderAmount;
private Date shippingDate;
private PaymentType paymentType;
// To Do – Add setter and getter methods
}
Please refer http://jibx.sourceforge.net/index.html for more information on Jibx.
List files sorted by date in java
File inboxDir = new File(“Path to your directory”);
File[] files = inboxDir.listFiles();
Arrays.sort( files, new Comparator()
{
public int compare(Object o1, Object o2) {
return new Long(((File)o1).lastModified()).compareTo(new Long(((File) o2).lastModified()));
}
});
Unidev Introduces a Content Management System Designed with Law Firms in Mind
Auctori:law Provides Turn-Key Web Solution for the Legal Industry
Unidev® is proud to announce Auctori:law™, a Microsoft Certified Web Content Management System (WCMS), designed specifically for law firms, will launch on October 15, 2009. Unidev designed the WCMS in association with several law firms to give attorneys and legal professionals an easy to use, but powerful system to update and maintain their professionally designed website.
�
Web-based Auctori:law gives attorneys the power to dynamically update their site from anywhere in the world, at anytime. With Auctori:law, it is simple to build and edit website content without the help of a professional or having had previous experience or knowledge in HTML. By simply logging into a site through a secure, password-protected portal, site administrators can update content, change images, add keywords and make other instantaneous changes to their websites.
Auctori:law is a Software as a Service (SaaS) solution providing all of the benefits of cloud computing. Unidev’s solution provides firms with the opportunity to strengthen their Internet presence and their overall brand reputation by giving lawyers a professionally designed site and the power to maintain their content in real time. In addition to standard content management features, Auctori:law is equipped with an attorney biographies module, news and articles module, and an images module. Auctori:law adheres to all Search Engine Optimization best practices in order to maximize website traffic and usability.
“While I have worked in database driven content management programs in the past, I continue to be impressed by the level of sophistication and ease of use of the WCMS as built by Unidev for our law firm. Through Unidev’s WCMS I am not only able to freely edit content throughout our site, I am now in charge of navigation items and graphics, previously outside the realm of my editing parameters,” said Kelly Annis, Client Relations Manager for The Stolar Partnership, LLP.
A Few Unique features of Auctori:Law include:
• Attorney and professional biography builder with profile photos, dynamic V-card generation, customizable fields, and professional PDF printing functionality
• Flexible content pages and navigation structure for creating practice areas and industry sections
• News and articles module to create and archive publications, resources and events.
• Multi-lingual
• Print-ready PDF documents
• Secured document libraries
-To see two excellent examples of Auctori:law in action, please visit The Stolar Partnership, LLP at http://www.stolarlaw.com and Paul J. Passanante, PC & Associates at http://www.passanantelaw.com.
“We are very excited about the launch of Auctori:law,” said Greg Alexander, CEO of Unidev. “Our team is very experienced in developing customized legal websites. We developed this WCMS designed specifically for the legal industry based upon this experience. Auctori:law presented itself as an excellent opportunity for our clients to really take control of their websites with an application that truly answers the needs of a legal firm. I am confident that Auctori:law is a complete solution for any law firm’s online needs.”
Put the Power into Your Hands Today …
Contact Auctori:Law for further information and for a free Auctori:Law™ demonstration! Call us at: 888.629.4672 or email us at: demo@Auctori.com.
Using PHP FastCGI mode on Windows Server 2003 x64 w/ IIS in 32-bit mode
I recently needed to upgrade the PHP for a particular site from 5.2.6 to 5.3.0. Of course, this is when I found out that PHP no longer supports the ISAPI module and instead wants you to use FastCGI. Luckily I found a great article on how to configure IIS at http://learn.iis.net/page.aspx/247/using-fastcgi-to-host-php-applications-on-iis-60/. However, these instructions have some caveats in regards to running IIS in 32 bit mode on Windows Server 2003 x64. To make a long story short, just like with most things running in 32 bit mode on x64, everything that references %WINDIR%\system32 really needs to point to %WINDIR%\SysWOW64. If you use the fcgiconfig.js script, this will configure everything to point to %WINDIR%\system32.
- The Web Service Extension needs to point to %WINDIR%\SysWOW64\inetsrv\fcgiext.dll.
- The .php extension on the website also needs to point to %WINDIR%\SysWOW64\inetsrv\fcgiext.dll.
- The fcgiext.ini file must also be located in %WINDIR%\SysWOW64\inetsrv. Otherwise you will get a 500 error from FastCGI saying it cannot find the configuration file.
Note that the fcgiconfig.js script is only installed in %WINDIR%\system32\inetsrv. I was able to create a fcgiconfigwow64.js file that points to the correct files. The script needs to have at least an ini file with the “[Types]” section in the %WINDIR%\SysWOW64\inetsrv directory. It also needs to be located under %WINDIR%\system32 as it doesn’t support running under Wow64. You just need to change the following 2 lines near the top of the script.
From:
var g_iniPath = g_Shell.ExpandEnvironmentStrings( "%WinDir%\\system32\\inetsrv\\fcgiext.ini" );
var g_extensionPath = g_Shell.ExpandEnvironmentStrings( "%WinDir%\\system32\\inetsrv\\fcgiext.dll" );
To:
var g_iniPath = g_Shell.ExpandEnvironmentStrings( "%WinDir%\\SysWOW64\\inetsrv\\fcgiext.ini" );
var g_extensionPath = g_Shell.ExpandEnvironmentStrings( "%WinDir%\\SysWOW64\\inetsrv\\fcgiext.dll" );
Development Efficiency
Development efficiency is an area we are constantly investing in and working to improve. I feel it is imperative that we are able to deliver value to customers at the least cost possible. Just like Walmart, if we drive the costs down to develop high function software and then pass the savings on, it is a great thing for both us and our customers.
There are two general methods for approaching a development project (be it a simple website or a complex application). The first is to get a complete defintion prior to coding and then focusing on driving to completion, staying as true to the original design as possible. The second is to define a clear target but assume that the direction will change and that the requirements will change as more information becomes available during the design and development phases. Both work, we tend to the later because we feel our ultimate goal is to deliver the best value product to the customer which may or may not be exactly what was originally defined.
There are a number of important cost drivers of a development effort. Effective communications with the customer and within the team are probably the most important one. By communicating in a timely and complete manner, you can drastically reduce rework. This is also the biggest challenge as everyone communicates differently. It is easy to require daily meetings, it is a lot more difficult to ensure that everyone understands completely everything that was said in the meeting.
We designed the layout of our offices to support easy and constant communications between team members using a open spaces, sound deadening materials which allow many conversations to occur simultaneously without disturbing others. We encourage ‘rollup meetings’ and collaboration between team members to help make sure that everyone is moving in the same direction at all times. Teams coordinate activities within the team even though individual members may be from different operating groups (technical, creative, etc.) reducing unnecessary management overhead.
Other simple investments to make to improve efficiencies are having large and available white boards for discussions, dual or triple monitor development stations (probably the most cost effective efficiency there is), fast workstations and servers (it doesn’t help if it takes a lot of time each day to do the basic development housekeeping such as check in and check out) and available development, test and production systems so teams are not stepping on one another. The software tools you use are worth some effort to evaluate thoroughly. Developers will often gravitate to the latest and flashiest tools but those are not always the best idea, especially if they do not noticably improve the teams production and they are not consistent with the rest of your development platform. It is important however, to make sure you have excellent tools as these can be a great timesaver and a very worthwhile investment.
Training is another critical investment. Teams need to be aware of the latest methods and processes. Not only does this help with the code quality but also with creating more efficient designs.
With investment, training and time, you can work to reduce your development costs significantly. With lower costs, you also have a better risk profile which is a great value to both the developer and the customer.
Unidev Employees Attend St. Louis Day of .NET Conference
The second annual St. Louis Day of .NET conference was held on August 28th and 29th, 2009. Over 500 local .NET developers, architects and other technologists, including Unidev’s George Zheng and Jinhai Wang, attended the highly anticipated event at the exciting location of The Ameristar Casino in St. Charles, Missouri. The conference, with too much info to pack into just one day, had over 50 technical sessions from local and national experts on Saturday and Sunday covering all the technologies of today, as well as providing a sneak preview of the technology possibilities of the future.
George and Jinhai took a lot of useful information from the conference and were exposed to new skills and ideas. “Day to day we use the various Microsoft Tools to focus on one project, but the conference covered every aspect of the tool. Meeting with other users of the same tools, helped me to become quicker, more educated and more productive,” George Zheng says of his experience at the conference.
Jinhai found the session on Language Integrated Query (LINQ), presented by Keith Dahlby, Senior Consultant at Inetium, to be most impressive. The session explored technologies that make LINQ possible and discussed how you can use the same techniques to make LINQ work for you. Another session Jinhai and George both found notable was the session on Silverlight presented by Brad Tutterow, Senior Consultant at Daugherty Business Solutions. Silverlight is a browser plug-in that allows .NET developers to write rich internet applications (RIAs). The session covered how to use Visual Studio and the Expression Studio suite together to build a working Silverlight game, the outcome of the presentation was a working Silverlight game that participants got to take home with them.
A few of the session topics covered at the conference included C #, VB.NET, Sharepoint, WPF, WCF, Visual Studio, .NET 4.0, Expression Blend, SQL Server 2008, ASP.NET MVC and Windows Azure. In an effort to provide the most rewarding experience possible to participants, this year’s conference offered a wide variety of alternative sessions and other unique opportunities such as roundtable discussions, “Birds of a Feather” opportunities, a vendor fair and a Friday night social at Home Night Club, located in the Ameristar Casino.
George and Jinhai both saw the .NET Conference as a success and found the experience to be extremely beneficial to their work at Unidev. They are looking forward to what the St. Louis Day of .NET 2010 Conference has in store!
Software Life Cycle, Source Code and Intellectual Property
An important but often neglected consideration when contracting for the custom development of your web site or software application are the long term issues such as who owns the source code, is it updated, who maintains the code and do you have the right to change vendors down the line and under what circumstances. While this has been an issue for a long time with custom software development, it is becoming much more common now with custom web sites as they become much more powerful through the use of content management tools and e-commerce components. In the past, with a simple brochure site, you could throw away the old one and develop something new to replace it. With today’s powerful tools, a sites appearance can change but the background code can last for many years.
In most cases, a web design or software development company will have some standard code libraries that they utilize for each project. This is a good thing in that it allows you to get more function usually at a lower cost and faster than developing everything just for you. These libraries could have been developed over a long time across a large number of customers. To replicate them from scratch could cost more than your entire project. The potential issue that you need to resolve in your contract is how do those common libraries affect your ability to upgrade long term. Web server platforms, operating systems and technologies are constantly changing. Are those libraries continually updated to the latest versions? What happens if the vendor goes out of business or decides to no longer support those libraries? What happens if you want to change vendors? At a minimum, you should consider software escrow with a trusted third party from whom you will be able to get the source code if your current vendor goes out of business or no longer supports the software.
Also, you should consult your lawyer about the ownership of the code and content being developed for your site. If you are having work done overseas, then you should understand that any enforcement of your intellectual property rights or ownership of the source code is going to be difficult at best. Trying to prevent a foreign entity from divulging or reusing your proprietary information would be an expensive and difficult effort.
If you are have enhancements or modifications done to your software, make sure you have the very latest source code when it is complete. The software developer may or may not keep good track of small modifications made to your programs. It is critical that you or your vendor have the ability to rebuild your site at any time from scratch and that you have some legal recourse to obtain all of the source code if the vendor ceases business. I would also try to get the source code if the business unit you worked with is sold. The new owner may have different ideas about how/if you are supported.
In summary, you need to really understand exactly what you are buying and consider what options you have going forward. Without source code (and/or the legal right to it), you will have limited options if your vendor goes out of business, he decides to abandon the software, you have a falling out with the vendor or you wish to change vendors.
Bidirectional Associations and JiBX
I recently needed to use JiBX to parse a XML document into domain objects that contained bidirectional associations with collections. The issue started out as a simple NullPointerException since each child object did not have a reference back to its parent.
After some searching on Google, the only suggestions that I came across had to do with using the post-set attribute, which gets called after the class has been unmarshalled. For various reasons, most of which I did not want the domain classes tied to JiBX, I sought out a different solution.
The solution I came up with was to use a set-method for the collection instead of field. So I replaced field=”fieldName” with set-method=”setFieldName”. This set method ensures that the bidirectional association is properly defined.
There is an argument to be made that I should be doing this anyway. After all, the domain class probably should not let it be up to the caller to ensure the bidirectional association is properly defined, regardless if it is being called from JiBX or some other caller.
However there was one unintentional side affect. The project is also using Hibernate. The same domain classes were mapped using lazy associations. This change to the set method in affect turned off the laziness. The solution for this was to change the Hibernate mappings to use field access to bypass the set method.
New Unidev Microsoft .NET Technology Blog
We’ve added a new .NET technology blog that is specifically focused on Microsoft .NET development and Microsoft SQL Server. This blog is written my the various developers from our .NET team and will cover a broad range of topical technical issues. We hope you find articles like the recent one about IE 8 connectivity issues useful and a good read. Please feel free to offer us feedback as we’ll certainly need it.