 |
Friday, October 4, 2002 |
Scripting Java Web Apps. From miceda:
A lot of code in a web application is devoted to glueing the presentation and business logic/data tiers together. Most of this code is dedicated to the same things: validating input, updating the database, deciding where to send the user.
One of the draws backs to using a compiled language such as Java in this scenario is the pain of code, compile, start web server, test, loop.... Seems to me that a scripting language ( jython) would be perfect as the glue between the html and backend components.
No only does the scripting language speed the development cycle but usually the scripting language is simple enough for junior programmers to use and become productive with.
Now I realize that using a scripting language in this area is not a new idea ( tcl and the AOLServer, Perl... ). But it certainly is still very uncommon in the Java web app world and IMO much needed.
I came to this realization about a year-and-a-half ago when I first started working on JPublish. Since then, JPublish has had script actions. I believe that you can take it one step further and not just limit your scripting to Jython, but instead take advantage of IBM's Bean Scripting Framework and allow numerous scripting languages. Currently, for example, I know that Jython, JavaScript and BeanShell all work within JPublish, all because of the Bean Scripting Framework.
Another interesting effect of using scripting languages for writing your glue logic is that you can add action editing and management as part of your Content Management strategy. Thus, actions become a sort of content in your CMS. That is what I have done for JPublish Professional, and it is quite nice to be able to edit your actions remotely with no need to restart the server.
If you are interested in learning more about JPublish, visit http://www.jpublish.org/.
[All Things Java]
Agreed with all of that. Much of the time I find that lots of 'glue code' can actually be described declaratively via XML along with a decent expresion language like XPath or Jexl (like Velocity). The great thing about this is that it makes it very easy to parse, transform, edit, validate your glue/mappings/actions. Its much easier to create user interfaces that create and edit XML than it is to create/edit arbitrary scripting languages.
This concept is one of the drivers behind Jelly. Try to put as much of your glue code into easy to parse declarative XML (rather like Ant does with building or JSTL does with creating web pages or BPEL4WS does for web service orchestration). Whenever you don't have a handy declarative way of describing your mappings/actions/glue in XML or you want to do something complex, you can mix and match any BSF supported scripting language (JavaScript/Jython/Jacl etc) or use neat bindings for XPath, XSLT, beanshell, pnuts, SQL, SOAP etc.
So I tend to think of Jelly as an uber-scripting engine. Use simple XML where it makes sense or plug and play scripting libraries where they make sense.
5:40:24 PM
|
|
Calling the blog-support Java hotline.
Calling the blog-support Java hotline:
Ever since Java 1.1 file1.renameTo(file2) doesn't work across volumes (ie different unix partitions) - but from within Java you can't tell if the files live on different partitions, the method just returns false. What to do? Is there a commons class or something that will move the file for me? (I'm guessing you have to do it a byte by byte?)
[rebelutionary]
Its early days and doesn't have a website yet but commons IO looks like its got some stuff that might be useful. You can surf CVS here. For example the IOUtil class has methods to copy from an input stream to an output stream etc.
10:59:32 AM
|
|
Java on the Desktop. Gosling quoted: Microsoft provided tools that developers have ended up being forced to use to build desktop software, he said. "And, for lots of desktop developers [Windows] was the only market that actually mattered," Gosling said. "That is, I think,... [jeremiahcode]
Another thought for the day. I'd like to see is closer integration with Mozilla and Java. Mozilla is a great browser capable of viewing any web content very nicely and its cross platform and very fast. Its also got a full range of groovy widgets which are all fully integrated with XUL so its a great client, cross platform alternative to MS proprietary lock in.
So a simple Java API for viewing and controlling Mozilla would be cool; I don't think you can have a decent a graphical front end without a decent browser these days.
10:47:45 AM
|
|
Will open source finally kill off the $1.2 million CMS money pit?. Builder.com: Will open source finally kill off the $1.2 million CMS money pit? [Hack the Planet]
Interesting article. Got me thinking. With open source software like Linux, Mozilla as well as the many platforms like Tomcat, Jetty, JBoss as well as the heaps of great Java libraries and tools out there, its often hard for pointy headed bosses to get an idea of how many users a product has. I guess tracking the downloads is the best counter we've got so far, or counting the traffic on email lists. With commercial software its much easier to track this kind of stuff as people actually buy it.
There's a big difference between how many people download and how many folks actually use something. I wonder if it would be possible to add a little stat-gathering agent into open source platforms like Mozilla, Tomcat, Jetty, JBoss etc. So that as software starts up, every now and then it pings a server somewhere with the IP address and how often its been ran or something. It could maybe give a little breakdown of the open source libraries that are used (Struts, JSP, WebWork or whatever). I guess there's security issues and the possibility of spoofing but if those could be overcome this could be useful.
Imagine if Linux and Mozilla did this by default? We'd be able to say there are X million Linux boxes running and Y million Mozilla users. Right now we've no real idea. It'd be fascinating to get the real numbers. Recent figures of IE having 96% of the browser market seem quite unbelievable.
Being able to say how many users of non-windows and non-IE browsers there are out there would at least encourage web site developers to support standards. Also knowing the real size of the Linux market would certainly help software companies know which platforms to target.
10:32:35 AM
|
|
Just spotted Henri's slides on Jakarta Commons Lang. Jakarta Commons Lang is looking pretty good; I particularly like the Enum stuff and the Builders for creating comparators etc. There's lots of useful methods in the utility classes also.
7:44:52 AM
|
|
Console Plugin for Maven. As a followup to my previous post, I have submitted the Console plugin for Maven. The console plugin allows you... [moatas]
Excellent stuff Jim! Can't wait to use this, I've wanted one of these for ages.
I did create a little Jelly Runner written with JellySwing which runs Jelly scripts which avoids the JVM startup time when executing scripts. I was meaning to get around to extending it to provide an interactive Swing console for Maven to allow you to choose goals to use via a menu or tree. Though I'll be quite happy with your console plugin for a while! Many thanks.
7:06:11 AM
|
|
© Copyright 2007 James Strachan.
|
|
|