sharing code on the server and client sides

"Peter Michaux" <[email protected]> Sat, 19 Jan 2008 13:20:57 -0800
Newsgroups gmane.comp.java.helma.general
Message-ID <[email protected]>
I've been playing around with JavaScript on the server-side on and off
for a few months. My two primary motivations to use JavaScript on the
server-side are so I can write code on server and client sides without
needing to switch gears mentally and so that the server and client can
share code. I'm sure these solid points in favor of server-side
JavaScript will win more people over as time goes by. The other option
is writing everything in another language like Java and compiling down
to JavaScript like GWT does but then debugging in the browser is a big
problem. JavaScript is great anyway!

The types of code sharing I know I can use immediately are form
validations and html previews. For form validation, I'll be able to
specify the regexp for what is an email address in just one language
rather than in both Perl|Python|Ruby|Java|etc and in JavaScript. For
something like a blog comment form or a wiki editor, where the user
can use *bold* or _underline_ syntax, the algorithm to convert this
code to HTML will only need to be expressed in one language. This
makes live previews in the editor much easier to implement.

I'm curious what other bits of common (or uncommon) client-side
functionality that Helma developers have been able to share with the
server-side.

Thanks,
Peter