Saturday, December 23, 2006

Spaghetti Code

One always guesses every one knows what a Spaghetti code is - a code which is hard to understand and maintain, a code which everyone is so scared to touch that bug fixes are always quick and dirty, and which makes code further spaghettier.

I wonder has anyone thought about spagetti products. It may not consist of Spaghetti code, but uses myriad of technologies, frameworks, and solves variety of domain problems that its very difficult to add a new component in it. Hence, it becomes difficult to adding a new component in a consistent way, due to lack of consistent architecture and implementation.

Given a product which uses a range of technologies and has evolved over period of time, the team responsible for adding a new component has a wide variety of technological choices to make. And sometimes, team pick the technology which they are comfortable with.

And, we have something, what I would like to call, a Spaghetti product.

Add to this, the changes in team over period of time, transitioning of product from one team to another team, outsourcing to partners, the product also runs the risk of developing spaghetti code. Over a period of time, it not only becomes difficult to maintain the product, but it also becomes equally difficult to enhance the product features or to add new components.

Such products are typically a good candidate for re-architecture and re-design.

Re-architecture and re-design do not guarantee that new product wont evolve to become spaghetti product over a period of time. It just adds a new life to the product.

It seems that every code ultimately becomes spaghetti code at some point, and every product becomes spaghetti product.

I also wonder whether Frameworks too will become spaghetti framework one day. Take Spring for example. It started as IoC container and light weight alternative to EJBs, but it has now lot of extensions such as Web Flow, Acegi security, and others which make it more spaghettier. Even though I am yet to read the whole of Spring 2.0 documentation, I sometimes feel that there is just too much being offered in one place, and probably its the pressure to keep adding value to the framework which forces teams to extend it release after release. Extensions may make sense in some cases, and in some cases it may be just an overkill and something which is added to level with competing frameworks.

Sometimes, the technological advancements also forces extension. For instance, addition of annotations in Java 5.0 has pretty much lead to a wave of augmenting XML based configuration with annotation based configuration.

Monday, December 18, 2006

Testing your java code

It cannot be said enough that testing is the most important part of the development cycle. Even though I am not a tester (and not trying to push an agenda), I have seen that well written code without adequate test cases is not really something that any developer or team should strive for.

And in the J2EE world, the best way you could possibly test code is by using Junits.

Junit is simple testing framework designed around two key design patterns: the Command pattern and the Composite pattern. They are simple to write and check their own results and provide immediate feedback and they are relatively inexpensive to write (oh yeah - they are free in terms of cost).

A TestCase is a command object. Any class that contains test methods should subclass the TestCase class. A TestCase can define any number of public testXXX() methods. When you want to check the expected and actual test results, you invoke a variation of the assert() method.

TestCase subclasses that contain multiple testXXX() methods can use the setUp() and tearDown() methods to initialize and release any common objects under test, referred to as the test fixture. Each test runs in the context of its own fixture, calling setUp() before and tearDown() after each test method to ensure there can be no side effects among test runs.

TestCase instances can be composed into TestSuite hierarchies that automatically invoke all the testXXX() methods defined in each TestCase instance. A TestSuite is a composite of other tests, either TestCase instances or other TestSuite instances. The composite behavior exhibited by the TestSuite allows you to assemble test suites of test suites of tests, to an arbitrary depth, and run all the tests automatically and uniformly to yield a single pass or fail status.

Here is an FAQ on Junits:

and here is an excellent introduction to Junits

Monday, May 29, 2006

Google Gapminder - Good Tool

This seems to be a very promising application. Any one tried to experiment with it.

Google Gapminder

With Gapminder, as Ionut writes, “you can visualize World Development Indicators from The World Bank. You will see a scatterplot where each bubble represents a country. The position of the bubble is determined by the indicators on the axes. The size of the bubble represents the population of the country.” [Thanks Justin Flavin and Ionut Alex. Chitu.]

[Original post | Comments]

Tuesday, May 23, 2006

Google Web 'kit

Google released a tool kit to create light weight web applications called Google Web Toolkit.
You can find it at

