Frameworks - UML

At the risk of over simplification, a framework is an extendable set of objects for related functions. The quintessential example is a GUI framework, such as Java's Swing framework.

The signature quality of a framework is that it provides an implementation for the core and unvarying functions, and includes a mechanism to allow a developer to plug in the varying functions, or to extend the functions.

For example, Java's Swing GUI framework provides many classes and interfaces for core GUI functions. Developers can add specialized widgets by subclassing from the Swing classes and overriding certain methods. Developers can also plug in varying event response behavior to predefined widget classes (such as JButton) by registering listeners or subscribers based on the Observer pattern. That's a framework.

In general, a framework:

  1. Is a cohesive set of interfaces and classes that collaborate to provide services for the core, unvarying part of a logical subsystem.
  2. Contains concrete (and especially) abstract classes that define interfaces to conform to, object interactions to participate in, and other invariants.
  3. Usually (but not necessarily) requires the framework user to define subclasses of existing framework classes to make use of, customize, and extend the framework services.
  4. Has abstract classes that may contain both abstract and concrete methods.
  5. Relies on the Hollywood Principle - "Don't call us, we'll call you." This means that the user - defined classes (for example, new subclasses) will receive messages from the predefined framework classes. These are usually handled by implementing superclass abstract methods.

The following persistence framework example will demonstrate these principles.

Frameworks Are Reusable

Frameworks offer a high degree of reuse - much more so than individual classes. Consequently, if an organization is interested (and who isn't?) in increasing its degree of software reuse, then it should emphasize the creation of frameworks.

Requirements for the Persistence Service and Framework

For the NextGen POS application, we need a persistence service to be built with a persistence framework (which could be used to also create other persistence services). Let's call the framework PFW (Persistence Framework). PFW is a simplified framework - a full - blown, industrial - strength persistence framework is outside the scope of this introduction.

The framework should provide functions such as:

  1. store and retrieve objects in a persistent storage mechanism
  2. commit and rollback transactions

The design should be extendable to support different storage mechanisms and formats, such as RDBs, records in flat files, or XML in files.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

UML Topics