Learning Center
Plans & pricing Sign in
Sign Out

Process of Architecting - Palash Ghosh


									                       Processes for Architecting - A White Paper

                                              By Palash Ghosh


This paper defines the process of architecting       Challenges in today’s business scenario –
and brings out the best practices for architecting
a Java/J2EE solution with a real FileNet-based       •   Business logic is getting very complex and
project example.                                         agile in nature
It dwells deep into the concepts of layered and      •   Integration points with different businesses
component-based architecture and provides                running on different technology platforms
detailed explanations, guidelines and benefits       •   Scalability and maintainability
associated with creating enterprise architecture.    •   Security Issues
                                                     •   Performance

                                                     To address these challenges, organizations
The popular consensus is that a good architect       today need to build reliable, robust, agile
does not necessarily have to be a good               solutions that incorporate a scalable and
programmer. But I do not agree with this. I          extensible architecture.
believe that one has to go through the process       In order to successfully architect Java/J2EE
of getting her/his hands dirty and work on the       solutions, an architect needs to have a thorough
nitty gritties of programming and other              understanding of the following:
development related activities before s(he) will
have gained enough knowledge and experience          •   Methodology (RUP etc)
to conceptualize and create an enterprise-level      •   UML
architecture that is innovative and practical.       •   Best Practices (Java/J2EE Design Pattern)
                                                     •   Technology (Java/2EE)
Today’s business situation is information driven,
with technology being one of the key business        There are different architectural views (Process
enabler and in some cases, a business driver.        View, Logical View etc) through which an
The whole world is talking about enterprise          architecture can be represented. I believe that
solutions and enterprise applications.               the logical view and the physical (deployment)
                                                     views are the most important architectural
What is an enterprise solution?                      representations.

We could define an enterprise solution as a          4 + 1 Architecture View Model
technology solution that enables organization-       The 4 + 1 View Model describes software
wide problems to be addressed seamlessly by          architecture using five concurrent views, each of
technology. In the past, technology solutions        which addresses a specific set of concerns:
usage was very departmentalized with different
departments in an organization following             •   The logical view, which is the object model
different technology philosophies and strategies.        of the design (when an object-oriented
As technology advanced and grew sophisticated            design methodology is used)
enough      to   accommodate      and    address
enterprise-wide problems, the decentralized ,        •   The process view, which captures the
departmental approach followed by companies              concurrency and synchronization aspects of
led to various problems that affected the very           the design
efficiency and productivity of companies, putting
pressure on them to sustain themselves in a          •   The physical view, which describes the
competitive, ever-changing market.                       mapping(s) of the software onto the
                                                         hardware and reflects its distributed aspect
•   The implementation view, which describes          general     belief   is   that   most      packaged
    the static organization of the software in its    solutions/products contain multiple out-of-the-
    development environment                           box features and therefore there is no need for
                                                      these products be fit into a design framework
The description of the architecture and the           while they are deployed to address enterprise-
decisions made can be organized around these          wide needs. The fact is that, thought these
four views, and then illustrated by a few             products have a lot of out-of-the-box features,
selected use cases, or scenarios, which becomes       there still is a great amount of customization
the fifth view.                                       that is required in order to build a solution that
                                                      addresses     a    customer’s     specific   needs.
In cricket there is a strategy - ‘Play session by     Therefore, these products need to fit into an
session’ so that you can change the pace of the       enterprise architecture, in order to perform
game accordingly. The same analogy can be             effectively. This is where technology comes into
used in software architecting for a given             the picture. In most customized solutions built
requirement - do not think about the solution as      on top of Document Management/Workflow
one big whole; rather, start thinking about the       products, the product is primarily used as a
different building blocks/components of the           document repository and to some extent helps
solution and think about how the different            in automating business processes with the help
components can communicate with each other.           of the API that comes with these products used
This building-block approach will lead to a           But to build a holistic solution that addresses all
reliable logical view of the architecture.            the customer needs and provides a wide range
                                                      of functionalities, while taking into account
Today’s     business   needs      demands       an    integration, administration and security needs,
architecture that is scalable, maintainable,          the product based solution has to be customized
component based and layered and on top of             to a greater extent. For this to happen, an
that it should be enough flexible to adapt any        architectural framework has to be created that
change. So, while embarking on a software             will accommodate the product as well as
architecture journey, a big picture approach          address solution functionalities that the product
should be taken and the key elements of the           does not address.
design should be of primary importance. Paying
too much attention to minute details and issues
right at the beginning will not have the desired
results. The design process will rationalize itself
and the final architecture will address all the

