Friday, December 25, 2009

Re: Code Split and Superclasses.

Correction, the splitter looks like this:

public class GenericSplitter {

HashMap providers; // populated with Aprovider and Bprovider

public void onSplit {
GWT.runAsync(new RunAsyncCallback(){
...
onSuccess(){
MySuperclass sup = providers.get( AorBparam ).get();
sup.doGeneric();
}
}
}

}

On Dec 25, 12:00 pm, Tristan <tristan.slomin...@gmail.com> wrote:
> Here is an example I am trying to code split:
>
> public class MySuperclass {
>
>   public abstract doSpecific();
>
>   public void doGeneric(){
>     doSpecific();
>   }
>
> }
>
> public class A extends MySuperclass {
>
>   public doSpecific(){
>     // do something for A
>   }
>
> }
>
> public class B extends MySuperclass {
>
>   public doSpecific(){
>     // do something for B
>   }
>
> }
>
> The fun part happens when I do something to code split A and B.
>
> public class Splitter {
>
>   public void onSplitA {
>     GWT.runAsync(new RunAsyncCallback(){
>       ...
>       onSuccess(){
>         A a = providerOfA.get();
>         a.doGeneric();
>       }
>     }
>    }
>
>    public void onSplitB {
>      GWT.runAsync(new RunAsyncCallback(){
>        ...
>        onSuccess(){
>          B b = providerOfB.get();
>          b.doGeneric();
>        }
>       }
>     }
>
> }
>
> The SOYC has the following dependencies resulting in a trivial split
> (the method itself is split, but A and B are downloaded in initial
> download):
>
> A.doGeneric() -> MySuperclass.doGeneric -> B.doSpecific();
> also
> B.doGeneric() -> MySuperclass.doGeneric() -> A.doSpecific();
>
> I think I understand why that happens. But is this the desired
> functionality? Is there no way to add state information to the code
> splitter to determine which of the classes are calling the generic?
> This severely hinders code reuse. Is there a different pattern I
> should use?
>
> Thanks, Tristan

--

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate