New version of Expression Engine Released - 2.3

  1. Support for ternary operator
  2. Support for XML expressions, using Xalan XPath
    1. XML Expressions are returning only String type value. 
    2. We can change it to some specific type like Number, String etc in future depending upon data or we should provide some type casting function
  3. Added more test cases 


For Download: http://xpressionengine.blogspot.com/p/downloads.html

New version of Expression Engine Released - 2.2


New version of 'XpressionEngine' has been released at 





Release notes: 
  • Support for more math functions
  • Bitwise operators
  • Change precendence of operators - http://en.wikipedia.org/wiki/Order_of_operations
  • Change '=' operator with '=='
 

MVCS Design implementation in Flex and/or Parsley

Here are varioius approaches to implement MVCS design using Flex and Parsley. MVCS - Model View Controller and Service. MVCS contains one more layer, called as Service. Service is used to contain business logic. It can be on client side or at server side, depending upon the application architecture. (Refer for MVC definition



Here we are defining MVCS from Flex and Parsley perspective.Following MVCS, there can be various kind of layers and interaction.

Layers and Flow of control
  • View
    • MXML and View Logic
    • Interacts with Presentation Model for data
    • May Interact with Commands for action implementation
  • Presentation Model
    • Contains data state for view, may contains data transfer object from Service
    • May interact directly with services for data related operations
    • Or can have interaction channel with Commands to have update for data 
    • Injected in View as stateless object
  • Commands
    • Contains view logic to act upon various user action from UI
    • Helps to break the UI logic in various objects which acts based on the action
    • Interact with Services for data related operations or Business Logic
    • May update the presentation model for data state
    • Can act as singleton stateless objects and linked with event mechanism 
    • Or view can have their reference as per architecture preference
  • Service
    • Contains business logic and data related operations
    • Can be on server side and may be implemented in various language like PHP or Java etc
    • Can be on client side in case of desktop application, can use assql like MySQL connector to interact with database
    • Service Delegates generally injected in Commands or Presentation Model using DI
Now there are many interaction models between these four layers depending upon overall application architecture or architect preference. 



New version of Expression Engine Released

New version of Expression Engine has been released at Google Code. It has the fix for unary operators and now supports expressions like

false || ! false
OR
-3 * -2 / -6
OR
20 - (10/-2 + (-5 * -2)) / (15 * (-5/5) )

Latest release is xpressionengine 2.1.

Why do we need Abstract Class


Why do we need an Abstract Class, when all the functionality can be achieved
through Base Class and Interfaces?

We write abstract class to define some abstract methods along with, some common methods which can be used by other subclasses. So we can do one thing, the common methods we can define in a Base class. And abstract methods we can define in Interface and the class need it will implement the interface (or the Base class above will implement the
interface).

In this way we can achieve both the functionality. Then why do we need Abstract Classes?

Answer: 

Let us consider a scenario where:


  • We are having a framework with some framework specific methods in core implementing classes, like initialize, uninitialize etc. 
  • We want some work to be implemented in these methods by base and implementing classes both, like 
  • Some common code in base class 
  • Some specific code in extending class 
  • However the sequence of calls for these code segments should be fixed i.e. as per framework assumptions 
Let us take example of initialize method


Class abstract AbstractClass {

Public final void initialize ()
{
      // initialize framework specific items like service locators in
abstract class
// initialize object specific factory in abstract class
// initialize any other resource which is required to be initialized before
any other item of object in abstract class
      InitializeUI ();
// initialize DTO Cache in abstract class
InitializeDTOBindings();
// show UI

}
Public void abstract initializeUI ();
Public void abstract initializeDTOBindings ();

}
Now the extending class is forced to implement the two abstract methods, which framework wants it to extend. However framework still has the control on sequence of method calling and also providing some common implementation. This common implementation is very important with base class, as all the
developers in team may not be mature enough to learn and follow the framework protocol. 

So here abstract class is helping us to enforce the framework protocols. 

More Behavioral Design Patterns

Observer Pattern, Strategy Pattern, Visitor Pattern


Observer Pattern

It enables one or more objects to observe the states of one or more other objects. By implementing this pattern, one object request other object to intimate it for any change in a specific state which enables the system to refresh or act dynamically based on any state change anywhere in the system.

Here the object which is producing the events for state change is called observable and the object capturing the events is called observer.

Example

  • If an object contains the data for system and two different objects like JList and JTable are responsible to display this data in required format. Here JList and JTable can register themselves as observer to object containing the data.  So that any change in data can be captured and corresponding change can be made in view.

Behavioral Design Patterns


These patterns are more specifically concerned with communication between objects.

Here are Chain of Responsibility Pattern, Iterator Pattern, Command Pattern and Mediator Pattern.

Chain of Responsibility

It allows a number of classes to attempt to handle a request, without any of them knowing about the existence or capabilities of other classes. So a lose coupling occurs between these classes and the request object passed to these classes is the only common link.

The request is passed through these classes until any one of these handles this request. Generally once handled, no other classes are visited. But a distorted form of this pattern allows more than one class to handle the request and process it, like servlets filters.

Example

  • A help system, which can take the request for help from specific portion of UI. A chain of different help handlers in help system can try to handle this request and if any handler is successful to handle this request, it will do the processing. Further no handler will be invoked by core system.
  • We have the requirement to process some of the data from flat files and based on this data and some other parameters to the system, have to feed this data to database. The processing flow may vary depending on type of data and supplied parameters. Here distorted form of chain of responsibility can be applied.

Decorator Design Pattern

A decorator also known as wrapper is an object that has an interface identical to an object it contains. Any call that the decorator gets, it relays to the wrapped object and add its own functionalities along the way, either before or after the call. 

Example

  • If we need to draw different borders for toolbar buttons, and one border may be applicable to more than one button. This can extend beyond border i.e. to other functionalities like color, font size etc.
  • Suppose if we are developing our data access system and want to track each and every database call made by using java.sql objects, we can define decorator connection, statement and result set which can wrap any other data base object and can intercept the calls made by these. 


Structural Design Patterns

Adapter Pattern, Bridge Pattern, and Composite Pattern


Adapter Pattern

Adapter is used to adapt the behavior/functionalities of an existing class but with a different interface.
It can be implemented by two ways, by inheritance (also called class adapter) or by composition (also called object adapter). Either we can extend the existing class and use its functionalities in new interface method, or we can use a reference of existing class in new object for using existing functionalities. 

Example

  • We are making data bound UI components, which are implementing some of our proprietary interface to support the data loading/unloading. But UI components are already defined with Swing library so we want to use these and just want to bind them with data sources. Here we can extend our new components from existing Swing component and implement our data binding interface to it.
  • Use of Window Adapter while intercepting the window closing event. 

More Creational Design Patterns

Builder Pattern, and Prototype Pattern


Builder Pattern:

It separates the construction of complex object from its representation, so that number of different representations can be build based on the requirement. It is similar to factory pattern, but it does not return simple descendant of base class. The factory is concerned with what is made and the builder with how it is made. Factory simply returns an instance of related class of base type, but builder returns a composition of various classes depending on the specified state. 

Example

  • Editor Builder: Suppose you are creating a UI for workflow where a number of different types of nodes can exist. We need different editors to edit these nodes, which can be very complex in structure. Here we can use builder which can build the desired editor.  Even editors can vary in structure based on current state of system.