Structural Design Patterns


In software engineering, structural design patterns are design patterns that ease the design by identifying a simple way to realize relationships between entities.
Examples of Structural Patterns include:
  • Adapter pattern: 'adapts' one interface for a class into one that a client expects
    • Retrofit Interface Pattern[1][2]: An adapter used as a new interface for multiple classes at the same time.
    • Adapter pipeline: Use multiple adapters for debugging purposes.[3]
  • Aggregate pattern: a version of the Composite pattern with methods for aggregation of children
  • Bridge pattern: decouple an abstraction from its implementation so that the two can vary independently
    • Tombstone: An intermediate "lookup" object contains the real location of an object.[4]
  • Composite pattern: a tree structure of objects where every object has the same interface
  • Decorator pattern: add additional functionality to a class at runtime where subclassing would result in an exponential rise of new classes
  • Extensibility pattern: aka. Framework - hide complex code behind a simple interface
  • Facade pattern: create a simplified interface of an existing interface to ease usage for common tasks
  • Flyweight pattern: a high quantity of objects share a common properties object to save space
  • Proxy pattern: a class functioning as an interface to another thing
  • Pipes and filters: a chain of processes where the output of each process is the input of the next
  • Private class data pattern: restrict accessor/mutator access

Introduction To Hive Hadoop

Hive is a powerful data warehousing application built on top of Hadoop which allows you to use SQL to access your data. This lecture will give an overview of Hive and the query language. This lecture includes a work-along exercise. The next video is a screencast of a user performing this exercise.

Cloudera Hadoop Training: Introduction to Hive from Cloudera on Vimeo.

Google URL Shortener - goo.gl

Today, I have just used the Google url shortener named "goo.gl". Like other Google products, it has a very simple, attractive user interface. The project is still beta, and Google will probably add more features in the future.

Fore more information: vist goo.gl

SOA Principles - Service Abstraction Principle


In SOA, by keeping specific details hidden, we protect the integrity of the relationship formed between a service and its consumers. Using abstraction, we allow the service business logic and its underlying implementation to evolve over time while continuing to fulfill its duties in relation to what was originally published in the service's contract.

In the real world, abstraction is really existed; For instance, when you want to buy a car, you don’t need to know everything about the engine and its internal components. Why? Because it will confuse you. Hiding unnecessary information from the buyer protects and simplifies the selling process. In SOA, the scenario is quite similar except we don’t have cars to sell, we have services to publish.

Why Service Abstraction is Needed?

The more details we publish in a service contract, the deeper coupling between service and consumers can become. Or in other words, less Abstraction means that the consumers are more awareness of the underlying service logic, technologies, and internal details of the service. Consequently, the service consumers will naturally judge on the service based on the metadata or extra information.

Another reason why Abstraction is required is to empower the service providers the freedom to enhance their services. By abstracting the implementation details from the service contract, the service provider can modify the underline logic without effecting the coupling between the published service and its consumers.


Design Characteristics

Providers hide unnecessary information (underlying technology, logic, internal constrains, etc) from the service consumers. The information altogether is hidden in a particular environment that may be accessed by the internal members of the service's organization.

Requirements

Providers need to spend more time on the design phase to concisely define the interaction requirements and public service constrains. This process can be integrated with a governance methodology.

Types of Metadata

In order to abstract non-essential metadata, we need to classify them first. Generally, there are four types of metadata in service oriented architecture:
Technology metadata
the metadata that declares the implementation technology of the service. Abstracting the technical metadata from the service contract reduces technology-to-contract coupling. An example of technology metadata is the underline implementation technology of the service such as "this service has been built using .Net technology and for implementation we used Visual Studio 2005".

However, some technical metadata are required to be published. For instance, How the service can be invoked?  What technology required to invoke the service? Is it SOAP or REST? Publishing these details does not affect the integrity of coupling. It just guides the consumers.



Systematic Logic metadata
The metadata that explains the underline logic and how it maintains its goals and capabilities. The underline design details (such as logging details, algorithms, database drivers, etc) are usually hidden from the service consumer. Without abstracting this metadata, a service consumer can easily become coupled to the low-level implementation of the service. Consequently, the service publisher may not be abile to modify or adjust the internal implementation.


Functional metadata
The metadata that explains the functional scope of the service. A function scope determines  service's capabilities that are made publicly available through the service contract. In OOP, API often abstracts and maintains a set of generic functions  considered those most likely to be used to clients that may need to develop an application capable of connecting with the product,  In SOA, the technical contract is the service API.



Quality of Service metadata
In the field of computer science, the Quality of Service (QaS) term refers to resource reservation control mechanisms rather than the achieved service quality. Similarly, In SOA, it refers to the behavioral, runtime polices, reliability-related information about the service.

Web service policies are a common form of service description document that explains the QaS of the XML service. Depending on the runtime environment and the capabilities of the hosting service provider, the qulity of service metadata may need to be placed in the non-technical service document. or SLA (Service Level Agreement).

Like other metadata, it is a good idea to publish some of the Quality of Service metadata to the service consumer. An example of the Quality of Service metadata is 'the availability of the service' as shown:

WebP, a new image format for the Web


As part of Google’s initiative to make the web faster, over the past few months we have released a number of tools to help site owners speed up their websites. We launched the Page Speed Firefox extension to evaluate the performance of web pages and to get suggestions on how to improve them, we introduced the Speed Tracer Chrome extension to help identify and fix performance problems in web applications, and we released a set of closure tools to help build rich web applications with fully optimized JavaScript code. While these tools have been incredibly successful in helping developers optimize their sites, as we’ve evaluated our progress, we continue to notice a single component of web pages is consistently responsible for the majority of the latency on pages across the web: images.

Most of the common image formats on the web today were established over a decade ago and are based on technology from around that time. Some engineers at Google decided to figure out if there was a way to further compress lossy images like JPEG to make them load faster, while still preserving quality and resolution. As part of this effort, we are releasing a developer preview of a new image format, WebP, that promises to significantly reduce the byte size of photos on the web, allowing web sites to load faster than before.

Images and photos make up about 65% of the bytes transmitted per web page today. They can significantly slow down a user’s web experience, especially on bandwidth-constrained networks such as a mobile network. Images on the web consist primarily of lossy formats such as JPEG, and to a lesser extent lossless formats such as PNG and GIF. Our team focused on improving compression of the lossy images, which constitute the larger percentage of images on the web today.

To improve on the compression that JPEG provides, we used an image compressor based on the VP8 codec that Google open-sourced in May 2010. We applied the techniques from VP8 video intra frame coding to push the envelope in still image coding. We also adapted a very lightweight container based on RIFF. While this container format contributes a minimal overhead of only 20 bytes per image, it is extensible to allow authors to save meta-data they would like to store.

While the benefits of a VP8 based image format were clear in theory, we needed to test them in the real world. In order to gauge the effectiveness of our efforts, we randomly picked about 1,000,000 images from the web (mostly JPEGs and some PNGs and GIFs) and re-encoded them to WebP without perceptibly compromising visual quality. This resulted in an average 39% reduction in file size. We expect that developers will achieve in practice even better file size reduction with WebP when starting from an uncompressed image.

To help you assess WebP’s performance with other formats, we have shared a selection of open-source and classic images along with file sizes so you can visually compare them on this site. We are also releasing a conversion tool that you can use to convert images to the WebP format. We’re looking forward to working with the browser and web developer community on the WebP spec and on adding native support for WebP. While WebP images can’t be viewed until browsers support the format, we are developing a patch for WebKit to provide native support for WebP in an upcoming release of Google Chrome. We plan to add support for a transparency layer, also known as alpha channel in a future update.

We’re excited to hear feedback from the developer community on our discussion group, so download the conversion tool, try it out on your favorite set of images, and let us know what you think.

Posted by Richard Rabbat, Product Manager

Oracle Exalogic - a New Revolutionary Solution

I always believed adding layers into information system adds more complexities to the internal infrastructure. Today, Oracle started working on a new revolutionary solution that integrates hardware and middleware together. Named Oracle Exalogic.
Both of layers have been engineered together for maximum performance with minimum set-up and minimum operational cost. It allows different components of a Java application to interact with essentially zero-copy I/O, enabling as much as 12x improvement in handling workloads such as Web requests!! More..

Oracle's Plans for Sun

SUN CUSTOMERS

Source: http://www.oracle.com/features/suncustomers.html

WS Stack Comparison

If you don't know which WS stack tools you should use in java, this document will certainly help you.