In a product development scenario, the
mindset and the approach is very different to
an IT services model that where there is never
enough time to perform all design activities
that a typical product development
exercise would require.
In most IT services situations, there is a need to
deliver a quality product in a very short period
of time and that is the biggest challenge. This is
where framework development comes into the
picture to sufficiently address the cost and time

I would like to take an example of a Document
Management/Workflow product based solution
that was developed for a global insurance
customer. The product used was FileNet. The
Let me share my experience as a technical          architecture for two sets of API exposed by
architect, building a customized solution for a    FileNET.
global insurance customer. The solution was        This adapter layer exposes its high level
primarily   a    document   management       and   interfaces only, so that at a later time, if
workflow solution.                                 changes in the API take place in the
                                                   implementation classes, the other components
The logical view of the architecture is given      where the methods of the interfaces are used
below                                              do not need to undergo any change.

FileNet’s eProcess workflow product, along with    Benefits of this approach are:
Image Services Resource Adapter (ISRA) was         • The Adapter layer encapsulates and provides
used as the basis of this solution. eProcess has      a business level interface of Workflow APIs
two sets of Java API – one is for accessing the       to the core services in the Business Services
documents in the repository and the other for         layer.
mainly managing the workflows. From a              • The set of APIs provided by workflow would
Java/J2EE application there was a need to             be accessed sitting in this layer to make the
access third-party API that may undergo               application easily maintainable.
changes and modifications in course of time. So,
it was decided to introduce two adapters in the
The     horizontal    layer    includes   all    the   The framework will support Resource Bundle for
infrastructure related components, which are           persisting the error messages, i18n java
used across the whole spectrum of the solution.        internationalization features are being used to
Next let us look into infrastructure components.       store and retrieve the error messages based on
Any Java/J2EE solution must have very good             an end-user profile.
logging as well as a very robust exception             There is a Base Exception Class for the whole
handling strategy, which needs to be i18n              application. And each layer has its own
enabled      (internationalization).    A     robust   exception, which extends from Base Exception.
mechanism has to be built in which helps to            The corresponding exception would be thrown
pass the proper exception across the different         from the related layer and would be caught in
layers and display a customized error message          the next layer of the hierarchy.
to the user, which has to be i18n enabled too.
                                                       Now, lets talk about the Logger. The Logger is
This exception handling strategy provides a
                                                       a subsystem that represents an enterprise
base mechanism and guideline for handling
                                                       logging mechanism for distributed applications.
exceptions arising out of business conditions,
                                                       This component will expose methods which will
and errors arising out of non-business and
                                                       help the system to log the messages in text file
system-specific erroneous conditions.
                                                       depending on their available severity level as
                                                       info, warn, debug, error. With Apache log4j it is
The component will provide the following
                                                       possible to enable logging at runtime without
                                                       modifying the application binary. The log4j
• Implement exception and error handling
                                                       package is designed so that these statements
• Support for internationalization
                                                       can remain in shipped code without incurring a
• Log exception messages depending on the
                                                       heavy performance cost. Editing a configuration
    exception severity
                                                       file, without touching the application binary, can
• Decide whether an error message should be
                                                       control logging behavior. A wrapper over Log4j
    shown to the user, or to log an exception
                                                       (an Apache open source framework already
                                                       available) was built for Logger, which is a
• Framework to support storing the error
                                                       standard practice.
    messages in property files
• Framework to support handling of the return
    codes                                              The     requirements      also  demanded     an
                                                       integration layer to integrate with an Oracle
An Exception can be classified by logging              database and MQ Series. For the database
severity level. The framework supports the             integration DAO and DAO Factory were used,
following severity levels:                             which is a very standard approach, suggested
• Debug                                                by J2EE pattern. By using these patterns, the
• Info                                                 database/SQL related code will reside in the
• Warn                                                 same place, which will help maintain the code
• Error                                                and more importantly, the database can be
                                                       ported from Oracle to SQL Server or DB2
                                                       without much difficulty and without having to
The Framework provides a loose coupling of             modify application logic.
error messages. Every error or exception is            There is a need in layered architecture to
referred by a unique identifier know as errorID.       transfer data across the layer in terms of Data
Only errorID shall be used in the application          Transfer Object. Care needs to be taken to
code base. For each errorID, there exists a            determine when the data can be changed and
corresponding error message, which is displayed        when it needs to be immutable. This is a very
to the end-user. Since the error messages need         crucial decision that needs to be made during
to be shown in the language according the end          the time of design.
user’s preference or profile, they are maintained
in each language variant.                              • This layer consists of the Value Objects,
                                                          which are java beans that are used as
                                                          transport media while the system is required
   to communicate with different layers                  performed by servlet class
