|
From: Cristi P. <cri...@cr...> - 2006-03-25 13:09:50
|
Thank you very much for your reply!=20
When I started to work on 'wedge' my objective was to have a framework
does not require either specific page class hierarchy or cluttered
templates.=20
The solution I came up with for achieving this was to have "the missing"
code generated. First, I used javassist to create and load classes at
runtime. I rapidly realized that this is not such a good idea because:
1. The generated code is invisible to the developer. Any exception that
you get at runtime would be hard to debug if it occurred within this
generated code. 2. There are a few limitations when using javassist. For
instance, it does not supports inner or anonymous classes. 3. Class
loading problems that may occur within a web container environment.
Although I would like very much to come with a 'cutting [w]edge' web
framework, I believe that it is more important to have that attitude
that will keep us moving further. Wicket came up with a good change of
view and perspective on java web development. As I studied some wicket
example I was impressed by the simplicity of the xhtml templates and the
elegancy of the java classes. Still, I try move things a little bit
further. I want also to have clean java code, that is, to minimize the
dependency of the application to the framework. In a wedge application,
the framework takes your code and integrates it within its generated
classes. In wicket applications you build your pages using specific
framework components into the java code. That impose the creations of a
lot of java objects, one for each component. For instance, take this
example:
In wicket:
this.add(new Label("message", "Hello World!"));
<span wicket:id=3D"message">Message goes here</span>
This code must create a tree of components the must be synchronized with
the template and rendered by passing through it recursivly.
---------------------
In wedge:
public String getMessage() {
return "Hello world!";
}
<span wid=3D"w:insert" value=3D"ognl:message">The message</span>
This gets translated into:
render("<span >");
render(usrComp.getMessage());
render("</span>");
---------------------
As you can see, only a instance of the object behind the page is needed.
The component (w:insert) is translated into code. All wedge components
are translated into code and will not do any action at runtime.
Embedding your code into the framework code frees your applications from
compatibility breaking with future versions of wedge. If your
application consists of pages that are simple POJO's than framework
improvements for performance and clarity of the generated code will not
affect the application code. And I think this is good thing. Backward
compatibility is something that makes evolution of frameworks slower.
Yes, you need to restart the application and regenerate the code as you
make changes to the pages. But:=20
1. I use jetty as an embedded server which is very practical and rapid
way to develop application. It does not take to much time to restart the
server.
2. I've made the ANT task only for generating the pages. The generation
requires all the application to be on the class path such that I start a
new java process to do that. This takes time, about 5 sec for my 5 pages
app. With the following code the time reduces to 1 sec.
String base =3D "D:/PROJECTS/wedge/wedge.test.site/";
=09
WedgeCodeGenerator codeGenerator =3D WedgeCodeGenerator.getInstance();
String webRoot =3D base + "web";
codeGenerator.setWebRoot(webRoot);
String sourceRoot =3D base + "wdg/src";
codeGenerator.setSourceDir(sourceRoot);
String wedgeApp =3D "wedge-application.xml";
String appSpec =3D webRoot + "/WEB-INF/" + wedgeApp;
codeGenerator.setWedgeApplication(appSpec);
codeGenerator.generateFiles();
3. If I refresh the eclipse project folder, the eclipse compiler
compiles the files much faster than ANT.
4. An eclipse plug-in would be quite helpful! (Note that the simplicity
of the framework will make possible to have a powerful enough IDE
plug-in)
About defaults and conventions, I have been thinking to introduce them.
But still, I need a way to figure out which spring beans are wedge
components and which are not. More, you are not bound to spring, you can
simply specify the class directly. For the file attribute, you can
specify any kind of path that XmlWebApplicationContext can manage. The
file name is not always suitable for being an id. Anyway, you are right,
if is possible, that the developer should have the possibility to use
this conventions.=20
Unfortunately I do not see how I can make the wedge framework to work
without any kind of information source. Anyway, the amount of xml will
be kept to the minimum.
Thank you very much for your interest and I will try that a.s.a.p to
have a first release and more documentation.
Help on developing is really needed! If there is anyone interested,
please contact me!
Cristian
-----Original Message-----
From: spr...@li...
[mailto:spr...@li...] On Behalf
Of Seth Ladd
Sounds like an interesting project. Can you compare to Wicket
(http://wicket.sourceforge.net/) ?
The one concern I have is, how quick is it to test changes to the code?
From the impression I get, if I want to make a change to a page, I need
to shut down the application and restart it so that the ANT task can
recompile the page classes?
IMHO, a really cutting edge Java web application framework would require
absolutely zero shutdown and restarts of either the servlet container or
the servlet context itself. Do you happen to plan on attacking the
"constant redeploy" problem?
Also, not sure if it does already, but does the configuration support
sensible defaults, or conventions? A really cutting edge Java web app
framework would be able to run with zero XML.
For instance, given your example:
<application>
<page id=3D"home" file=3D"home.html" springBean=3D"home" />
</application>
I would image the default rule would be: "convert home.html to 'home'
and find the matching bean by name". In other words, don't make me
write the above XML when it's obvious what I am declaring. :)
Seth
On 3/24/06, Cristi PASCU <cri...@cr...> wrote:
> Hi everybody!
>
> My name is Cristian Pascu and I am developing an opensource project=20
> named "wedge" (http://wedge.sourceforge.net) which is a component=20
> centric web framework built on Spring.
> It is similar to Tapestry and aims to provide some features that are=20
> not yet available in Tapestry. Namely:
> * better and easier integration with Spring.
> * simple POJO classes behind clean xhtml pages. There is no=20
> need to extend specific framework classes. The classes are easy to=20
> test as they are easy to instantiate and configure.
> * all page classes may be managed by Spring inversion of=20
> control container. This way, services from the business tier will be=20
> injected in the presentation tier.
> * a simpler component/pages specification. There should be a=20
> single configuration file and not one for each component.
> * the configuration of the application should be very simple,=20
> one xml file with few tags and attributes. Much of the configuration=20
> will be on the spring side.
>
> Most of these features are already implemented. There is still some=20
> work to do on the validation mechanism. The upload support is also=20
> missing but is not to hard to implement.
>
> But what differentiate the wedge framework from tapestry framework is=20
> that instead of using runtime reflection it follows the "code=20
> generation" paradigm. Let me be more specific: The connection between=20
> the template and the class behind it is made through an intermediary=20
> generated class that binds the two. Thus, the generated code "knows"
> exactly which is the structure of the template, that components to=20
> render, what classes to use and what methods to call at the right
time.
> The generation is done with an ANT task each time before the=20
> application is started.
>
> If you have any thoughts on what I am trying to do, critics or=20
> advices, all are welcomed!
>
> Do you think that such a framework is needed?
> Do you think that my approach is a good one?
>
> Thank you very much!
>
> Cristian
>
>
> PS: There is not any release yet. You may check out the project from
> sourceforge: https://svn.sourceforge.net/svnroot/wedge
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting=20
> language that extends applications into web and mobile media. Attend=20
> the live webcast and join the prime developer group breaking into this
new coding territory!
> http://sel.as-us.falkag.net/sel?cmdlnk&kid=110944&bid$1720&dat=121642
> _______________________________________________
> Springframework-developer mailing list=20
> Spr...@li...
> https://lists.sourceforge.net/lists/listinfo/springframework-developer
>
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting
language that extends applications into web and mobile media. Attend the
live webcast and join the prime developer group breaking into this new
coding territory!
http://sel.as-us.falkag.net/sel?cmd=3Dk&kid=110944&bid$1720&dat=121642
_______________________________________________
Springframework-developer mailing list
Spr...@li...
https://lists.sourceforge.net/lists/listinfo/springframework-developer
|