ge_title -->

Java EE Platform Benefits

Java Web Development

Java EE Environment

Java EE Environment

Java EE Platform Benefits

  • Simplified architecture and development
  • Freedom of choice in servers, tools, and components
  • Integration with existing information systems
  • Scalability to meet demand variations
  • Flexible security model

1. Simplified Architecture and Development

  • The J2EE platform supports a simplified, component-based development model.
  • This model offers “Write-Once-Run-Anywhere” portability, supported by any server product that conforms to the J2EE standard.
  • The component-based J2EE development model can enhance application development productivity in a number of ways:
  • Maps easily to application functionality
    • Simplifies application maintenance, since components can be updated and replaced independently—new functionality can be shimmed/added into existing applications simply by updating selected components.
  • Enables assembly- and deploy-time behaviors
    • The code of a J2EE application can be generated automatically by tools.
    • Many application behaviors can be configured at application assembly or deployment time, without recoding.
  • Supports division of labor
    • Web page authors can create JSP templates,
    • Java coders can implement application behavior,
    • Domain experts can develop business logic
    • Application developers  and integrators can assemble and deploy applications.
    • This division of labor also expedites application maintenance.

2. Integrating Existing Enterprise IS

APIs are used for accessing existing enterprise information systems.

  • The J2EE Connector architecture is the infrastructure for interacting with a variety of Enterprise IS types, including ERP, and other legacy systems.
  • The JDBC API is used for accessing relational data from the Java programming language.
  • The Java Transaction API (JTA) is the API for managing and coordinating transactions across enterprise information systems.
  • The Java Naming and Directory Interface(JNDI) is the API for accessing information in enterprise name and directory services.
  • The Java Message Service (JMS) is the API for sending and receiving messages via enterprise messaging systems such as IBM MQ Series and TIBCO Rendezvous.
  • The JavaMail API is used for sending and receiving e-mail.
  • Java IDL provides the mechanism for calling CORBA services.
  • Java APIs for XML provides support for integration with legacy systems and applications, and for implementing Web services in the J2EE platform.

3. Choice of Servers, Tools, and Components

  • The standardization and branding of the J2EE platform provide many benefits, including:
  • A range of server choices— Application development organizations can expect J2EE branded platforms from a variety of vendors, providing a range of choices in hardware platforms, operating systems, and server configurations.
    • This ensures that businesses get a choice of servers appropriate to their needs.
  • Designed for tool support
    • Both enterprise beans and JSP page components are designed to be manipulated by graphical development tools and to allow automating many of the application development
    • Application developers have a choice of tools to manipulate and assemble components, and individual team members may choose tools that best suit their specific requirements.
  • A marketplace for components
    • The component-based design ensures that many types of behavior can be standardized, packaged, and reused by any J2EE application.
    • Component vendors will provide a variety of off-the-shelf component solutions, including accounting beans, user interface templates.

 4. Scales Easily

  • J2EE containers provide a mechanism that supports simplified scaling of distributed applications, with no application development effort.
  • Because J2EE containers provide components with transaction support, database connections
  • Containers may pool database connections, providing clients with quick, efficient access to data because containers may run on multiple systems, Web containers can automatically balance the load in response to fluctuating demand.

Read Also:

5. Simplified, Unified Security Model

  • The J2EE security model is designed to support single sign on access to application services.
  • Component developers can specify the security requirements of a component at the method level
  • While both Enterprise JavaBeans technology and Java Servlet APIs provide programmatic security control, the basic role-based security mechanism (where groups of users share specific permissions) is specified entirely at application deployment time.
  • This provides both greater flexibility and better security control.

 Multitier Application Scenario

  • Web container hosts Web components that are almost exclusively dedicated to handling a given application’s presentation logic.
  • The EJB container hosts application components that use EIS resources to service requests from Web-tier components.
  • Application back-office functionality is relatively isolated from the end-user look and feel.

Multitier Application

