Tag Archives: design

SOA – a quick view


What is SOA?

SOA is standard based method of system development and integration

What are the benefits?

  • Reusability
  • Integration
  • Interoperability
  • Agile development
  • Scalability
  • Cost Efficient

What are all the ways to implement services?

  • Point to point approach
  • Vendor specific implementation
  • CORBA
  • Web services
  • SCA-style implementation

What are Services?

  • Building blocks of SOA
  • Interface and message structure definitions
  • Standard protocol for interoperability

What are SOA standards?


What is SCA [Service Component Architecture]?

SCA provides a programming model for building applications using SOA

What are the difference between SOA and SCA?

  • SOA is an approach or implementation style and SCA uses SOA to build a composite application
  • SOA is architectural style but SCA is assembly model and defines/design

What are the elements of SCA?

What is SDO [Service Data Object]?

  • Representation of data source in XML format and specifes methods to create, delete and modify data
  • Simplify and unify the way in which applications handles the data

What is EDN [Event Driven Network]?

  • To handle asynchronous messaging arising from a business event
  • Supports publish and subscribe model
  • Aligns with Event driven Architecture [EDA]



Advertisements

Database answers


Found this useful link for all your db design related queries

http://www.databaseanswers.org/data_models/index.htm

OODesign concepts


Some of the main oodesign principles are available here
I hope this will help developers understand the oo concept more efficiently.

http://www.oodesign.com/design-principles.html

Singleton pattern revisited


Singleton pattern

Definition: At any point of time we ensure that there is only object created for the class

Example:
participant classes:

  • Singleton.java
  • SingletonClient.java(client)

Diagram:

Singleton.java

  • This class includes a static member variable singleton with private scope
  • the constructor is private so that no one can instantiate it
  • we have a getCurrentInstance() method to instantiate the class. If the instance is already available then the instance is returned to the caller otherwise it is newly created
public class Singleton {

 private static Singleton singleton = null;

 private Singleton(){

 }

 public static synchronized Singleton getCurrentInstance(){
 if(singleton == null){
 return new Singleton();
 }
 else{
 return singleton;
 }
 }

 public void sayHello(){
 System.out.println("Hello");
 }
}

SingletonClient.java

use getCurrentInstance() method to get the instance of Singleton class and use it.

 public class SingletonClient {

 public static void main(String[] args) {

 Singleton singleton =  Singleton.getCurrentInstance();
 singleton.sayHello();
 }
}
 

contract:

cannot instatiate more than once.
getCurrentInstance() return only one instance at any point of time

Implementing Prototype pattern


Prototype pattern

Definition: the pattern is used to create a clone avoiding another creation. We clone the object if the cost of creating the object is expensive than cloning it.

Example:
participant classes:

  • Vinod.java
  • Rinku.java
  • Prototype.java
  • PrototpyeClient.java (client)

Diagram:


Prototype.java

This is an interface class defining signature for doClone() method. The return type is of Prototype type. This throws CloneNotSupportedException.

 public interface Prototype {
 public Prototype doClone() throws CloneNotSupportedException;
}

Vinod.java & Rinku.java

These are simple classes describing Vinod’s and Rinku’s characteristics. They have their attributes and their respective accessors defined in the class

These two classes implement the Prototype interface
doClone() method is implemented returning a new clone of the respective class

//Vinod.java
 public class Vinod implements Prototype,Cloneable{
 String name;
 String age;
 String sex;

 public String getName() {
 return "Vinod";
 }
 public String getAge() {
 return "25";
 }
 public String getSex() {
 return "Male";
 }
 @Override
 public Prototype doClone() throws CloneNotSupportedException {
 return (Prototype) this.clone();

 }

}

//Rinku.java

public class Rinku implements Prototype,Cloneable{
 String name;
 String age;
 String sex;

 public String getName() {
 return "Rinku";
 }
 public String getAge() {
 return "22";
 }
 public String getSex() {
 return "Female";
 }
 @Override
 public Prototype doClone() throws CloneNotSupportedException {
 return (Prototype) this.clone();

 }
}

PrototypeClient.java

Instantiating the objects and cloning the same

public class PrototypeClient {

 public static void main(String[] args) throws CloneNotSupportedException {

 Vinod vinod = new Vinod();
 Vinod vinod2 = (Vinod)vinod.doClone();

 System.out.println(vinod.hashCode() != vinod2.hashCode());
 System.out.println(vinod.getClass() == vinod2.getClass());

 }
}

contract:

x.clone() != x
x.clone().getClass() == x.getClass()