You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Jeremy Boynes <jb...@apache.org> on 2006/04/06 18:17:06 UTC
When is a JavaBean good enough?
I have to ask this question ... looking at the assembly model for the
JSON-RPC binding it follows the conventions used elsewhere and defines
an interface for the model object, implementation, factory, factory
implementation. However, the actual implementation is extremely simple:
public class JSONRPCBindingImpl
extends BindingImpl
implements JSONRPCBinding {
protected JSONRPCBindingImpl() {
}
}
I know there are sound software design practices about separating
interface and implmentation, yada, yada, but this seems like a lot of
overhead for something so simple.
In the interests of simplicity (and now we will have a SDO
implementation that can load POJOs), how about we lower the entry
threshold and say it's OK for extension providers to use JavaBeans?
--
Jeremy
Re: When is a JavaBean good enough?
Posted by Paul Fremantle <pz...@gmail.com>.
Jeremy
You wan't to watch out. You might end up saying the whole programming model
is just JavaBeans :-)
Paul
On 4/7/06, Jeremy Boynes <jb...@apache.org> wrote:
>
> Jean-Sebastien Delfino wrote:
> > Isn't this already allowed? I didn't think that the runtime actually
> > forced you to implement your model extensions as interfaces +
> > implementations... or are we talking about the best practice that we'd
> > like to promote here?
> >
>
> It works once SDO can use POJOs - before using SDO to load directly
> would have required interfaces and codegen (hence the dual model we had).
>
> "Best" practice may be a bit strong - I'm really talking about
> "good-enough" practice and balancing flexibility etc. vs. making it easy
> for people to add their extensions to the model.
>
> I'm for making it easy for them and would suggest we simplify some of
> the existing extensions so that they are easier to understand (e.g. by
> converting them to using JavaBeans).
>
> --
> Jeremy
>
--
Paul Fremantle
VP/Technology, WSO2 and OASIS WS-RX TC Co-chair
http://bloglines.com/blog/paulfremantle
paul@wso2.com
"Oxygenating the Web Service Platform", www.wso2.com
Re: When is a JavaBean good enough?
Posted by Jean-Sebastien Delfino <js...@apache.org>.
Jeremy Boynes wrote:
> Jean-Sebastien Delfino wrote:
>
>> Isn't this already allowed? I didn't think that the runtime actually
>> forced you to implement your model extensions as interfaces +
>> implementations... or are we talking about the best practice that we'd
>> like to promote here?
>>
>>
>
> It works once SDO can use POJOs - before using SDO to load directly
> would have required interfaces and codegen (hence the dual model we had).
>
I'm not sure I understand what you mean by "it works once SDO can use
POJOs".
Before switching to use StAX loaders:
(a) SDOs could already be generated without interfaces using the
-noInterfaces option (the Bigbank sample actually already did that)
(b) The logical model was a POJO model and didn't require interfaces on
extensions AFAIK.
After switching to the StAX loaders and Frank's model proposal:
(a) and (b) are still true
(c) the SDO codegen is getting improved to generate simpler code with no
dependencies on EMF and with some new codegen options no dependencies on
SDO, but that's a different story.
If the question is: Do you want to implement your jsonrpc binding like this?
public interface JSONRPCBinding extends Binding {
}
public class JSONRPCBindingImpl extends BindingImpl implements
JSONRPCBinding {
public JSONRPCBindingImpl() {
}
}
or like this?
public class JSONRPCBindingImpl extends BindingImpl {
public JSONRPCBindingImpl() {
}
}
... then both are possible, before and after the SDO changes.
> "Best" practice may be a bit strong - I'm really talking about
> "good-enough" practice and balancing flexibility etc. vs. making it easy
> for people to add their extensions to the model.
>
> I'm for making it easy for them and would suggest we simplify some of
> the existing extensions so that they are easier to understand (e.g. by
> converting them to using JavaBeans).
>
> --
> Jeremy
>
>
Again the current design allows both options, interface+impl or just
impl. Extension developers have a choice, but if they just provide impl
classes they need to realize that they're closing the door to a number
of options:
- alternate implementations of their model in tooling and/or admin
environments, having interfaces allows all the other code to work with
these alternate implementations
- alternate implementations of the same extension model by multiple
providers, for example the container.axis2 and container.celtix projects
may need to implement the WebServiceBinding interface differently at
some point?
- integration with the metadata API, their model may have to be exposed
to application code through the metadata API, and even included in the
SCA spec maybe? I'm not sure that they'll want their implementation
classes to be exposed directly.
So I'm ok with changing one or two sample extension models to just impl
classes if people think it really make a difference. I am not in favor
of changing the "core" ones (Java component type and Web service binding).
--
Jean-Sebastien
Re: When is a JavaBean good enough?
Posted by Jeremy Boynes <jb...@apache.org>.
Jean-Sebastien Delfino wrote:
> Isn't this already allowed? I didn't think that the runtime actually
> forced you to implement your model extensions as interfaces +
> implementations... or are we talking about the best practice that we'd
> like to promote here?
>
It works once SDO can use POJOs - before using SDO to load directly
would have required interfaces and codegen (hence the dual model we had).
"Best" practice may be a bit strong - I'm really talking about
"good-enough" practice and balancing flexibility etc. vs. making it easy
for people to add their extensions to the model.
I'm for making it easy for them and would suggest we simplify some of
the existing extensions so that they are easier to understand (e.g. by
converting them to using JavaBeans).
--
Jeremy
Re: When is a JavaBean good enough?
Posted by Jean-Sebastien Delfino <js...@apache.org>.
Jeremy Boynes wrote:
> Frank Budinsky wrote:
>
>> I'm +1 on allowing simple beans, but I have to ask the obvious question of
>> how many binding types do we have that require absolutely no additional
>> data. If this is common, then shouldn't it be even easier ... i.e., don't
>> require them to even create a class, but instead simply specify a name,
>> for example.
>>
>>
>
> I think this one is atypical and will probably get more complex as the
> JSON binding develops. The Axis2 binding has three properties, the Java
> implementation one, the JavaScript implementation four.
>
> All add just one model object to represent the element they override.
>
> So present experience shows these to be fairly simple and I think that
> may be true for many of the extensions. It may not be true for all but
> there's nothing to prevent more complex implementations from doing more
> sophisticated things.
>
> For example, the core model is relatively complex and having a factory
> allowed us to easily add a bunch of helper methods for creating sub-trees.
>
> --
> Jeremy
>
>
Isn't this already allowed? I didn't think that the runtime actually
forced you to implement your model extensions as interfaces +
implementations... or are we talking about the best practice that we'd
like to promote here?
--
Jean-Sebastien
Re: When is a JavaBean good enough?
Posted by Jeremy Boynes <jb...@apache.org>.
Frank Budinsky wrote:
> I'm +1 on allowing simple beans, but I have to ask the obvious question of
> how many binding types do we have that require absolutely no additional
> data. If this is common, then shouldn't it be even easier ... i.e., don't
> require them to even create a class, but instead simply specify a name,
> for example.
>
I think this one is atypical and will probably get more complex as the
JSON binding develops. The Axis2 binding has three properties, the Java
implementation one, the JavaScript implementation four.
All add just one model object to represent the element they override.
So present experience shows these to be fairly simple and I think that
may be true for many of the extensions. It may not be true for all but
there's nothing to prevent more complex implementations from doing more
sophisticated things.
For example, the core model is relatively complex and having a factory
allowed us to easily add a bunch of helper methods for creating sub-trees.
--
Jeremy
Re: When is a JavaBean good enough?
Posted by Frank Budinsky <fr...@ca.ibm.com>.
I'm +1 on allowing simple beans, but I have to ask the obvious question of
how many binding types do we have that require absolutely no additional
data. If this is common, then shouldn't it be even easier ... i.e., don't
require them to even create a class, but instead simply specify a name,
for example.
Frank.
Jim Marino <ji...@gmail.com> wrote on 04/06/2006 12:34:21 PM:
> I like that +1
>
> On Apr 6, 2006, at 9:17 AM, Jeremy Boynes wrote:
>
> > I have to ask this question ... looking at the assembly model for the
> > JSON-RPC binding it follows the conventions used elsewhere and defines
> > an interface for the model object, implementation, factory, factory
> > implementation. However, the actual implementation is extremely
> > simple:
> >
> > public class JSONRPCBindingImpl
> > extends BindingImpl
> > implements JSONRPCBinding {
> >
> > protected JSONRPCBindingImpl() {
> > }
> >
> > }
> >
> > I know there are sound software design practices about separating
> > interface and implmentation, yada, yada, but this seems like a lot of
> > overhead for something so simple.
> >
> > In the interests of simplicity (and now we will have a SDO
> > implementation that can load POJOs), how about we lower the entry
> > threshold and say it's OK for extension providers to use JavaBeans?
> >
> > --
> > Jeremy
> >
>
Re: When is a JavaBean good enough?
Posted by Jim Marino <ji...@gmail.com>.
I like that +1
On Apr 6, 2006, at 9:17 AM, Jeremy Boynes wrote:
> I have to ask this question ... looking at the assembly model for the
> JSON-RPC binding it follows the conventions used elsewhere and defines
> an interface for the model object, implementation, factory, factory
> implementation. However, the actual implementation is extremely
> simple:
>
> public class JSONRPCBindingImpl
> extends BindingImpl
> implements JSONRPCBinding {
>
> protected JSONRPCBindingImpl() {
> }
>
> }
>
> I know there are sound software design practices about separating
> interface and implmentation, yada, yada, but this seems like a lot of
> overhead for something so simple.
>
> In the interests of simplicity (and now we will have a SDO
> implementation that can load POJOs), how about we lower the entry
> threshold and say it's OK for extension providers to use JavaBeans?
>
> --
> Jeremy
>