• The Value Object holds the data                    •   This layer takes help of java beans to
• This layer is the Model part of            MVC         transport the data to the immediate next
   (Model/View/Controller) pattern                       layer, which is the Business Delegate layer
                                                     •   Controller servlet classes would be packaged
In most cases, the presentation layer is the             based on the module
least thought about and most neglected area          •   This layer is the Controller part of MVC
when architecture is being conceptualized.               (Model/View/Controller) pattern
Common practice is to write some JSP pages
and to fit these with the Controller servlet. More
attention on the design of the presentation layer    Struts Validator Framework has been used
will make it simple, reusable and maintainable.      to avoid too much java script code from the
Special attention must be paid to JSP pages,         application with using its configurable xml file.
their navigation and validations. There is a
tendency to write Java code in JSP too. Here,        Benefits of Struts Validator Framework
Struts plays a very crucial role by proving its
                                                     •   The Struts Validator framework allows
own framework. If developers are disciplined in
                                                         moving all the validation logic completely in
writing JSP code, they will be able to create
                                                         a centralized place and declaratively
clean JSP pages with Struts tags as well as
                                                         configuring it for an application through
custom tags.
                                                         external xml file.
                                                     •   The other great benefit of the validator is
Presentation     layer    has    the  following
                                                         that it’s extensible. It provides many
                                                         standard validation routines out of the box,
• It is developed using JSP (Java Server Page)
                                                         but if additional validation rules are
• Struts Tag and Taglib Directive should be
                                                         required, the framework is easy to extend
   used to minimize the scriplet code in JSP
                                                         and provides the ability to plug in custom
   and for enabling i18n
                                                         rules    (again    without   modifying    the
• The functions performed by this layer need
   to take care of presentation of the data to
   the user based on the user request
• This     layer    would   communicate    with      Today’s most enterprise applications that
   controllers to put forward the user request       support global businesses and processes,
   to the service                                    demand      Internationalization   (i18n).    An
• This layer will also take care of the              application    should    have    the   following
   presentation (front end) level validation.        characteristics to support i18n
   Primarily    Struts   configurable Validator      •   Additional languages need to be supported
   Component and Java Script (.js) would be              without requiring code changes
   used for validation                               •   Text elements, messages and images need
• The Presentation layer is the view part of             to be stored externally from the source code
   MVC (Model/View/Controller) pattern               •   Culturally dependent data such as date and
• The Presentation layer takes the help of Java          time, decimal values and currency need to
   Beans to display and transport the data to            be formatted correctly for the users’
   the Controller                                        language and geographic location
                                                     •   Nonstandard charactersets need to be
With the help of the Controller, which is part of        supported
the Struts Action Class, the task of delegation is   •   The application should be able to adapt to
streamlined.                                             new languages and/or regions

Some key benefits of the Controller are:
• This layer is developed using Servlets (based      The internationalization support provided by the
   on Struts Action Class), which will delegate      struts framework focuses almost exclusively on
   the request from presentation layer to the        the presentation of text and images for the
   service layer depending on the action             application. The functionality such as accepting
input from nontraditional languages       is   not   The framework does not in itself encompass
covered within the Struts framework.                 implementation of an authentication and
                                                     authorization service. The essence of the
                                                     framework is to provide a bridge between the
Custom Taglib facilitates reuse of some JSP
                                                     application and enterprise security provider.
Components, which helps reduce development
                                                     Framework uses adapter for delegating the
time considerably.
                                                     request to underlying security provider. It takes
                                                     the help of LDAP Adapter. The client API does
Business Delegate Layer                              not change with the adapter. The usage remains
There is debate whether an application really        the same always. However, configuration might
requires Business Delegate Dynamic Proxy as it       change based on the adapter used.
uses the java reflection API that degrades the
performance and it will be part of the request       The Business layer takes care of the core
path. Basically, a dynamic proxy is an object        business logic for the application. The Business
created at runtime using reflection, which           layer would contain a set of high-level services,
implements one or more interfaces. The               which would be executed depending on the
advantage is that use of Business Delegate           client request. The Business layer will
reduces coupling between presentation-tier           communicate with the Integration layer. This
clients and business services.                       layer is further subdivided into sub-systems
                                                     depending on their functionalities.

Session Façade Layer                                 Configuration      Manager      is   a    generic
The FileNet application that was introduced          framework, which supports XML- based
earlier uses stateless session beans as the          configuration needs of application components.
customer plans to expose the application             Configuration is a java object representation of
services as Web Services in the next phase of        the configuration information. The infrastructure
development. Besides this, the Session               and other components using application shall
Facade defines a higher-level business               use     these   configurators      for    reading
component that contains and centralizes              configuration information, which is stored in
complex     interactions   between    lower-level    XML files. It has its own life-cycle methods
business components. A Session Facade is             which help the component to startup, initialize
implemented as a session enterprise bean. It         and to shutdown the service. The Configuration
provides a single interface for the functionality    Manager is responsible for
of an application or application subset. It also     • Reading and traversing of XML files.
decouples lower-level business components            • Un-marshalling of XML information to the
from one another, making designs more flexible           corresponding Configuration objects.
and    comprehensible.     Fine-grained    access
through remote interfaces is inadvisable             The solution has a general-purpose cache
because it increases network traffic and latency.    component for frequently used static data.
The multiple fine-grained calls create a great       Caching    facility   should    be   dynamically
deal of network traffic, and performance suffers     configurable in terms of its size and refresh
because of the high latency of the remote calls.     time.
                                                     At any point of time, cached objects should be
                                                     available with multiple simultaneous requests.
Security layer facilitates Authentication and
Authorization services. Authorization is needed
to get access to the specific service assigned to    The following inputs to the Cache Manager
specific set of users/group. Security component      component need to be configurable:
is designed to secure web server and application
                                                     •   The refresh time of the cache
server resources such as JSPs, servlets, beans
                                                     •   The size of the cache
etc. This component controls the access to the
web resources and application server resources
                                                     JTA (Java Transaction API) was introduced to
by authenticating and authorizing the requests.
                                                     handle the transaction.
                                                    Types of messages
                                                    Outgoing Messages:
MQ Integration Approaches                           • Monitors a process queue (via the Process
 The application has a centralized queue where         Engine API) for incoming work items
any message generated after a database              • Retrieves each of the work items and
transaction is stored in the form of an object. A      converts the work item to XML
Message Driven Bean is constantly running to        • Posts the XML from the step element to an
listen and process the messages and put them           associated WebSphere MQ message queue
into different queues depending on the
subscriber of the message. Each queue will have     Incoming Messages:
different broker depending on the system need       • Monitors an associated WebSphere MQ
to be integrated, which will process the               message queue for incoming XML messages
message further.                                    • Retrieves each incoming XML message and
                                                       validates it against a given schema for
                                                       incoming process requests
                                                    • Formulates and executes the process
Custom Adapter                                         request (via the Process Engine API) based
                                                       on the details within the message
A custom adapter is a custom piece of code
leveraging the FileNet eProcess API and a
corresponding messaging interface such as JMS
to enable the Process Engine to communicate
via message queues.
Why framework development is needed                        recently designed a mission-critical business
                                                           process management application for a Fortune
We need to understand why framework                        10 insurance customer.
development is really required. Frameworks
provide templates for flexible and modular
architecture. Lets suppose that five Java/J2EE             Acknowledgements
solutions are being executed in an organization.
Most of them have to have Infrastrcture,                   I would like to thank Deviprasad K. and
Security, Database access, MQ Integration,                 Radhesh Koka for their guidance and valuable
Presentation, and Validation etc. So what is the           inputs.
use      of    developing    five   times    those
components/framework/building block/common
code that are standard across all the five
applications? At least 25% to 30 % of time of
total life cycle goes in designing/building/testing
those general-purpose components.
For e.g. if a project requires 40 resources to
work 8 hours a days, then at least 10 resources
would be engaged in the activities mentioned
above, without focusing on actual core logic. If
design there is a reuse process in place for the
design and development teams, then there
would be significant cost and time saving as the
10 resources mentioned above can be used for
core project design and development activities
and reuse the common components across
projects.. So, if a person’s cost is Rs. 1000 per
day, the company would lose 1000 * 10 =
10,000/day and for 5 projects, the amount
would be Rs 50000/ day. Is this a small

In     today’s    every-changing       business
environment, where technology is the key to
competitiveness and success, it is absolutely
essential for organizations to have a clearly
thought-out reuse strategy that will effectively
reuse design and development best practices
and components.


Author Profile

Palash Ghosh is a senior technical architect who
has extensive experience in architecting,
designing and developing Java/J2EE based
applications. He is part of the Consulting and
Enterprise Solution business unit and has most

To top