Component Based Software Development with EJB and .Net
SAJJAD ALI KHAN
WAQAR HUSSAIN
[email protected], [email protected]
Mälardalen University
Department of computer science and electronics
Västerås -Sweden
Abstract
Component-based software development has become a common practice to reuse validated software components to shorten development periods and to enhance software quality. This approach focuses on development of new systems by selecting and assembling a set of off-the-shelf components within appropriate software architecture. Furthermore, it accelerates software development productivity and reduces the costs. This paper presents a general overview of component-based software development (CBSD), some major activities that take place in this approach and a brief overview of latest technologies used for component-based development in the software industry. It has been focused mainly on EJB and .Net the two major and popular component technologies in more detail, by discussing their advantages and limitations. Also we have attempted to compare EJB and .Net technologies for CBSD that could be supportive for someone to choose the appropriate technology depending on his/her business and development needs.
Keywords: Component-based software development, Component-based software engineering, component, CBSE, CBSD, Component development, COTS, EJB, .Net, J2EE.
1. Introduction
Software does not wear out but due to some significant factors like continuous change and increase in complexity, software should be changed to meet evolving business needs. Consequently, when software evolves it becomes more and more complex and thus implies more
software errors. Schneberge [1] suggested that to reduce software complexity and maintenance efforts it is necessary to build small and simple applications based on components.
The idea of component based development is not new. Componentizing software had been suggested by McIlorys (McIlroys 1969) as a way of tackling the software crisis, yet only in the last decade or so has the idea of component-based software development (CBSD) taken off. Nowadays there is an increasing market place for Commercial Off-The-Shelf (COTS) components. The CBSD embodies the "buy, don't build" philosophy espoused by Fred Brooks [2]. This type of development has been used in many domains; for instance, it has been used in desktop environments and mathematical applications for many years [3].
The CBSD focuses on assembling pre-existing software components for building large software systems. This approach not only enhances the flexibility and maintainability of systems but reduces overall software development costs and assembles systems rapidly.
The component based software engineering is based on the concept of component. We can find different definitions of component in a literature. But everyone agrees that a component is a piece of software that offers a service but this definition is too broad because, for example, even compiled libraries (e.g., .o and .dll files) could be defined in this way. A component is a reusable unit of deployment and composition that is accessed through an interface [4]. Component is an independent entity with a complete functionality that can be upgraded and distributed separately. Software components are developed under some standards and in such a way that they provide
functions common to many different systems and can be reused easily. Components are high level aggregations of smaller software pieces, and provide a 'black box' building block approach to software development. Moreover, it encapsulates the implementation detail from the environment and can be reused by their interfaces.
The most important aspect of software component is its reusability. Most of the systems are being developed using core components that are pre developed by the same company or by other vendors. This approach reduces the time to market and make easy to maintain and upgrade the software systems. Components should be designed and developed in such a way that it must be possible to connect to a software component at run-time or dynamically; therefore, a component is stated to be independently deployable. This approach utilizes the resources, so we can use the components when needed otherwise we do not load them in application.
2. Component-based Software
Development Activities
In CBSD, the notion of building a system by writing code has been replaced with building a system by assembling and integrating existing software components. Brown [5] stated four activities in component-based development approach.
component qualification
component adaptation
assembling components
system evolution
In the following subsections we discuss the above defined activities in some more detail.
2.1
Component qualification
It is a process of determining components suitability of reusing the previously developed components in the next system. This process also can be used to select the components when a market place for competing products exits.
Among the many factors that should be considered during the components qualification includes the functionality and services that a component is providing and some other aspects like the standards that are used and some quality aspects
such as component reliability, predictability, and usability etc.
2.2
Component adaptation
The components are developed to meet different requirements, and based on different assumptions about their context. Thus, for their reusability it must be adapted based on rules that ensure to minimize the conflicts among components in new systems. To mitigate against these conflicts, an adaptation technique called component wrapping [5] is often used.
Rogers S. Pressman [6] defined different wrapping approaches for components adoptions like:
White-box wrapping examines the internal processing
details of the component and makes code level modifications to remove any conflict. Gray-box
wrapping is applied when the component library
provides a component extension language or API that enables conflicts to be removed or masked.
Black-box wrapping requires the introduction of
pre and post processing at the component interface to remove or mask conflicts.
2.3
Assembling components
Components are assembled or integrated through some well defined infrastructure, which provides the binding that forms a system from disparate components. COTS components, for example, are usually written to some component model defined by e.g., Enterprise Java Beans (EJB), COM, CORBA, and .NET etc.
2.4
System evaluation
To meet the business needs, the system evaluation is very important. In CBS, system evolution is based around the replacing of outdated components by new ones, or, at least, ideally. The treatment of components as plug-replaceable units is a simplistic view of system evolution. In practice [7], replacing a component may be a non-trivial task, especially when there is a mismatch between the new component and old one, triggering another stage of adaptation with the new component.
3
Component Technologies
There are many different component technologies widely used because of different requirements applying. Some of the most used technologies
today are the Common Object Request Broker Architecture (CORBA) by the Object Management Group (OMG), the Component Object Model (COM), .NET framework (by Microsoft) and Enterprise Java Beans (EJB) by Sun Microsystems. These three technologies will be described in detail in the following subsections.
3.1
CORBA
CORBA stands for Common Object Request
Broker Architecture, where ORB is an updated
object oriented version of an older technology known as RPC (Remote Procedural Calls) [17]. The Object Request Broker or Remote Procedural Calls allows client applications to call methods (passing requests and responses) on an object across different networks. In simple words CORBA can be defined as a standard mechanism for invoking operations on objects. CORBA is distributed middleware technology that is able to interoperate and connect remote objects on various machines, operating systems, programming language and different networks using a standard IIOP protocol. Internet Inter-ORB Protocol is an object-based protocol through which objects can process request across different networks.
3.2
COM
Component Object Model (COM) is a component technology which is a specification and set of services that allows us to create software components and then linking these components together to form reusable, object-oriented, language-independent and upgradable applications.
Since COM components are language independent therefore, these can be written in any programming language. COM components are similar to normal objects and it promotes the Object Oriented technique of polymorphism, encapsulation and inheritance. COM components consist of COM interfaces [18], a system for registering and passing messages between components via these interfaces. COM interfaces are defined in Microsoft Interface Description Language (MIDL)
3.3
Enterprise JavaBeans (EJB):
In very straightforward terms, Enterprise JavaBeans (EJB) is a component model for building portable, reusable and scalable business
components using the Java programming language for distributed environment. In the industry, Enterprise JavaBeans [8] has been applied for component development environment as best solution.
EJB allows development of reusable components. For example, to implement the credit card– charging module as an EJB component that may be accessed by multiple applications as shown in figure 5.1.
Figure 3.3.a: Components reusability
Components are called ‘beans’ in the EJB model. EJB is the server-side component architecture and for server-side development, the dominant pattern is layered architectures. In a layered architecture, components are grouped into tiers. Each tier in the application has a well-defined purpose, sort of like a profession but more like a section of a factory assembly line. Each section of the assembly line performs its designated task and passes the remaining work down the line. EJB allows building applications using two different layered architectures: the traditional four-tier architecture and domain-driven design (DDD).
Figure 3.3.b shows the traditional four-tier server architecture [10]. In this architecture, the presentation layer is responsible for rendering the graphical user interface (GUI) and handling user input. This layer passes down each request for application functionality to the business logic layer. The business logic layer is the heart of an application and contains work flow and processing logic. This layer contains the business rules and logic and can perform some actions like billing, searching, ordering, and user account maintenance etc. The business logic layer retrieves data from and saves data into the database by utilizing the persistence tier. The persistence layer provides a high-level object-oriented (OO) abstraction over
the database layer. The database layer typically consists of a relational database management system (RDBMS) like Oracle, MySQL, or SQL Server.
Figure 3.3.b: Traditional four-tier server architecture
EJB is obviously not a presentation layer technology. EJB is all about robust support for implementing the business logic and persistence layers. EJB servers give a bunch of services, so that we don’t have to write them ourselves. Figure 3.3.c represents the some supporting services with in different layers like security, transaction management, concurrency, networking, resource management, persistence and messaging etc.
Figure 3.3.c: Supporting services of EJB in different layers
An enterprise bean provides home interfaces and component interfaces to support distributed objects. Therefore, an enterprise bean is a small component in object level. Home interfaces simply define methods for creating, destroying, and finding EJB objects. Component interfaces are interfaces to provide functions of an enterprise bean. In EJB, there are three types of enterprise bean: session bean, entity bean, and message-driven bean [9].
The beans corresponding to the data tier are called entity beans; such a bean represents data in a relational database. In an entity bean, getter and setter methods are implemented in order to alter data in the database. The beans corresponding to the business tier are called session beans. A session bean can be either stateful or stateless. The difference between the two is whether there is data altered during a session (stateful) or not (stateless). Message Driven Bean is an enterprise bean that can be used by JEE applications to process the messages asynchronously, it act as a message consumer and receives JMS messages.
3.3.1
EJB advantages
EJB is a groundbreaking technology that has raised the standards of server-side development. Following are some key advantages and features that make EJB so popular in component development arena.
Ease of use: Thanks to the unwavering focus
on ease of use, EJB is probably the simplest server-side development platform around. The features that shine the brightest are POJO programming, annotations in favor of verbose XML, heavy use of sensible defaults, and Java persistence API etc [10].
Integration with the J2EE platform: Since
Sun introduced EJB in 1997, a strong enterprise computing environment has grown up around it, including technologies such as servlets, JMS (Java Message Service), JSP (JavaServer Pages), the JCA (Java Connector Architecture), JDBC (Java Database Connectivity), security, and transaction management. Such integration enhances EJB's attractiveness as the J2EE platform includes so much other complementary technology.
Layered architecture: The presentation
logic (Servlets and JSPs) is separated from the business logic (EJB components). This allows for various types of presentation logic, such as WAP enabled phones or web-based clients tapping an XML data stream from a business service provider. The same separation, however, can be equally well achieved without resorting to the EJB architecture.
Stability and high quality coding: Most
application server implementations will still benefit from a relatively stable code base that has lived through some of the most demanding enterprise environments over a prolonged period of time. We can expect stable implementations relatively quickly. Also, because of the very nature of standards based development, the quality of EJB 3 container implementations is generally not taken lightly by vendors [10].
Open standards and broad vendor support: EJB is critical part of JEE standards
and Java community process drives open standards that lead to broader vendor support for EJB , which means we don’t have to depend on a proprietary solutions. Additionally, enterprise Java technology continuously improves.
3.3.2
Limitations of EJB
As EJB is featured enrich but on the other hand there are some limitations which are cited below.
Large and complicated specification: The
truth is that every widely adopted distributed technology, such as Microsoft .Net or OMG CORBA, suffers from this weak point. Still, there are ways in which the specification can be simplified. For instance, in practice only two roles can be discerned as opposed to the six roles described in the specification: container providers and application providers. The latter administrate the server, build the application, assemble it and finally deploy it. This is how teams are organized in the real world [16].
Added complexity compared to straight Java classes: Every session bean consists of
at least three Java classes, while every entity bean comprises at least four. We also need standard and possibly vendor-specific deployment descriptors. It is true that some tools for auto generation can considerably reduce the coding time. However, these tools introduce their own restrictions because usually they tie you to one vendor [16].
Produce a more complex and costly solution than necessary:
This disadvantage is a direct corollary of the
complex specification. The specification is so complicated that some developers do not take full advantage of it, simply because they fail to understand it. A common pitfall is to misuse some parts and reinvent others, creating a solution that is hard to maintain and one that does not focus on the merits of EJB [16].
Poor Object/Relational mapping: EJBQL is
also notorious for its limitations. There exists no standardized portable way to retrieve the first N records either the whole collection is loaded or each bean is loaded one at a time. The primary key generation mechanism is usually rather awkward as well.
3.4
.NET
.NET was first presented in Professional Development Conference (PDC) in July 2000, it was a whole new development framework for windows. Microsoft also released PDC version of the software for the developers to test. Beta 1 version of .NET was announced which received much popularity and attention from the developer’s community since it was made available for testing in its every pre-release version.
In March 2002, Microsoft finally released the final version of .NET. This new technology was introduced by eliminating all unwanted complexities and using object oriented programming model.
.Net is not a single technology rather it is a set or collection of technologies on which all other Microsoft technologies will be depending on in future [21]. Even Microsoft considers .NET equivalent to transition from DOS to Windows. From programmers perspective .NET is a huge class library which is equipped with everything needed to write different types of applications [19]. Technically, it is revolutionary platform for developing managed software which includes web services and various applications. The word Managed could be understood in a way that, traditionally executable files are binary and are executed by the Operating System immediately. On the other hand in .NET environment the
executable file produced by the compiler is an assembly not binary .NET like other platforms supports various programming languages which are as follows:
3.4.1
.NET Framework:Figure 3.4.1 .NET Framework Architecture
.NET supports variety of programming languages. However, any language which is used for .NET programming must meet a set of minimum requirements to use the .NET class libraries. These requirements are known as the .NET Common Language Specification or CLS. Related to the CLS is the .NET Common Type System (CTS) which defines the basic data types (such as integer, floating point, and string) that .NET languages support. The CLS and CTS are in turn part of the Common Language Infrastructure (CLI).
When a .NET program is generally compiled it is compiled to a processor-independent intermediate language that resembles machine code. This
intermediate language is known as Microsoft Intermediate Language (MSIL) but the most proper term used is now the Common Intermediate Language (CIL). The .NET framework has two main components The Common Language Runtime (CLR) and the Class Library.
Various Components of .NET Platform and their functionality:
3.4.2
Class library:Class library exists within the .NET framework, which holds the prewritten classes that can be used to develop components and applications on Windows platforms.
3.4.3
Common Language Runtime:Common Language Runtime (CLR) is the most important component of .NET framework which provides a run time environment handling the code execution. The code running under CLR is called "managed code", CLR manages code and provide useful services like automatic garbage collection, security, code verification and memory management etc.
It converts intermediate language into native coding which could run on different operating systems. Its main features include
Common Type System: Interoperability of
programming languages using .NET technology is possible if and only if all the languages share a common data type system. Common type system describes how types are declared, used and managed in the runtime and facilitates cross-language integration, type safety, and high performance code execution.
Common Language Specification: It is a
subset of CTS and the main function of CLS is that it defines the rules to support language integration in a way that programs written in any language, can interoperate with one another, taking full advantage of inheritance, polymorphism and other related features.
Figure 3.4.3 .NET Framework Architecture
Common Intermediate Language: When
compiling to manage code, the compiler translates source code into Microsoft intermediate language CIL also called MSIL, which is a CPU-independent set of instructions that can be efficiently converted to native code. CIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations.
Assembly: Assemblies are the building
blocks of .NET Framework applications; they form the fundamental unit of deployment, version control, reuse, activation scoping, and security permissions. An assembly provides the common language runtime with the information it needs to be aware of type implementations.
Metadata: Metadata is a description of every
namespace, class, method, property etc. contained within the Portable Executable file. Through Metadata we can discover all the classes and their members contained within the Portable Executable file
3.4.4
.NET as Component Technology:.NET is designed not only improve some drawbacks present in COM like awkward concurrency and management through apartments
but also maintain the core COM concepts that have proven themselves as core principles. [20]
3.4.5
Packaging .NET Components
:
Assembly is the code packaging unit for .NET. An
assembly usually contains just one DLL a logical dll but it can combine more than one physical DLLs into a single deployment and security unit. An assembly can contain both EXE as well as DLLs. The code in the assembly (in the DLLs or the EXE) is only the IL code, and at runtime the I L is compiled to native code.
3.4.6
Advantages of .NET:
Enhanced Security: Windows platform was always criticized for poor security mechanisms. Microsoft has taken great efforts to make .NET platform safe and secure for enterprise applications by using features like garbage collection and strong data typing .NET has enhanced its security by limiting malicious programs from doing any damage
Automatic memory management: Memory leaks were major reason in failure of applications. .NET takes this worry away from developer by handling memory on its own. The garbage collector takes care of freeing unused objects at appropriate intervals.
Object Oriented Support: The advantages of Object Oriented programming are well known. .NET provides a fully object oriented environment. NET languages treat every entity, user initiated events and data values as an object, resulting in a clear programming model. Multi-Language Support:.NET supports
multiple languages such as Visual Basic.NET, C# (pronounced as C-sharp), Jscript.NET and Managed C++ (a dialect of Visual C++). The beauty of multi language support lies in the fact that even though the syntax of each language is different, the basic capabilities of each language remain at par with one another.
Free from DLL Hell: When using Component Object Model (COM) dealing with DLLs (DLL Hell) was a main problem. .NET ends this DLL hell by allowing applications to use their own copy of dependent DLLs.
Rapid Project Development: Due to the numerous availability of vast class libraries and IDE, developers are able to build business logic and web based user interfaces significantly faster than before
Simplified Development of Application:
.NET provides stable and robust environment
which limits the development time. .NET provides developers with set of tools for building Web services quickly and cost-effectively. Developers can use these tools to create scalable solutions that can work across different computing devices.
3.4.7
Disadvantages/Limitations of .NET:
From an operational perspective, the capacity and ongoing cost to support .NET at the server level will by nature be higher.
.NET is having disadvantage of its dependency mostly over the Windows operating system. Microsoft keeps the core components of the
framework and Microsoft is the only provider of complete .NET development and runtime environments.
Future directions are determined by Microsoft means any application built on .NET means we are committed and dependent on Microsoft as license costs continue to increase with the enhanced restrictions in terms of use.
4
Conclusion
In the recent year Component Based Software Development has become a better choice available to software development since component-based development enables higher level of Software reuse. Affordability, simplicity, easily implementable reduced workload and time are the major turning point for its success. CBSD, if established globally will certainly put strong impact on the quality of software development. We discussed two technologies used for CBSD in more detail. Through the partial submission of .NET to a European standard committee, Microsoft has created the "illusion of open standards support" for the .NET platform, said Gartner Group [14]. As O'Reilly reports: "The core components of the framework (IL runtime environment, ASP.NET internals, Win Forms and Web Forms) are kept by Microsoft, and Microsoft
will be the only provider of complete .NET development and runtime environments."[15]. On the other hand, J2EE that provides the EJB core components works on any platform with a compliant Java VM and a compliant set of required platform services (EJB container, JMS service, etc.). All of the specifications that define the EJB platform are published and reviewed publicly, and numerous vendors offer compliant products and development environments. Analysts [14] widely agree that EJB is an open standard specification while Microsoft .NET is proprietary. "In practical terms," if you build your application on .NET you're wedded to Microsoft for the life of the application and at their 'mercy' as license costs continue to increase and terms of use become increasingly restrictive.
Moreover, to deploy the applications .Net uses only IIS server while to deploy EJB based applications, application servers are available from multiple vendors.
The software applications of tomorrow will be interrelated, distributed peer-level software modules and components that work in tandem to achieve specified functional goals. These complex software systems encompass a collection of distributed applications, resources and services connected via a network of computing systems. These software as a service model is based upon a build-via-assembly approach and this type of development will require new ways of thinking about hardware and software architectures. As a consequence, many components are available being either open-source software (OSS) or COTS. However, it is still unclear how the decision for acquiring OSS or COTS components is made in practice.
5
Related Work
Dr. Gilda Pour [11] explained that how a trend is changed from traditional software development approach to component-based software development approach. He also discussed the some issues related to selection and integration of COTS. [12] represents some techniques for transforming object-oriented design(OOD) into component-based design(CBD) using Object-Z and Component-Z specifications. So using formal specification of both OOD and CBD, OOD can be reused in generating CBD and the resulting CBD
can be effectively implemented by utilizing objects in EJB, .Net or CORBA. Some challenges and risks of component-based software development are addressed by the Padmal V[13]. He discussed some risks and challenges on the end of components developers, application assemblers and customer’s point of view.
We tried to give a clear overview of component-based software development, by discussing some major activities involved in component-based software engineering. Moreover, we discussed some technologies that are being used for this approach and two of them like .Net and EJB in a more detail due to their popularity in the software industry. We conducted a comparison between these two technologies and also try to disclose the limitations of these technologies as well. We hope that this paper will not only gives the reader deep understanding about the CBSD but it will be helpful in the selection of the technology for CBSD.
References:
[1] S.L. Schneberger, "Software maintenance in distributed computer environments: system complexity versus component simplicity," ICSM, p. 304, 11th International Conference on Software Maintenance (ICSM'95), 1995
[2] Brooks, F. P. Jr. "No Silver Bullet: Essence and Accidents of Software Engineering,"
Computer 20, 4 (April 1987): 10-9.
[3] Manny M. Lehman and Les Belady, “Program Evolution – Processes of Software Change”. London Academic Press, 1985
[4] Ivica C and Magnuss L, “Building reliable component-based software systems” Artech House, 2002
[5] Brown, Alan W. & Wallnau, Kurt C. "Engihttp://cbs.colognet.org/overview.php
Engineering of Component-Based Systems," 7-15.
Component-Based Software Engineering: Selected Papers from the Software Engineering Institute.
Los Alamitos, CA: IEEE Computer Society Press, 1996.
[6] Rogers S. Pressman Ph. D. “Software engineering- Practitioner´s approach” 5th Edition, McGraw-Hill series in computer science, 2001 [7]http://cbs.colognet.org/overview.php,
“Component-based software development-overview”, 2008-10-07 18:53
[8]DeMichiel, L., Sun Microsystems, Enterprise JavaBeans™ Specification, Version 2.1, Sun Microsystems, pp.1-635, 2002.
[9] Hyun G, Jin L, Sung K, and Soo K, “An Effective Method to Design CBD Components in Enterprise JavaBeans (EJB) ” , Proceedings of the Fourth InternatioRISKS AND CHALLENGES OF COMPONENT-BASED SOFTWARE DEVELOPMENT 25 Oreilly.com, "Microsoft .NET vs. J2EE: How Do They Stack Up?" Jim Farley, August 1, 2000.”, Communal Conference on Software Engineering Research, Management and Applications (SERA’06) IEEE, 2006.
[10] Debu P, Reza R and Derek L, “EJB 3 in action”, Manning publication, 2007.
[11] Dr. Gilda Pour, “Moving toward Component-Based Software Development Approach”, IEEE, 1998
[12] Suk K.S and Soo D.K, “A Method to Transform Object-Oriented Design into Component-Based Design using Object-Z”, Proceedings of the 2005 Third ACIS Int'l Conference on S25 Oreilly.com, "Microsoft .NET vs. J2EE: How Do They Stack Up?" Jim Farley, August 1, 2000.oftware Engineering Research, Management and Applications (SERA’05), IEEE0-7695-2297-1/05 2005.
[13] Padmal V, “RISKS AND CHALLENGES OF COMPONENT-BASED SOFTWARE DEVELOPMENT”, COMMUNICATIONS OF THE ACM August 2003/Vol. 46, No. 8.
[14] Gartner Group, "CIO Update: How Java and .NET Compare and Will Evolve," M. Driver, June 11, 2003.
[15] Oreilly.com, "Microsoft .NET vs. J2EE: How Do They Stack Up?" Jim Farley, August 1, 2000.
[16] Sheil, H. “To EJB, or not to EJB?” http://www.javaworld.com/javaworld/jw-12-2001/jw-1207-yesnoejb.html?
[17] Ciaran Mchale, Introducing and Explaining Corba http://www.ciaranmchale.com/corba-
explained-simply/core-concepts-and-terminology.html#toc11
[18]Sara Willliams and Charlie Kindel “The
Component Object Model: A Technical Overview”
Microsoft Corp October, 1994
[19] Joseph Mayo, “Introducing .NET Platform” August 26, 2008
[20] Juval Löwy“O_Reilly COM and NET Component Services” September 2001
[21]James Conard, Scott Short and Chris Ullman “Introducing .NET” published by Wrox Press January 2001