Introduction to Metro

Using Excepnsive Technologies - No more!!

Oracle Corporation

I remember myself two years ago when I was using all new technologies from Oracle to build applications for my company, IraqCom. I have to admit that was inconsequential and I could used some open source tools to save thousands of dollars. I wanna share this lesson with you guys, so I upload Oracle price list to the blog.

Please, check it and think about it before using it. Finally, burn these words into your brain! THERE ARE ALTERNATIVES.



Service and Extension Pattern

In component-base system, we always try to decouple components from each other. Sometime, decoupling process becomes a little bit expensive. In this article, I will talk about a simple approach that can be used for decoupling components, service and extension point pattern.

Why OOP inheritance should not be used?

Service and extension point pattern is similar to general OOP inheritance, but unlike OOP inheritance, it doesn't tight the components with each other. You usually use this pattern when you have a service-provider scenario. For example, suppose component “A” and “B” are in a small HR application called HRTest, component "A" is a module that displays employee information, and component "B" manages data source providers for the application. Data providers can come from different resources like database, web services, or even normal files. As you can conclude, "A" requires at least one provider in order to display employee information to the end user, and B provides the implementation for A's requirements. Using normal inheritance doesn't give a flexible solution because providers may only be exist at runtime, also more than one components can provide the "A" service interface. For instance, "B" and "C". In addition, for some reasons, "C" may be removed at a certain execution point.


Class A{
.
.
.
public void getData(number empID){
ServiceProvider[] service = getService();
}

public ServiceProvider[] getServices(){
getProviderB(); // Get B data provider
getProviderC(); //Get C data provider
.
.
.
}
}


As the preceding example shown, "A" is tightly dependent on "B" and "C." Because, when a new provider such as "D" is added or an old one is removed, "A" should be adjusted.

In such above scenario, service and extension pattern can be used to solve this issue in the flexible manner.

Service and Extension Pattern:

Service and Extension Pattern is commonly used approach in RCP platforms like NetBeans and Eclipse for sharing objects and providing implementation for extension points. Extension point (sometimes is called Service Interface) is a simple interface that a component can define in order to be implemented by other component, which is called Implementation provider or simply Provider. An extension point can have more than one provider at runtime and both providers and service modules should not know each other. To clear the misconception between them, the figure below shows a general structure of the pattern


As the figure demonstrated, Component “A” defines an extension point which “B”, “C” and “D” implement at runtime. Note, because extension point is used by all modules, it should be shared. Therefore, it is highly recommended to encapsulate it in a separate component creating a new abstract layer between them.

What is next?

In the next post, we will implement this pattern using NetBeans Lookup API.

Thanks for your reading.

IoC Pattern

Yesterday, I took a glance at IoC pattern. I found implicitly interesting article about this pattern and the most interesting article is from java.net as well as martinfowler.com . I hope you guys like it.

Event-Listener Pattern

In lossy-couple environment, notification system is essential, because it allows two or more lossy-couple components to communicate and notify each other when an event is triggered. There are several patterns to implement notification system in Java and one of them is event-listener pattern.

In Java, building event-listener components is not easy as Flex or C#. It requires a lot of boilerplate code to implement it. In this article, I will talk about building simple event listener in Java. First I will demonstrate the general algorithm for event listeners then I will implement it in a simple, humble example.

Event-Listener Pattern:

Event-Listener pattern is a simple pattern that can be implemented easily in Java bean class. Actually, it is part of JavaBean conventions. It has been used mainly in J2SE platform, particularly in GUI libraries. This pattern consists of two main parts (Source and Listener):

  1. Source: the source is the Java class for maintaining the event listeners which has previously been registered - It is like a small database . Therefore, the source class has method for registering (add) and unregistering (remove) listeners to the small database. The source also has ability to fire an event.
  2. Listener: As the name refers to, the listener is the Java component that interests in a specific event. When an event is triggered, all listeners interested in the event will get a notification and will execute their own event handler codes. Listeners register for events using the methods defined by the sources of those events.

What is share between these two parts is listener event message! The message is usually interface used to determine event data-type.

Sample:

Now, we are going to write a simple implementation for the pattern, so let's start with the source part.

First of all, we need a simple bean class. I will name it “SourceClass”:

class SourceClass {

}


