Skip to content

Instantly share code, notes, and snippets.

@practicingruby
Created July 29, 2012 14:27
Show Gist options
  • Select an option

  • Save practicingruby/3199223 to your computer and use it in GitHub Desktop.

Select an option

Save practicingruby/3199223 to your computer and use it in GitHub Desktop.
class A {
private B b;
private C c;
private D d;
private E e;
public A () {
b = new B ();
c = new C ();
d = new D ();
e = new E ();
}
public void badStyle() {
b.getD().getE().display();
}
}
class B {
private C c;
private D d;
public B () {
c = new C ();
d = new D ();
}
public D getD() {
return d;
}
}
class C {
}
class D {
private E e;
public D () {
e = new E ();
}
public E getE() {
return e;
}
}
class E {
public void display() {
System.out.println("Hello from E!");
}
}
class Main {
public static void main (String[] args) {
A a = new A ();
a.badStyle();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment