title: design pattern for parent-child structure
body: <p>I'm working on a project using JavaFX and classes have typically as many as 800-1200 lines . We are using fxml for displaying Node elements, still this classes are very complex. Here is concretely what I ask:</p>
  
  <p>A class <code>ReservationUI</code> contains sub parts  , which are modulerized as inner classes at the moment.which again has sub parts. And this classes has access to fields of <code>ReservationUI</code> . Now I like to extract them to their own classes but now I need to have access to parent class .</p>
  
  <pre><code>class A{
    int x; int y;
    B b;
    public A(){
      b = new B();
      b.display();
    }
    private class B{
      private C c;
     /* modify x */ 
    }
  
    private class C{ 
    /* modify x and y */
    }
  }
  </code></pre>
  
  <p>And when i extract them now I have dependencies even worse :</p>
  
  <pre><code>class A {
  int x; int y; 
  B b;
    public A(){
      b = new B(this);
      b.display();
    }
  }
  class B {
    C c;
    A a;
    public B ( A parent ){ 
    c = new C(this, parent);
    a = parent;
    /* call A.modifyX(c.get) */
  }
  
  class C{
    A a;
    B b;
    public C( B parent , A root){
     a = root;
     b = parent;
    }
  }
  </code></pre>
  
  <p>What I think is here the modularization is gone terribly wrong. Especially when I have relations long as this one : root -> child -> child -> child ... . </p>
  
  <p>Is there a design pattern to address this issue. As far as I know there is Mediator pattern but use of it, still doesn't bring much since I still need to basically do the same thing .</p>