Tuesday, May 29, 2007

Book Review: "Dreaming in Code"

I took my daughter to the library a couple of weeks ago. As we were walking toward the checkout line, I realized that I needed something to read, too, and looked at the books on the nearby "New Arrivals" stand. A title "Dreaming in Code" caught my attention. Brief look at the back cover confirmed that the book was indeed about software development. A non-technical book on software development written by a journalist? You don't see that every day. I borrowed "Dreaming in Code" from the library and I'm certainly glad I did.

After spending over a decade in the industry I knew from experience that most software projects are delivered either late, way over budget, or with significantly reduced features. I have read "The Mythical Man-Month" and understood that there are dark forces at play. Still, deep in my heart I believed that somehow somewhere exists a group of people that knows exactly how to avoid all common project pitfalls. Wouldn't it be great to learn who they are and how they do it?

Scott Rosenberg's book follows the life of one project launched in the heart of Silicon Valley by none other than Mitchell Kapor, creator of Lotus 1-2-3. The idea was to create a revolutionary personal information manager that would also be cross-platform and open-source. Kapor personally financed the venture, so there was no pressure from the "suits". Some of the brightest programmers started to work for Open Source Applications Foundation. And yet the project (code-named "Chandler") had its share of disappointments, delays, and trade-offs. Six years from launch, it is currently at version 0.7 alpha 4 which contains only the calendar (original vision also includes email, tasks, notes, and contact management).

"Dreaming in Code" is much more than a chronicle of Chandler and OSAF, though. It weaves into its storyline short essays that introduce reader to concepts like open-source development, structural and object-oriented programming, methodologies such as capability maturity model and agile. The book contains quotes from Engelbart, Raymond, Knuth, Brooks, Dijkstra, and many many other outstanding people. I guarantee you will learn something by reading it.

Book's website http://www.dreamingincode.com/ has links to Amazon and Barnes & Noble.

Tuesday, May 01, 2007

Integrating Services on User's Desktop

.NET architects, including myself, enjoy talking about services, service-orientation, and enterprise service bus. Our emphasis is clearly on the server side. Although that is indeed very important and extremely interesting, we tend to forget that people (whom we contemptuously call "users") are mostly interested in client-side systems. These systems are predominantly intranet-based, and their sole purpose - contrary to that of their client-server predecessors - is to invoke services. Services implement core business logic for applications that range from human resources to inventory management and from accounting to business operations control. So, when we implement SOA in our enterprises, what options do we give to users?

At the very high level, there are two principal choices for user interface: web application and windows forms (winforms) applications - thin and thick clients, respectively. Until recently, web applications were the clear winners when it came to integrating services on a desktop. Obvious advantages such as small footprint and ease of deployment gave them an edge over winforms.

Then in December 2005 Microsoft Patterns & Practices group has released a Composite User Interface application block followed by Smart Client Software Factory in June 2006. Composite UI application block is a framework for building complex, event-driven, and modular winforms applications efficiently. Smart Client software factory builds on top of it, adding proven design patterns, Visual Studio automation and extensive reference implementation. These releases, combined with ClickOnce deployment subsystem in .NET 2.0, have dramatically changed the landscape for desktop services integration. I am going to compare Smart Client architecture with web applications from that angle.

One of the key benefits of Smart Client applications is their inherent modularity. Classic winforms programs consist of numerous forms and ASP.NET consists of numerous web pages. In Smart Client, there is a single shell form and multiple modules. UI elements are part of the module; they are created using Model-View-Presenter design pattern. From the service integration perspective, it is beneficial to use plug-in modules for different service groups.

Data Exchange.
Lack of attention to client systems usually results in proliferation of single-use applications. Users need to constantly switch from one web application to another, or from web to winform and back. Not only this is confusing, but it may also be counterproductive, because there is typically no automated way to exchange data between systems and users have to resort to copy-paste technique. Smart Client applications have built-in capability to exchange data and events between objects.

UI Consistency.
Multitude of client applications (no matter web or winform) which are produced by different development teams makes it very difficult to maintain UI consistency. On the other hand, modular approach of Smart Client allows engineering teams to work independently on a single solution, thus reusing code and applying consistent UI.

UI Quality.
Having spent many years developing web applications, I am convinced that the quality of their user interface will never measure up to that of windows applications. Sure, ASP.NET 2.0 has many improvements, but it is the underlying platform that has problems. HTML was not designed for UI rendering, although this has been somewhat improved with CSS. Add a requirement to support different web browsers (with their different user settings), and we end up with a lowest common denominator. Naturally, there are third party UI libraries for ASP.NET but they are a) expensive and b) usually available for winforms as well.

Web Server Considerations.
SOA must be designed and deployed with optimal balance between scalability and performance. When we develop client-side system as a web application, we are essentially adding another service to our environment. Yet, its design is rarely as rigorous as the design of main services. As a result, users of the application may experience problems caused by poor server-side design. Smart Client, by contrast, doesn't rely on any other services except main SOA.

Web applications built using ASP.NET 2.0 have at their disposal such security features as membership and role providers, security controls. These are typically linked to a custom database schema. Smart Client applications have built-in authorization mechanisms: for example, it is possible to limit access to a module, command, or view by user role. No dedicated database is needed since we can get membership information for the current security principal from the organization's Active Directory. By combining multiple modules into a unified application, we are in effect providing a single-sign-on functionality.

Anyone who had deployed .MSI packages or setup CDs to even a small number of users will tell you that ease of deployment is the biggest benefit of web applications. Indeed, once you post updated code to the web server, there is nothing more to do: next time user accesses the web site, he or she will execute the latest version of the application. ClickOnce technology, which has debuted in 2.0 version of .NET framework, brings similar experience to the world of winforms systems. ClickOnce has several deployment patterns: for example, it allows applications to be published to a file share or URL. If we choose the online-only mode, users will have to launch the program from that location (this is very similar to web applications). However, we may allow application to be available offline. This way, the binaries will be downloaded to user's computer and program title will appear in Start menu and Control Panel. Every time the application is launched, it will check for updates and prompt user to download latest code if available.

Hopefully, I managed to convince you that Smart Client applications are a viable alternative to web when it comes to integrating services on user's desktop. The only way to find out if the technology is a match for your specific requirements, is to give it a try.

Good luck!