Basically the GWT takes Java code and does a 1:1 translation to JavaScript with a kind fo cross-compiler. It is optimized and shrank and all that good stuff. This is a pretty cool idea to start with, however, when you add in their mock browser development system, and their hooks into the native browser on Win and Lin (sorry Mac), you get to step through and debug your *Java* code before it gets atomagically turned into the JavaScript.

They include a JavaBean -> JavaScript serialization system, a completely runtime bound RPC system that calls back into a standard servlet, extended with your business method, The “JavaScript Native Interface”, which means basically you put additional direct JavaScript you want executed in a comment inside your “Will become JavaScript” classes and it gets inserted directly.

As one person said, this was the presentation that made the show. it is both a technical tour de force and an amazingly useful tool at the same time. I will try and come back and cover this a little more later, and also get my JavaOne Day One roundup posted.

Thursday, January 26, 2006

Macromedia FLEX and Java

I was just skimming through Macromedia Flex and I should admit, it"s very impressive.

It seems to be a pretty good way to create Rich Internet Applications (RIA). Since the flash player is already available in millions of computers, it is fast becoming a standard to deliver RIAs and it might even replace quicktime and other media applications. And Flex provides the perfect server side component for Macromedia to take advantage of all those computers with flash.

Macromedia Flex is a presentation server that developers are using to build a new generation of Rich Internet Applications (RIAs). Rich Internet Applications combine the usability of desktop applications with the administrative advantages of the web.

The Flex language capitalizes on the strengths of two popular development paradigms: markup languages and object-oriented programming languages.

Check out a HelloWorld.mxml (Classic Hello World example, this time in flex). You define the user interface declaratively using MXML and write the copy logic in ActionScript in the click event handler for the Button component.

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="">

<mx:TextInput id="source" width="100"/>
<mx:Button label="Copy" click="destination.text=source.text"/>
<mx:TextInput id="destination" width="100"/>


The first time a user requests HelloWorld.mxml, the server compiles the MXML code into Flash bytecode (a SWF file). The server then sends the generated SWF file to the client where it executes in Flash Player. Subsequent requests to the same MXML document bypass the compilation process

Now, where does this fit in with J2EE?

Flex is a presentation server installed on top of a J2EE application server or servlet container, a rich library of user interface components, an XML-based markup language used to declaratively lay out these components, and an object-oriented programming language which handles user interactions with the application. The result is a Rich Internet Application rendered using Flash Player and developed using industry standards and a development paradigm familiar to developers.

Developers use two core languages to create Flex applications. The first core language is MXML, the Macromedia Flex Markup Language, which includes a rich set of XML tags that allows developers to layout user interfaces. MXML can also be referred to as an XUL, or XML UI Language. These tags can be extended, unlike HTML, with additional capabilities that the application requires. Other MXML constructs allow you to call remote objects, store data returned in a model, and customize your own look and feel to MXML components.

The second core language for Flex development is ActionScript 2.0, which is an ECMA-compliant language similar to JavaScript. ActionScript elements are coded inside MXML pages. This is a strongly typed object-oriented language that should be familiar to Java developers. ActionScript also has robust event handling capabilities to allow the application to respond to dynamic user interactions. Because ActionScript runs inside the Flash plug-in, there is no need to rewrite several versions of the same code to support different browsers. This may not be the case with JavaScript code in a browser. Both MXML and ActionScript are text-based languages and can be written in a simple text editor, an IDE tool such as Eclipse, or a more sophisticated tool like the Flex Builder from Macromedia. If you have experience with Java, XML, and a scripting language such as JavaScript, you will experience a small learning curve to Flex development.

The Flex server is responsible for translating the MXML and ActionScript components into Flash bytecode in the form of .SWF files. This process is similar to compiling JSP files into servlets by a Java web application container. The SWF file is executed on the client in the Flash runtime environment. The Flex server provides other services such as caching, concurrency, and handling remote object requests.

For a great example check out which is all Flex based. Wow!

Talkbacks and comments always welcome.

Tuesday, January 24, 2006

You've got EPP - Yea you know me!!