MVC Framework

  • Regardless of application domain or industry vertical, technology platform, and client-side technology, everyone agrees that three fundamental concepts should be decoupled and kept separate—namely, the data, the business logic that operates on that data, and the presentation of that data to the end user
  • In the JEE platform, design pattern that enforces this separation of concerns is called the MVC model.

Relationships Between MVC Participants

Components of the MVC pattern.

  • The controller receives the user input, constructs the appropriate model, and then passes it to the view.
  • Both the controller and the view have a dependency on the model, but the model itself is kept ignorant of the controller and view.

Three pieces of the MVC pattern:

The model— The domain that your software is built around.

  • If you were building a blog, your models might be post and comment. In some contexts, the term model might refer to a view-specific model— a representation of the domain for the specific purpose of being displayed in the user interface.

Three pieces of the MVC pattern:

  • The view— The visual representation of a model, given some context.
    • It’s usually the resulting markup that the framework renders to the browser, such as the HTML representing the blog post.

Three pieces of the MVC pattern:

  • The controller— The coordinator that provides the link between the view and the model.
  • The controller is responsible for processing input, acting upon the model, and deciding on what action should be performed, such as rendering a view or redirecting to another page.
  • Continuing the blog example, the controller might look up the most recent comments for a post (the model) and pass them to the view for rendering.

Design Patterns

  • Creational— Support the creation of objects
  • Structural— Deal with relationships between portions of your application
  • Behavioral— Influence how state and behavior flow through the system

Creational Patterns

  • Creational patterns are patterns whose sole purpose is to facilitate the work of creating, initializing, and configuring objects and classes.
  • Create  create = newCreate();

Creational Patterns

  • They basically act as factories, builders, configuration constructs, or class initializers.
  • These types of patterns are useful when we need to render instances of objects, store these objects, perform complex initialization of objects, or create copies of objects.
  • The Creational patterns are Abstract Factory, Builder, Factory Method, Prototype, and Singleton.

Abstract Factory Pattern

  • This pattern provides an interface for creating families of related or dependent objects without specifying their concrete classes.
  • Given a set of related abstract classes, the Abstract Factory pattern provides a way to create instances of those abstract classes from a matched set of concrete subclasses.

Abstract Factory Pattern

  • The Abstract Factory pattern provides an abstract class that determines the appropriate concrete class to instantiate to create a set of concrete products that implement a standard interface.
  • The client interacts only with the product interfaces and the Abstract Factory class.
  • The client never knows about the concrete  construction classes provided by this pattern.
  • The Abstract Factory pattern is similar to the Factory Method pattern, except it creates families of related objects.

AbstractFactory pattern : UML

AbstractFactory pattern : UML

AbstractFactory pattern : Benefits

  Benefits of using the Abstract Factory pattern:

  • Isolates the concrete classes from client
  • Promotes consistency among products by implementing the common interface

Abstract Factory pattern: When to Use

  • The system should be independent of how its products are created, composed, and represented.
  • The family of related product objects is designed to be used together, and you must enforce this constraint. This is the key point of the pattern; otherwise, you could use a Factory Method.
  • You want to provide a class library of products and reveal only their interfaces, not their implementations.

Builder Pattern

  • It separates the construction of a complex object from its representation so the same construction process can create different objects.
  • It allows a client object to construct a complex object by specifying only its type and content.
  • The client is shielded from the details of the object’s construction. This simplifies the creation of complex objects by defining a class that builds instances of another class.
  • It produces one main product, and there might be more than one class in the product, but there is always one main class.

Builder Pattern: UML Diagram

Builder Pattern: UML Diagram

Builder Pattern: Participants

Participants

The classes and/or objects participating in this pattern are:

  • Builder(VehicleBuilder)
    • Specifies an abstract interface for creating parts of a Product object
  • ConcreteBuilder(MotorCycleBuilder, CarBuilder, ScooterBuilder)
    • Constructs and assembles parts of the product by implementing the Builder interface
    • Defines and keeps track of the representation it creates
    • Provides an interface for retrieving the product
  • Director(Shop)
    • Constructs an object using the Builder interface
  • Product(Vehicle)
    • Represents the complex object under construction. ConcreteBuilder builds the product’s internal representation and defines the process by which it’s assembled
    • Includes classes that define the constituent parts, including interfaces for assembling the parts into the final result

Read Also:

Builder Pattern: Benefits

  • By using Builder pattern, you create the complex objects one step at a time. Other patterns build the object in a single step.

Benefits

  • Lets you vary a product’s internal representation
  • Isolates code for construction and representation
  • Gives you greater control over the construction process

Builder Pattern: When to Use

You should use the Builder pattern when :

  • The algorithm for creating a complex object should be independent of both the parts that make up the object and how these parts are assembled.
  • The construction process must allow different representations of the constructed object.

Factory Method Pattern

  • It defines an interface for creating an object but lets the subclasses decide which class to instantiate.
  • It lets a class defer instantiation to subclasses, which is useful for constructing individual objects for a specific purpose without the requestor knowing the specific class being instantiated.
  • This enables you to introduce new classes without modifying the code because the new class implements only the interface so it can be used by the client.

Factory Method Pattern: Diagram

Factory Method Pattern: Diagram

Factory Method Pattern : Participants

Participants

The classes and/or objects participating in this pattern are:

  • Product(Page)
    • Defines the interface of objects the factory method creates —ConcreteProduct(SkillsPage, EducationPage, ExperiencePage)
    • Implements the Product interface
  • Creator(Document)
    • Declares the factory method, which returns an object of type Product. The creator may also define a default implementation of the factory method that returns a default ConcreteProduct object.
    • May call the factory method to create a Product object.
  • ConcreteCreator(Report, Resume)
    • Overrides the factory method to return an instance of a Concrete Product.

Factory Method Pattern: Benefits

The following lists the benefits of using the Factory

Method pattern:

  • The code deals only with the interface, so you can work with any classes that implement that interface.
  • Enables the subclasses to provide an extended version of an object, because creating an object inside a class is more flexible than creating the object directly in the client.

Factory Method Pattern: When to Use

You should use the Factory Method pattern when:

  • A class cannot anticipate the class of objects it must create.
  • A class wants its subclasses to specify the objects it creates.
  • Classes delegate responsibility to one of several helper subclasses, and you want to localize the knowledge of which helper subclass is the delegate.

Prototype Pattern

  • It allows an object to create customized objects without knowing their exact class or the details of how to create them.
  • It specifies the kinds of objects to create using a prototypical instance and creates new objects by copying this prototype.
  • The creation-initiating object then creates objects by asking the prototypical objects to make copies of themselves.
  • The Prototype pattern makes creating objects dynamically easier by defining classes whose objects can duplicate themselves.

Prototype Pattern: Diagram

Prototype Pattern: Diagram

Prototype Pattern: Participants

Participants

 The classes and/or objects participating in this pattern are:

  • Prototype(ColorPrototype)
    • Declares an interface for cloning itself
  • ConcretePrototype(Color)
    • Implements an operation for cloning itself
  • Client(ColorManager)
    • Creates a new object by asking a prototype to clone itself

Prototype Pattern: Benefits

  • Adding and removing products at run time
  • Specifying new objects by varying values
  • Specifying new objects by varying structure
  • Reducing subclasses
  • Configuring an application with classes dynamically

Prototype Pattern: When to use

  • The classes to instantiate are specified at run time—for example, by dynamic loading
  • To avoid building a class hierarchy of factories that parallels the class hierarchy of products
  • When instances of a class can have one of only a few different combinations of state

Singleton Pattern

  • The Singleton pattern ensures that a class has only one instance and provides a global point of access to that class.
  • t ensures that all objects that use an instance of this class use the same instance.

Singleton Pattern: Diagram

Singleton Pattern: Diagram

Singleton Pattern: Benefits & Usages

Benefits :

  • Controlled access to sole instance
  • Reduced name space
  • Permits refinement of operations and representation
  • More flexible than class operations

When to Use:

  • There must be exactly one instance of a class.
Singleton Pattern: Benefits & Usages

Read Also:

Leave a Comment