General Responsabilty Assignment Software Patterns
1. Information Expert
2. Creator
3. Controller
4. Low Coupling
5. High Cohesion
6. Indirection
7. Polymorphism
8. Pure Fabrication
9. Protected Variations
Set of rules regarding object-oriented programming :
public class Firm {
private ArrayList<Employee> ListEmpl=new ArrayList<Employee>();
public String toString() {
String DisplayList="";
for (int i = 0; i < ListEmpl.size(); i++) {
int j=i+1;
DisplayList=DisplayList +j+". "+ListEmpl.get(i)+"\n";
}
return DisplayList;
}
}
B contains A, B uses most of A's features, B can initialize A
class Shape {
public void draw(){
}
class Square extends Shape{
public void draw(){
//code to draw a square
}
}
class Circle extends Shape{
public void Draw(){
//code to draw a Circle
}
}
}