Wednesday, February 18, 2009

Driving a Ferrari and getting Screwy with Groovy!!!

For the last few days, I have been trying to clean up and write new functionality for an existing e-commerce web site which has been written in Groovy on Grails. When I first played with Groovy on Grails, I was amazed at the simplicity at how straight forward web application are amazed. It like getting into a Ferrari, starting the ignition, release the hand brake, hit the gas pedal and let it fly. As you are driving the Ferrari, you realize that you don't know how to turn the Ferrari at 120 mph or do a donut in the snow in it. You then slow down the car and slowly get to know the car. You appreciate the contours of the car, the neat blue tooth capability and the simple ease on how the car handles. As you are appreciating and getting to know the Ferrari, you realize that you are loosing time and wonder if it is really worth it. In the end, mastering on how to drive the Ferrari is your greatest asset as far as going to new destinations.
You must be wondering how is Groovy on Grails and an expensive Ferrari are connected. The answer is that they are connected. To fully appreciate the neat features of Groovy on Grails, you have to sit with the language and get to know it over via your handy dandy IDE. Groovy on Grails may sound wonderful in the beginning however you realize that it is not that easy when you want to build custom functionality. I struggled with building form validation for fields which appear on web form but the data in these fields is not reflected in the database. Groovy on Grails may be a great language however it is like the dark ages in terms of documentation.
Anyway I figured all of my issues for this release and I also found a bug in the Groovy on Grails and a quick work around:
  1. I have a UserAccount class which looks like this:


    class UserAccount implemments Serializable {

    String username
    String firstName
    Address address = new Address()

    static def constraints = {

    }
    }
  2. I have a Address class which looks like this:


    class Address implements Serializable {
    static belongs =[user:UserAccount]

    String streetAddress
    String city

    static def constraints = {

    }

    }
  3. I have a gsp file



I noticed that the textboxes for streetAddress and city didn't highlight in red when the textboxes had invalid data. To get around this issue, I wrote a simple JavaScript function which manually highlighted the textbox if the error message for the textbox is generated. This how ever didn't work (this is the bug). Here is what I had for highlighting the city textbox:
${hasErrors(bean: person?.address, field: 'city', 'errors')}'

This didn't work on its own and the Javascript didn't work. After spending some time with this bug, here is how I resolved:
${hasErrors(bean: person, field: 'city', 'errors')}'
This made the JavaScript to work properly. Hope it helps

Saturday, January 31, 2009

Can SOA be achieved in an enterprise

For the last year or so, I have been working for the Federal Aviation Administration (FAA) as a Services Oriented Architecture (SOA) Subject Matter Expert (SME). It has been a challenge to see how various folks view SOA the panacea for IT related systems or enterprises. Each stakeholder within an organization has different definition with respect to SOA. So far I have noticed the following at the FAA, we have:
  1. Data Services - Services that carry data
  2. Business Services - Services that meet a business need
  3. ITIL Services - Services which meet Help Desk and Operations centric services
  4. Business Process Services - Services which emulate business processes and they use standards like BPEL and BPMN
  5. Web Services - Information is exchanged over the HTTP protocol in XML or as attachments which are in SOAP container
  6. Java Services - Java enabled services
  7. RESTful Services - Information is exchanged over the HTTP protocol in XML but the information is not in a SOAP container.
  8. Orchesterated Services - Services which are made of services
  9. etc., etc
As you can see, Services can be confusing. To add to the confusion, we have other tools and methodologies which make SOA a zoo. We also have people who view SOA serving different purposes. In the end, they are all true since they are identifying components which can be or may be true in an enterprise. Here is my take on SOA. SOA should be viewed from a Enterprise Architecture (EA). EA identifies (if it is done right) the "As-Is" state of the IT enterprise and proposes the "To-Be" state of the IT enterprise.

EA should also have a strategy on how to achieve "To-Be" state in a timeframe. This is usually articulated in various EA artifacts like Roadmaps, line of sight documents, strategy documents and an EA repository. Other components that need to implemented to give a true EA picture is to have an enforced System Development Lifecycle (SDLC), Change Control Board (CCB), and Configuration/Change Management (CM). The other thing is that to have a working EA, all of the stakeholders must buy into it. I am a big fan of The Open Group Architecture Framework (TOGAF).

Back to SOA now, if EA recommends that SOA is one of the possible approaches to meet "To-Be" state then it needs to bought by all stakeholders in the enterprise. The following steps need to be done when an enterprise wants to use SOA to achieve its goals:
  1. Define a Service Data Dictionary - This will reduce the confusions when talking about services.
  2. See if the EA strategies identify any systems which need to be consolidated or broken-up.
  3. If so then use SOA in system(s) migration
  4. If all new systems are built in a SOA fashion then address SOA governance
  5. Address SOA governance by designing and implementing processes and groups which deal with SOA governance.
  6. All new SOA services should be projectized
  7. All new SOA services should have a Mission and Vision statement
  8. and on, on
In the end, will SOA ever be truly achieved in the FAA. The answer is "No"! However pursuing SOA will help FAA identify gaps in its enterprise with respect to its EA since it forces various stakeholders to communicate together and address how some of the internal processes should be achieved. This is a big key for any successful IT enterprise. Adopting SOA will not provide a successful EA without having a working SDLC and appropriate mechanisms which provide accountability.

Wednesday, November 26, 2008

EA is doomed to fail!

Enterprise Architecture(EA) in any organization is bound to fail because it doesn't do a good job of capturing the true state of an enterprise. When people talk about EA then they talk about systems, applications, and assets within the enterprise however organization structure, an understanding of the business itself and its processes are not captured properly.

Anyway that is a quick rant!!!

Sunday, October 26, 2008

It's cool like that!

For the last few days, I have been playing with Ruby and Groovy. I have to say it very exciting to play with these technologies. Like typical Java applications once you figure out how to configure the application, the development of these applications is very straightforward. I don't have have worry about compiling the files, generating a Web Application Archive (WAR), and deploying the WAR file on the servlet container. Ruby and Groovy for most part take care of this issue. From a software architecture perspective, these two technologies promote software best practices by having built in capabilities to design pattern.

The core philosophy is that it saves time by simply customizing a baselined web application rather than build each class, jsp and configuration file. I was amazed when I built a simple prototype in Ruby and Groovy. It is also takes less time to learn the technology because folks learn alot more when they plan with the code rather than reading a O'reilly book or a Recipe book. It's exciting!

The downsize is that it takes alot more time to understand how the code actually works since the inner working have been abstracted out. I also notice that I would use a standardized approach in naming methods, pages, and classes.

To increase my learning, I have been doing Groovy on JetBrains IntelliJ. It's great and it's better than eclipse. Enjoy!

Sunday, October 5, 2008

XML Driven Software Architecture

As technologies are evolving from a procedural to object oriented and architectural principals as loose coupled and flexible software is ideal, developers are constantly thinking or taught to think that abstraction is good and brittle code is bad. This idea has also evolved in Information Technology (IT) enterprises where the notion of a service has caught. Since IT enterprises involve more than hard-core java drinking code junkies, services have evolved into business services where services abstract business processes from their supporting IT systems. As Business Processes are changing with respec... WAIT!!! This is a Technie blog entry so lets stay in the realm of software, hardware and whatever makes a java drinking, red-bull drinking, dry cereal snacking technie happy.

As software architects and developers are praising the likes of Gavin King, who developed the Object Relational Mapping (ORM) technology Hibernate, since they developed technology which abstracts developers from knowing how the data is stored in a relational database. ORM technologies allow programmers think in objects rather than normalized relational tables with primary and foreign keys. The wide argument is that programmers won't get bogged down by writing sql queries but they can simply think of their code as objects. The problem with this notion is that sometimes ORM queries can be poorly written.

As I was pondering this issue today, I realized that ORM still couples the software code like Java to the structure of the database. From my experience, when new tables or fields were created in the database, the ORM code has to be modified and this in turn may affect the actual business logic code. This could get painful when new requirements or the Database Administrator (DBA) has provided a new design to optimize the database.

One way to get around this issue to design the business datamodel as a XML Schemas (XSD). After working with XSDs, I believe they do a great job of capturing the object model. After creating the XSD, generate XMLBeans or JAXB classes and code to these classes. The JDBC code or ORM code can be then communicate to the business logic tier via the XML binding classes. This way the XML binding classes provide a layer of abstraction between the data tier and the business logic tier. The problem with this approach is that XSD can be hairy however if you understand XML and XML technologies than this may be the way to go. The other issue is that there could be issues in the generate classes or how you created the XSD. Once again if you are comfortable with XML then may be a way to go since I think it could be better than ORM.

Please let me know if you disagree with me.

Wednesday, October 1, 2008

Practical Benefits of Architectural Views and Models

I have been assigned to lead a Services Oriented Architecture (SOA) prototype effort for the organization I work for. Since this project involves building a SOA solution with canned data sources (the easy part) and then formulating best practices in SOA governance (the hard part), I have begun to appreciate the skillset of an architect. IT Architecture helps folks, who are in the architect role, to create artifacts which can communicate the core IT system architecture, process architecture, data architecture, etc., etc, to various audience groups. Creating conceptual models and logical models provides a great mechanism to communicate complex or abstract ideas in a straight forward manner. IT Architecture doesn't simply involve drawing pretty pictures in Visio and show-off your Visio skills but it is more than that. It is the ability to take a system design, complex design and simplifying it to a diagram which conveys the necessary details to its appropriate audience. Being an architecture enables you to improve your communication skills, able to adapt and communicate to various audience in appropriate terms in appropriate detail. It is important to know that even when you are simplifying a concept for a technically novice audience, you cannot compromise the underlying physical architecture of a system. The architect has to know the whole design but then he is astute enough to decipher what is needed and what is not needed when the design is communicated to the appropriate audience. Anyway today I can say that I managed to convince key stakeholders in the project on how the system should be designed. This was a big accomplishment in the project. For any aspiring architects, you will miss developing code, you will miss updating your spend plan but in the end you will be responsible for marketing the system, improving the system and most importanly, communicating the system to the appropriate audience.

Saturday, September 27, 2008

Oracle Open World 2008

Last week, I was in San Francisco, California attending Oracle Open World 2008. It was an event organized by Oracle to show case their latest suite of Information Technology tools. The Oracle tool set ranged from existing open source technologies with new functionality to the umber fast Relational Database Management System (RDBMS) called Exadata. The EXADATA is a Hewlett Packard (HP) and Oracle product which couples Oracle's RDBMS to some heavy duty hardware from HP. The sessions I attended and which I enjoyed were around the topic of Services Oriented Architecture (SOA) governance. Here are some cool things I saw:

  • Using SQL Developer, you can migrate any major database to Oracle.

  • RDFS/OWL Semantic Database - Cool stuff and we are getting closer to WEb 3.0

  • Oracle Times-Ten - An in-memory database. It is used for caching and it can be accessed via SQL/PL SQL

  • Oracle Coherence - Used in caching in a grid architectured system. It can interact with various Java Virtual Machines (JVM). This is cool stuff.

No question Oracle has acquired or created some new tools however it is to be seen how they maintain these products. Overall I give Kudos to Oracle for setting up this event. It was a successful event!