samedi 30 janvier 2016

Combine separate entities in one such that they are not tightly coupled

I am initiating a process to create something that process is further divided into 4 step and each step represents a class , i have separated all 4 step by considering Single responsibility principle.each class is composed of set get methods . so far my code is

public class manipulator{

private A a;
private B b;
private C c;
private D d;

public manipulator(){
a= new A();
b= new B();
c= new C();
d= new D();
}
//getters and setters of all 4steps
}

manipulator is main class that contains all 4 steps , each step in constructor is further initiated but i am considering this as tightly coupled system as there are initiating inside constructor . How should i engage interface in it to provide abstraction and to make it loosely coupled.

Any help will be greatly appreciated.

Aucun commentaire:

Enregistrer un commentaire