Yes, but aren't appservers/classloaders smarter about that these days?
Richard
Geoff Longman wrote:
Thing is, doesn't one have to recompile and redeploy in order to change things?
Geoff
On 5/30/05, Richard Lewis-Shell <[EMAIL PROTECTED]> wrote:
I was actually thinking of nested annotations to declare a component.
Using your example:
public class ContactBookEditor extends BaseComponent
implements PageBeginRenderListener {
@Parameter(type=ParameterType.REQUIRED) private ContactBook book;
@Property(persistence="session") private Set selectedPersons;
@Property private ContactPerson iteratedPerson;
@Property private String newPerson;
@Component(@Binding(name="value", expression="name")) private
TextField name;
@Component(@Binding(name="source", expression="book"),
@Binding(name="value", expression="iteratedPersion")) private Foreach
personLoop;
@Component(@Binding(name="value", expression="iteratedPerson"))
private iteratedContactPerson;
...
}
The syntax there is not so great, but I am sure with some pretty
printing it would be no worse than XML, and of course, being all in one
place, it should be an improvement.
Note that I know very little about annotations - only enough to be
dangerous, as my following suggestion might show:
What if each component defined its own binding annotations? Then we
might simplify the above to:
@Component(@NameBinding("name") private TextField name;
@Component(@SourceBinding("book"),
@ValueBinding("iteratedPersion")) private Foreach personLoop;
@Component(@ValueBinding("iteratedPerson")) private
iteratedContactPerson;
Richard
Joni Suominen wrote:
Richard Lewis-Shell <rlewisshell <at> mac.com> writes:
I like the look of this. Any plans to attempt component declaration
using annotations? Might be ugly, but then, IMO, so are implicit
template components...
Actually, we only use implicit components so I haven't thought about
this. We tend to use quite a lot of components, in a current project
we have ~80 pages and ~140 custom components (both fine-grained and
coarse-grained). That's why an easy way to pass parameters, and an
easy way use components is very important. Naturally this style
requires a good tool support (like Spindle plugin which can do some
static validations). To improve the testability and refactorability of
Tapestry applications is currently the biggest motivation behind the
annotations extension. Our ui layer test coverage is merely 10-15%,
whereas the other application layers enjoy 90-100% test coverage. It
is quite easy to test the listener methods after getting rid of XML
and abstract classes. It is also easier to refactor without abstract
classes (the compiler does not warn if an abstract class do not
implement interface methods etc.) and XML file.
I agree that declaring components using annotations might be quite
messy eventually. How about doing it in Java? Something like:
public class ContactBookEditor extends BaseComponent
implements PageBeginRenderListener {
@Parameter(type=ParameterType.REQUIRED) private ContactBook book;
@Property(persistence="session") private Set selectedPersons;
@Property private ContactPerson iteratedPerson;
@Property private String newPerson;
...
public void initComponents(IRequestCycle cycle) {
TextField name = new TextField();
name.setValue(getNewPerson());
addComponent("nameField", name);
Foreach personLoop = new Foreach();
personLoop.setSource(getBook().getContactPersons());
personLoop.setValue(getIteratedPerson());
addComponent("personLoop", personLoop);
Insert iteratedContactPerson = new Insert();
insertContactPerson.setValue(getIteratedPerson());
addComponent("iteratedContactPerson", iteratedContactPerson);
}
}
This would propably require some changes to core framework, though.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]