Then we need a data structure to store the listeners (Remember, the small database). For simplicity, I will use Vector
private Vector listeners = new Vector();
Now, we need two methods, one of them for registering and the other unregistering, they should have JavaBean conventional style. The method used to register a listener in the vector must use the prefix “add”, and the other one, must start with the prefix “remove”. Both of them should follow by the event type and must end with the postfix “Listener”. In addition, they should have an argument with event data-type
public void addTestEventListener(TestEvent l) {
listeners.addElement(l);
}

public void removeTestEventListener(TestEvent l) {
listeners.removeElement(l);
}
As the preceding example depicts, the two methods manage the listeners which interest in "TestEvent" Event.

For simplicity, a simple fire method will be added to notify all registered listeners

public void fire() {
Vector temp = (Vector) listeners.clone();

for (int i=0; i > l.size(); i++) {
TestEventListener listeners = (TestEventListener) temp.elementAt(i);
listener.eventHandler ();
}
}

Now, let's define our event, which simply extends EventListener interface in the Java util package
public interface TestEvent extends java.util.EventListener {

void eventHandler();
}
So as you see, the event is nothing than a simple, share interface between the source and listeners.

Finally, we need a simple listener which listens to our TestEvent. Remember, listener can be any class you want. The only thing is required to become a listener is creating a SourceClass and adding the event (TestEvent).
.
.
.
SourceClass c = new SourceClass();
TestEvent e = new TestEvent(){
void eventHandler(){
//Do something
}
}
c.addTestEventListener(e);

c.fire();
As the codes shown above, SourceClass and TestEvent objects have been created. of course, we have to resolve all abstract methods in TestEventListener interface and the last not the least, we add the later object to the source.

when the source fires the
TestEvent, listeners gets a notification and will execute their event handler code.

Conclusion:

Event-Listener Pattern provides simple notification system for Java components. The pattern has two main parts (Source and Listener). The source stores all listeners, and the listeners listen to particular event, which is simply the message or notification that transports from source to listeners.

Further Reading:

Google Toolbar Platform

Now, Thanks to Google Toolbar, you can create a custom button that can run almost in every well-known browser.

For more information, click here.

Adobe Firework + Flash Catalyst

This demonstration demonstrates how Adobe Firework can be used in Flash Catalyst

Interesting Article: Systems Architecture

A very unique article talks about Systems Architecture in general, and SOA in specific. Furthermore, It explains the evolution in Software Architecture.

Excellent job Duane Nickul.

Linux Yahoo Messanger + Voice + Webcam


Many Linux users have got some problems with Yahoo messenger. Since official release does not provide new feature like VOIP + Webcam. Fortunately, You can install unofficial version called (Gyachi) which supports almost all the features including: photo sharing, voice chat, file sharing, group chat, my yahoo page , etc.

To setup, choose and download your appropriate package:

Ubuntu Jaunty packages:
gyachi_1.1.70-1~jaunty_i386.deb
gyachi_1.1.70-1~jaunty_amd64.deb

Ubuntu Intrepid packages:
gyachi_1.1.70-1~intrepid_i386.deb

gyachi_1.1.70-1~intrepid_amd64.deb

Ubuntu Hardy packages:

https://launchpad.net/%7Eloell/+arch…ntu11_i386.deb

Or visit the official website ; click here.

Check Out OTN Virtual Developer Day Records

Don't miss these fantasting demonstrations from OTN. Click here

JDeveloper's memory Problems

I've always got some overhead memory problems since JDeveloper 10g. Finally, I have found a new way to reduce JDeveloper's consuming memory. Check out this link

Adobe Flash Catalyst Changes Everything


Adobe Flash Catalyst is a new tool which has been released recently by Adobe. It bridges the Flex and Flash world into one interaction tool. It connect CS 4 tools with each other, and off course it provides a very convenient way to connect developers and designers together. Therefor, now, designers can make GUI in Adobe Photoshop or Illustrator, then transform their artwork into functional user interface. Furthermore, you can create interactive prototype, which is quite important in development life cycle.


Anther thing I want to mention, unlike Flex, Flash Catalyst do not require learning any new language, it has an interactive interface, and it makes sure your creative vision is perfectly expressed.

Anyhow,I hope everyone will try it. You can download from adobe lab website or click here.

Introduction Demo:



Further Reading: