I've added support for JEXL and more...

143 views
Skip to first unread message

Jon Stevens

unread,
Sep 22, 2011, 5:13:09 AM9/22/11
to cambridge...@googlegroups.com
We are heavily using Cambridge and really love it.

It turns out that MVEL has really terrible support for null's, so Jeff and I are going to switch to JEXL. Hopefully third time is a charm.

Here is the commit:

I also cleaned up a bunch of minor Eclipse warnings (I prefer projects to always build cleanly per the broken windows theory) and fixed a couple errors in the pom.xml files.

I'm not quite sure how to transfer that to you. As much as I love googlecode and have a ton of projects on it myself, would you consider moving to github for your source control? It really offers a more collaborative approach to doing development. Pull Requests are the golden child of open source development.

thanks,

jon

Erdinc Yilmazel

unread,
Sep 22, 2011, 6:52:58 AM9/22/11
to cambridge...@googlegroups.com
This is great. I would appreciate if you can create a diff against the code in google code so I can look into merging it back. You can attach the diff here or send it to me directly.

Thanks

Jon Stevens

unread,
Sep 22, 2011, 1:01:38 PM9/22/11
to cambridge...@googlegroups.com
That diff I just sent should work against your google code stuff as
well. We've been keeping them in sync.

jon

Jeff Schnitzer

unread,
Sep 22, 2011, 1:27:33 PM9/22/11
to cambridge...@googlegroups.com
On Thu, Sep 22, 2011 at 2:13 AM, Jon Stevens <latc...@gmail.com> wrote:
>
> It turns out that MVEL has really terrible support for null's, so Jeff and I
> are going to switch to JEXL. Hopefully third time is a charm.

MEVL went from really exciting to really disappointing *fast*.
There's no way to enable null-safe gets as the default for property
navigation, so you end up having to type this all the time:

foo.?bar.?baz

This alone is annoying but not fatal. The fatal flaw is when you need
a null test for the root node:

?foo.?bar.?baz

This prouces an error because MVEL misinterprets the first ? as a
ternary operator. The guy maintaining MVEL flagged this case as Not a
Bug in jira. Fuck that. Why is it that all codehaus projects seem to
be disasters (arguably jackson being the sole exception)? Even the
infrastructure doesn't work - their mailing list system is horrid and
full of broken links.

Conclusion: Almost entirely because of lame null handling, MVEL is
not suitable as a web template expression language.

Jeff

Erdinc Yilmazel

unread,
Sep 22, 2011, 2:00:52 PM9/22/11
to cambridge...@googlegroups.com
Let's keep improving Cambridge EL guys ;) I really haven't put that much time on Cambridge EL so far.
I'm sure there is a big room for improvement.

In the mean time, I'm glad that JEXL is working good for you. Let me know if you need changes in Cambridge core to support every feature of it.


- Erdinc

Tom Carchrae

unread,
Sep 22, 2011, 2:07:42 PM9/22/11
to cambridge...@googlegroups.com
Conclusion:  Almost entirely because of lame null handling, MVEL is
not suitable as a web template expression language.

I spent some time using MVEL with Drools, which I believe is what gave birth to it.  While a nice idea, Drools (and MVEL) has a really high overhead.  So, great if you don't care about the cost of computing.  (eg, yay Enterprise boo Internet Startup)

Jeff/Jon - what is your criteria for a great scripting language?  I clearly see you care about a clean design, but I'm presuming you also care about performance?

My primary criteria are:

* designer friendly, eg, not broken markup (yay Cambridge), no or minimal code exposure - so simple logic (expression,if/for))
* high performance - templates can be compiled to bytecode (nice to have).  Eg, not Groovy.

In the past, I built optimization algorithms where we wanted to allow custom rules to be evaluated in the inner loop of the algorithm.  We looked at JEXL along with others (including Javascript) and ended up using Janino - for performance.  Janino was an efficient but ugly solution.  

(btw Edinc, Jeff is an awesome tool builder  (but reluctant - because he's building great software not tools! :) ) - he's part of several awesome projects that have improved my life.  I don't know as much about Jon, but he mentioned being part of the Velocity team.  These guys rock.)

Jeff Schnitzer

unread,
Sep 22, 2011, 2:27:57 PM9/22/11
to cambridge...@googlegroups.com
On Thu, Sep 22, 2011 at 11:07 AM, Tom Carchrae <t...@carchrae.net> wrote:
> Jeff/Jon - what is your criteria for a great scripting language?  I clearly
> see you care about a clean design, but I'm presuming you also care about
> performance?

I'm not overly concerned about performance as long as it's reasonable
(ie, not XSLT). Really I think we'd like something that is a cross
between JSP-EL and Velocity. Honestly I really like the Cambridge EL
except that it doesn't let us pass parameters to functions, which is
rather critical. Our problem areas have been:

NULL CHECKS

${foo.bar.baz} should produce null if any part of the chain is null.
This is super common in web templating, for example we have stuff like
this:

class Location {
String name;
GeoPt geo;
}
class Person {
Location location;
}

For some users, the location field is null... I don't want to have
special syntax for this nullability check.

METHOD CALLS

This just makes life easier. For example, we have a Person object on
the page and a Club object in the page. The Club object may have a
method canEdit(Person pers) to check if the person can edit the club
and the template should be able to use this to determine whether or
not to render an Edit button.

I'm sure there are other issues we'll bump into but those are the main
ones. In the past I've suffered with JSP-EL and Velocity, but my last
copule projects were GWT-based so templating was never an issue. Now
that I'm back in java template land, I'm disappointed that not much
has changed. Cambridge seems to be the only one that "gets it" but
I'm baffled why the Java community hasn't jumped on it en mass. My
sneaking suspicion is that the Java community is a hollow shell of
what it once was. It's dying :-(

> My primary criteria are:
> * designer friendly, eg, not broken markup (yay Cambridge), no or minimal
> code exposure - so simple logic (expression,if/for))
> * high performance - templates can be compiled to bytecode (nice to have).
>  Eg, not Groovy.
> In the past, I built optimization algorithms where we wanted to allow custom
> rules to be evaluated in the inner loop of the algorithm.  We looked at JEXL
> along with others (including Javascript) and ended up using Janino - for
> performance.  Janino was an efficient but ugly solution.

Interesting, didn't see that one.

> (btw Edinc, Jeff is an awesome tool builder  (but reluctant - because he's
> building great software not tools! :) ) - he's part of several awesome
> projects that have improved my life.  I don't know as much about Jon, but he
> mentioned being part of the Velocity team.  These guys rock.)

Awww, thanks... Jon and I have worked together for years, both
professionally and on opensource projects. He was one of the founders
of the Jakarata apache project waaaay back when. Top-notch developer
and I'm glad to finally be working with him as a business partner
rather than just a coworker :-)

Jeff

Tom Carchrae

unread,
Sep 22, 2011, 2:46:26 PM9/22/11
to cambridge...@googlegroups.com
I'm baffled why the Java community hasn't jumped on it en mass.  My
sneaking suspicion is that the Java community is a hollow shell of
what it once was.  It's dying :-(

My guess is it's the hangover from the mess of web frameworks and consultancy driven business where productivity was pitted against billable hours.  Java still tops the charts for in use languages - I think it's just the baggage of being around for so long and having such a mess of solutions.  

You should check out Play!  It's a pretty awesome community of Java devs who dropped the baggage, basically it is a Rails design but using Java/Scala.  Might be interesting for you to look at the templating solutions there as well as 'off the shelf' modules:  http://www.playframework.org/modules - part of me wants to try Scalate, but part of me says, down boy.  

Tom

Erdinc Yilmazel

unread,
Sep 22, 2011, 3:20:29 PM9/22/11
to cambridge...@googlegroups.com
Play is really nice and Cambridge actually works well with Play! as well. However I haven't implemented it as a module yet.

Erdinc Yilmazel

unread,
Sep 23, 2011, 1:01:46 AM9/23/11
to cambridge...@googlegroups.com
Ok guys JEXL integration is now checked in. Thanks a lot for the contribution. Jon, you deserve credit on the project homepage for that.

It is really great to see experienced developers as yourselves using Cambridge. It keeps me motivated and excited to get feedback and contributions on the project. 

My two cents about the java web community is that, I don't think it is dying. I think the java platform and even the language is still very strong. The number of java developers is maybe all time highest. However it is hard to say the same thing about JEE stack. There are hundreds of frameworks and technologies for doing enterprise/web development. It looks like the developers are getting spoiled in all these different choices. 

I don't know why the java community hasn't jumped on Cambridge yet but I'm guessing it is mainly because it lacks good documentation and a nice shiny website & logo. I'm now thinking that naming it Cambridge was a big mistake as well. (There is no way it is going to rank high in Google search results if you just search for Cambridge :) )  The story about the name is, I used to live in Cambridge England, where I was staring out the window, thinking a name for my template engine and I just picked the name of my favorite city. So eventually, (Maybe after a real 1.0 release) I'm thinking about changing the name of the project, building a nice website for it and also moving the code to git hub. I think starting with the github would be a nice move at this point. After that I'm guessing that the project would reach a wider audience.

BTW: I am open to new name suggestions. 

 - Erdinc

Tom Carchrae

unread,
Sep 23, 2011, 4:52:27 AM9/23/11
to cambridge...@googlegroups.com
Some (easy?) suggestions for more people to use Cambridge

* Fix the Play! sample  (Easy: one line is wrong the configuration - I bet you lose quite a few people on that.  It's also a danger sign when the sample does not run out of the box.)

* Build a Play module to install it - or ask the Play community for help

* Make it easier to build (maven didn't work for me (I don't often use maven though)) and release often.  Add build instructions.

I really think your solution is great, especially compared to some of the alternatives.  I also think it's pretty fantastic how Jeff/Jon are adding new expression languages and it shows how flexible your design is.  

I think the name is fine.  More important is how easy is it for people to start using it.  

Tom

Jeff Schnitzer

unread,
Sep 23, 2011, 8:24:23 PM9/23/11
to cambridge...@googlegroups.com
Erdinc, I share your opinion on the googleability of the name. Worth
changing? I don't know.

Moving to github would be a big plus just because it would be easier
to manage contributions with pull requests. Dunno if it would
contribute to visibility though.

Complete documentation would probably help a lot. The existing
documentation is good, there are just major pieces obviously missing.
From that it looks like an incomplete project. I fully believe that
documentation is the #1 most important feature of any library because
it's the first thing a developer looks at. It's likely that a lot of
people pass on Cambridge just because the DevelopersGuide is
incomplete. Even without putting additional work into it, just
removing the empty header sections would improve the appearance of
completeness.

While I'd like to think the Java community is vibrant, from my vantage
point (the bay area startup scene) it looks bleak. All the "cool
kids" have moved on to Ruby or Scala or Python, and it's rare to see a
Java-based startup. Development of opensource java tools has slowed
waaay down. Major projects (especially parts of the JEE stack) have
been abandoned (eg OpenSymphony). There are still great reasons to
write Java (obviously I'm doing it) but the opensource community is
not what it once was.

My client development has all been GWT-based for the last two years
and this new app is going back to a page-centric model. I looked
around at templating options expecting great improvements in the
tools, but it looks like everything is stagnant. JSTL hasn't changed.
JSF? Garbage to begin with, garbage still. Velocity, Freemarker?
Same as they ever were, but the communities seem to be shrinking.
Cambridge is the first template system I really like, but I'm just not
sure anyone is writing webapps in Java anymore.

FWIW, I'll do what I can to evangelize because Cambridge is really
great and deserves a wider audience than it has right now. I'm
especially pleased that the code is pretty well organized and easy to
understand. It's a major shift from the horror I feel every time I
have to wade into Resteasy's awful morass.

Jeff

Tom Carchrae

unread,
Sep 24, 2011, 2:40:01 PM9/24/11
to cambridge...@googlegroups.com
It's a major shift from the horror I feel every time I
have to wade into Resteasy's awful morass.

One of those rules of thumb - don't use a name like Simple or Easy or else it'll become a horrid, complex and difficult beast just to spite you. 

Ray Vanderborght

unread,
Feb 24, 2012, 1:41:53 AM2/24/12
to cambridge...@googlegroups.com
I just wanted to chime in on this old thread as a potential new user. I found Cambridge through playing with resteasy, then htmleasy, and honestly Jeff and Jon's chatter about it had a fair amount of influence too (I've been following their entrepreneurial endeavors over the last few months). In any case, Cambridge's template inheritance alone is a pretty killer feature so I'm interested in what you got going here.

So I just want to say that there's two basic things I'd recommend for getting more adoption:
1. A "Getting Started" guide.
2. A link from the github project page to the googlecode page (for now).

For #1: A flood of new users is not always a good thing (and maybe not what you want at this point), but for the folks that are willing to clone a repo rather than just download a release, it makes sense to make it relatively easy to get started... a simple recipe of commands to build and instructions on how to integrate would help greatly there.

For #2: The HtmlEasy docs link to the Cambridge github page and from github there's no indication that there's more documentation to be found on googlecode... it's easy enough to search and find that out, but you have to be motivated. So a link that says, "see here for documentation" would be helpful.

Cheers,
Ray



Rakesh Waghela

unread,
Feb 28, 2012, 1:26:49 PM2/28/12
to cambridge...@googlegroups.com
+1 for getting started guide request !
Reply all
Reply to author
Forward
0 new messages