EPP is a protocol that is used for various DNS registries talk to each other.

So, for example when you want to register a domain or transfer a domain from one provider to another, EPP provides an easy way to do this and to manage the work flows associated with these transactions.

EPP stands for Extensible Provisioning Protocol.

The EPP core protocol specificationprovides a complete description of EPP command and response structures. A thorough understanding of the base protocol specification is necessary to understand the mapping described in this document.

EPP is a connection-oriented, application layer client-server protocol for the provisioning and management of objects stored in a shared central repository. Specified in the schema notation of the Extensible Markup Language (XML), the protocol defines generic object management operations and an extensible framework that maps protocol operations to objects. A complete set of protocol specifications was recently published with the Internet Engineering Task Force (IETF) as Internet-Draft documents.

The EPP protocol suite currently contains a base protocol specification and mappings for three different objects: Internet domain names, Internet host names, and “contact” identifiers associated with humans and organizations.

Specifications for other objects may be developed as needs are identified.

EPP is connection oriented, but transport independent. A specification for transport using the Transmission Control Protocol (TCP) exists; specifications for transport using other protocols or applications frameworks may be produced in the future.
blank02A great matrix that outlines the details of various TLDs and their properties (Courtesy:

As you may know there are multiple Top Level Domains also known by it"s shorthand TLDs ( like .com, .net etc.). And there are also a bunch of Country Code TLDs (ccTLDs).

TLD Reg.
Transfer Additional

Registrant must have obtained a professional or academic qualification or hold a valid membership of an Institute or Trade Assocation.
EPP gTLD dedicated exclusively to the business community. The .BIZ domain can only be used for a "bona fide business or commercial use".

The country-coded Top Level Domain (ccTLD) for the country of Belize. Anyone in the world can register a .bz name.

Canada's ccTLD. There are additional contact attributes required for the Canadian ccTLD.

Auto or Fax Top level domain for the Cocos (Keeling) Islands. Anyone in the world can register a .cc domain for any purpose.
EPP China's ccTLD.

.COM Auto or Fax Short for .commercial. Domain names with the .com extension are by far the most popular, and can be purchased by any individual or business.


2nd Level Domain for Brazil.

.CN.COM 2nd Level Domain for China.

.DE.COM 2nd Level Domain for Germany.

.EU.COM 2nd Level Domain for Europe.

.HU.COM 2nd Level Domain for Hungary.

.NO.COM 2nd Level Domain for Norway.

.QC.COM 2nd Level Domain for Quebec.

.RU.COM 2nd Level Domain for the Russian Federation.

.SA.COM 2nd Level Domain for Saudi Arabia.

.SE.COM 2nd Level Domain for Sweden.

.UK.COM 2nd Level Domain for the United Kingdom.

.US.COM 2nd Level Domain for the United States.

.UY.COM 2nd Level Domain for Uruguay.

.ZA.COM 2nd Level Domain for South Africa.


Germany's ccTLD The administrative contact must have a street address or P.O. box within Germany. .DE names require a minimum of 2 name servers.


WHOIS changes must be made at the Registry.

EPP Top level domain for India. Anyone in the world can register a .in name.

EPP The first unrestricted top-level domain since .com, .info domains are available to the general public.



Japanese address requirements. Multilingual names will not be supported.


WHOIS changes must be made at the Registry.
Available to the general public, .name email addresses are listed as or, while Web sites are listed as

.NET Auto or Fax Short for .network, this domain extension was originally designed to be used by technical Web sites. However, domains using this extension can be registered by anyone.


2nd Level Domain for the United Kingdom.

.SE.NET 2nd Level Domain for Sweden.


The ccTLD for the country of Niue. There are no residency restrictions, these domains can be registered by anyone.
EPP Short for .organization. Originally designated for non-profit firms and any other organizations that did not fit under the .com or .net extension, any individual or business may now register a .org domain name.


Registrant must have obtained a professional or academic qualification or hold a valid membership of an Institute or Trade Assocation.

WHOIS changes must be made at the Registry.




Taiwan's ccTLD

EPP Note: You must meet all the .US Nexus registration requirements to register a name in the .US TLD.


Auto Currently, contact information modifications are not immediate. .UK names require a minimum of 2 name servers. Name servers changes/updates may take up to half an hour. A renewal cannot be issued until at least five (5) months prior to the domain's expiration date and effects of a renewal do not occur instantly.



WHOIS changes must be made at the Registry.

Thursday, January 19, 2006

Why do JDBC drivers always create problems

I'm not sure if the readers of this blog have seen this problem but I've always seen driver issues (especially JDBC drivers) when deploying applications. Why does every vendor have tens of jdbc driver versions and why does every database vendor create a bunch of drivers for every release out there.

This kind of incompatiblity between application servers, database vendors and third party API developers is causing serious productivity problems and is causing costs to jump through the roof for major J2EE implementation and most seriously causing a serious fragmentation of the market. This allows alternate frameworks (like Spring, Hibernate etc.) and competing technologies (like .NET etc.) to hit J2EE where it hurts!!

Talkbacks welcome.

Tuesday, January 17, 2006

How many of you are going to the AJAX Seminar?

AJAX seems to have a lot of momenutm going for it (at least it seems so or maybe there are a lot of people ready to exploit it to make a few bucks..only time shalt tell!)

But in any case, looks like we are already having the FIRST Ajax Seminar in NYC on March 13 and San Jose on April 24.

Here is a list of some of the speakers that are scheduled to speak at the seminar:

Jesse James GarrettFather of AJAX
Jesse James Garrett is the Director of User Experience Strategy and a founding partner of Adaptive Path, the world's premier user experience consulting company. He is author of The Elements of User Experience (New Riders), and is recognized as a pioneer in the field of information architecture. Jesse's clients include AT&T, Intel, Crayola, Hewlett-Packard, Motorola, and National Public Radio. Since starting in the Internet industry in 1995, Jesse has had a hands-on role in almost every aspect of Web development, from interface design and programming to content development and high-level strategy. Today, information architects around the world depend on the tools and concepts he has developed, including the widely acclaimed "Elements of User Experience" model. He is co-founder of the Information Architecture Institute, the only professional organization dedicated to information architecture. He is also a frequent speaker and writer whose work has appeared in numerous publications, including New Architect, Digital Web, and Boxes and Arrows.

Scott DietzenOne of the Fathers of WebLogic and J2EEPh.D.,

President and CTO, Zimbra Prior to Zimbra, Scott was CTO of BEA Systems where he was the principal architect of the technology strategy for the WebLogic, which drove the company from $61 million in revenue for the year prior to WebLogic's acquisition to over $1 billion. He was also one of BEA's top spokespersons. He is widely credited with helping put together the J2EE standard, launching the Web application server category, launching the Java Community Process, and driving the web services collaboration with Microsoft and IBM. Prior to WebLogic, Scott was Principal Technologist for Transarc (acquired by IBM), a developer of distributed transaction and information sharing systems. In addition to working on Internet infrastructure since 1991, Scott has managed teams focused on sales, marketing, product management, and standards. He earned his Ph.D. and M.S. in Computer Science and B.S. in Applied Mathematics and Computer Science from Carnegie Mellon University.

Bill Scott AJAX Evangelist of Yahoo!: Bill Scott, one of the top AJAX experts in the country, is an Interaction Designer and Ajax Evangelist at Yahoo! He is part of the newly formed Design and Practices Team working with teams throughout Yahoo! to create a rich experience on the web. Before joining Yahoo! Bill founded the User Experience Team at Sabre Airline Solutions, part of Sabre Holdings. During that stint he also co-founded Rico, an open source JavaScript framework for creating Ajax & DHTML web applications. Over the past 20 years Bill has been involved in designing and creating user interfaces for video games, military war games, 3d graphics, oil and gas research, software development environments, supply chain planning, and various other scientific and business domains. He posts his musings about user experience on his blog.

David Heinemeier HanssonCreator of Ruby on Rails
US-based since November, David Heinemeier Hansson is the development lead of Rails, also known as Ruby on Rails, which the official Ruby on Rails website irreverently describes as "a full-stack, open-source web framework in Ruby for writing real-world applications with joy and less code than most frameworks spend doing XML sit-ups." He has had help from a lot of contributors. David is the creator of applications like Instiki, Basecamp, and Ta-da, and has now joined the Chicago-based team of, a privately-held company founded in 1999 and committed to building the best web-based software products possible with the least number of features necessary. David will give his first presentation on “AJAX in Rails” at the “Real-World AJAX” one-day seminar.

There are plenty of other speakers as well and the list looks impressive.

The cost varies from about $1000 to about $1300 (a bit expensive considering it's only for 1 day)

Monday, January 16, 2006

AJAX - Hype or Real?

What is AJAX.

AJAX is nothing more than a nice acronym for Asynchronous JavaScript And XML.

AJAX is a web development technique for creating interactive web applications using a combination of:

• XHTML, HTML and CSS for marking up and styling information.
• The DOM (Document Object Model) manipulated through JavaScript to dynamically display and interact with the information presented
• The XMLHttpRequest object to exchange data asynchronously with the web server.
• And finally XML for transfering data, although any format will work, including preformatted HTML, plain text.

Ajax's prime advantage over other Rich Internet Application technologies is seamless integration with HTML so it can be used incrementally without the need to change existing Web content.

However, the AJAX technology is still immature, and tools and frameworks have not gained a lot of traction yet. It involves a lot of work with toolkits and libraries.

Rich Internet Applications are those applications that offer functionality beyond standard HTML frames and hyperlinks. A well-noted example of Ajax functionality is Google Maps.

While Ajax is a recently coined termed, it has been around since the introduction of JavaScript. It is based on JavaScript/ECMAScript, Cascading Style Sheets, Document Object Model and XML HTTP Request. Initially, it was difficult to design Ajax-style applications that ran across different browsers but now the mainstream browsers have migrated to support the Microsoft implementation of these technologies as a lowest common denominator.

The dominant RIA technology in use today is Macromedia Flash/Flex. Other RIA technologies include the user interface markup language for the Microsoft Windows Presentation Foundation called XAML (Extensible Application Markup Language), Mozilla's XML-based user interface language XUL, droplets and Java applets, and Microsoft's upcoming Windows Presentation Foundation/Everywhere (WPF/E).
Microsoft is planning to roll out an Ajax framework extension, code-named Atlas, which looks very promising.

One of the big problems with AJAX used to be that there was not too much support for it in industry standard IDEs. Over the recent months, slowly but effectively other integrated development environments (IDEs) are being made available for Ajax although many are not yet mainstream. These include Javascript Synthsis Technology (JST) from Morfik Technology, IntelliJ IDEA 5.0 from JetBrains, Tibco General Interface (GI) from Tibco Software, Visual GUI Builder from JackBe, Backbase from Backbase B.V. and the open source Ruby on Rails framework.
The Tibco tool for writing Ajax applications looks quite good.

In addition to IDEs or framework extensions, there are also Ajax UI tools and remoting tools available -- more than four dozen in all, including both proprietary and open source offerings.

According to a recent Burton Group survey of 488 Ajax developers, the most popular tool kits, libraries and framework extensions are Prototype, a JavaScript framework with an MIT-style license;, a JavaScript library with an MIT-style license; Direct Web Remoting, which has an Apache 2.0 license; the Dojo UI tool kit with Academic Free License v 2.1; and Ruby on Rails.

To date, much of the Ajax attention has been focused on business-to consumer Web sites, but Ajax does have some synergy with Web services and SOA, and it could impact enterprise portals.

Some people believe Ajax will be a major comeback factor in portal solutions. Portals came out with a lot of hype, but in reality they're not a quite a silver bullet. But the ability to combine Ajax presentation with portal functionally will enhance the corporate user experience.
One of the problems with Ajax is that it can be easily abused. If developers don't understand usability theory, they will apply it in a way that will be a nuisance and people will turn off JavaScript.
The analogy I use is the browser popup window, which was originally a usability feature, but it was so abused it became a pariah of the Web and people disabled them.
So as of now, there is no clear data whether AJAX is just hype or a reality that will make its way into enterprises.

My personal suggestion is to wait and watch to see how the industry embraces AJAX but in the meantime, do prepare yourself with at least the basics of AJAX so when enterprises are ready to embrace AJAX, you already are!!

Here are some nice links for you to get started:

Talkbacks and comments are always welcome.

So what's up with Geronimo?

What is Geronimo?

Another open source application server? Haven’t we already had enough of open source application sources - JBoss, JonAs, going back all the way to Tomcat? (Agreed Tomcat has always been more of a web container than a J2EE container).

But seriously, Geronimo, is the new application server built by Apache (widely considered as the best and most superior open source groups out there) and they built the Apache web server that is still running the majority of internet. So coming from Apache, a J2EE container is a big deal.

According to the official Geronimo website:

The Geronimo project is an open source application server developed by the Apache Software Foundation and distributed under the Apache license.

Geronimo is currently compatible with the Java 2 Enterprise Edition (J2EE) 1.4 specification. When compared to other application servers such as JBoss, WebLogic and Websphere, Geronimo's most distinctive features are its:

  • BSD-style license, which allows it to be modified for and embedded within commercial, closed source software (unlike the popular GPL and LGPL licenses)
  • Modular GBean-based architecture, which allows users to remove unneeded services and build very lightweight configurations of the server
  • Non-Profit ASF leadership, which provides legal protection, ensures stability across the loss of individual contributors and insulates the project from commercial conflicts of interest
  • Diverse support community, in which companies compete freely and openly to provide services, with none enjoying any particular trademark advantage

What makes Geronimo so special as compared to other Application Servers (other than the Apache name?)

  • Here is what I think the main points about Geronimo are:
  • Complete J2EE 1.4 Application Server
  • Built on best of breed components (Tomcat/Jetty, OpenEJB, HOWL, etc.)
  • Modular architecture (server core plus services grouped into “configurations”)
  • Open community & open license
  • Fast JMS server included
  • An excellent Web-based management console included

Having said that, I must say, in my trials I noticed that Geronimo is not yet industry, productions standards but that may be just a temporary phenomenon. The application server has a lot of promise and even though BEA, IBM and other commercial vendors are a bit worried, Geronimo could turn out to be the greatest threat to another application server – JBoss.

After all, who would buy a “commercial” open source application server like JBoss when a completely free and superior version like Apache Geronimo is available?

It only remains to be seen.

Talkbacks and comments always welcome!

Saturday, January 14, 2006

How to get a good J2EE job

Some thoughts on what a good J2EE developer should know. I am not saying I know all this well but it's good to see what the standards are

What does a good J2EE developer have to know in addition to understanding

the difference between abstract classes and interfaces?

Usually employers are looking for people with at least 10 of the following skills:
  • Java Servlets
  • JSP
  • Struts or a similar framework
  • EJB
  • JMS Any commercial message-oriented middleware
  • JDBC
  • JNDI
  • HTML
  • XML
  • Ant
  • SQL
  • One of the major application servers(Websphere/Weblogic/JBoss)
  • Couple of relational database management (Oracle/MySQL/DB2) systems
  • Any UML modeling tool, several design patterns (at least a Singleton!)
  • Familiarity with Unix. Next year JavaServer Faces and Hibernate will most likely be included in this laundry list.
Understanding why a particular J2EE component is being used in your project is equally important. If the interviewer asks you, “Why did you use EJB in this project?”, have your own opinion and explain why you think it was a good or bad choice for this particular project.

Good knowledge of the business terminology of your potential employer is also important. I’m not sure about the Silicon Valley or Europe, but here in New York just being a techie may not be good enough to get a senior job.

For example, if you’re applying for a Java position in a financial brokerage company and don’t know what a short sale is, this may be a showstopper. If you are a senior developer, you should
be able to hit the ground running.
Try to find out from your recruiter as many details as possible about the business of your potential employer, do your homework, and you’ll get the job!