Eruby vs php/jsp

Hi All,

I am planning a web site for my company that provide e-commerce related
contents/services. I consider using eruby + mod_ruby. I am also considering
the following alternatives.

  • PHP
  • JSP
  • SPYCE or PSP (Python)

Could any one give me a suggestion on this? What I am particularly intersted
is the readyness of eRuby in production environment (especially session
support etc. heard that php has session problem in achievo). How about
ActiveScriptRuby?

Thank you!

Shannon

···

Want to block unwanted pop-ups? Download the free MSN Toolbar now!
http://toolbar.msn.co.uk/

Shannon Fang wrote:

Hi All,

I am planning a web site for my company that provide e-commerce related
contents/services. I consider using eruby + mod_ruby.

I do not think that mod_ruby + eruby is a very good solution (embedding
code in HTML is evil), you should look at a templating system like
kwartz + FastCGI.

···


http://www.mikrocontroller.net - Das Mikrocontroller-Forum

Shannon Fang wrote:

Could any one give me a suggestion on this? What I am particularly
intersted is the readyness of eRuby in production environment
(especially session support etc. heard that php has session problem in
achievo). How about ActiveScriptRuby?

If you can wait a month or two, Ruby on Rails will probably be out.
Rails was used to build Basecamp, a popular project management system by
37signals. The lead developer David Heinemeier Hansson describes the
process of building Basecamp in a two hour presentation here:

http://www.loudthinking.com/arc/000232.html

Slides from the presentation are available here:

http://www.loudthinking.com/arc/000228.html

Your needs may vary. Rails is more of a Web Application Framework than a
templating system, so it may not be the best thing for you.

We use eRuby on mod_ruby at work and have found that it works rather
well. It’s very different from PHP, and the project isn’t as mature as
PHP, so the learning curve is initialy steeper. The payoff of being able
to use ruby is huge. There are several ways of using eRuby. You can use
it as a cgi app much like PHP can be used (you tell apache to pipe all
files with a rhtml extention through eruby). Or you can use it in
conjuction with mod_ruby. The primary disadvantage of using it with
mod_ruby is that libraries that are “required” are loaded into a shared
memory space. The only way to unload them (and you will need to unload
them when ever you modify a library file) is to restart Apache. The
shared memory space also makes it impossible to use securely in a
“shared” server environment (an environment where multiple people have
access to different websites running on the same Apache instance). These
two points can make the eRuby + mod_ruby somewhat hairy to use in a
production environment. The primary advantage to the eRuby + mod_ruby
route is that libraries are only loaded once for a particular apache
process, which may handle multiple requests (think speed). If the shared
environment of mod_ruby bothers you, you should probably consider FastCGI.

eRuby is just a console application that is useful for converting a ASP
like rhtml file into pure ruby code. eRuby will optionally pipe the
generated code through the ruby interpreter and send back the results on
stdout. There are many different solutions for using eRuby, and probably
one that would meet your needs. Can you describe a little bit more about
what you are trying to do, and then others on the list can provide
solutions?

···


John Long
http://wiseheartdesign.com

Shannon Fang wrote:

Hi All,

I am planning a web site for my company that provide e-commerce related
contents/services. I consider using eruby + mod_ruby. I am also
considering the following alternatives.

  • PHP
  • JSP
  • SPYCE or PSP (Python)

Could any one give me a suggestion on this? What I am particularly
intersted is the readyness of eRuby in production environment
(especially session support etc. heard that php has session problem in
achievo). How about ActiveScriptRuby?

Since I’e tried cgikit
(CGIKit), I’ve regretted I
hadn’t discovered it earlier. I really like developing with it. It runs
as cgi, and clearly separates your code from the layout (you don’t put
code in the layout. For example, you have a tag CKCondition, whose
content is printed if its condition is true, but the value of the
condition is set in the code, not in the layout where you don’t even
specify what’s the condition, that happens in the binding file).

You can really create components you can reuse later. For example, I’ve
made a component to list rows taken from a database, with the
possibility of some fields being html links, some fields being hidden,
etc. I developed it once, and I can reuse it as is in completely other
projects.

Really worth a try…

Raph

PS: I think I read somewhere it has some similarities with webobjects,
but the language is ruby.

···

Thank you!

Shannon


Want to block unwanted pop-ups? Download the free MSN Toolbar now!
http://toolbar.msn.co.uk/

I don’t entirely agree. Yes, having your ‘business code’ in your HTML
is bad juju, but careful with the seperation there.

Most interesting ‘templating systems’ seem to be mini-scripting
languages in themselves, because one do need different programming
constructs when generating HTML.

I was looking around at different templating solutions at one time,
because I wasn’t particularly happy with anything. Stuff like Smarty
for PHP, while being very fancy and powerful, just seemed… Wrong
somehow. It was just rubbing my aesthetics the wrong way.

I stumbled across a page where someone was making much the same point,
while the idea of having this ‘easy language’ for your designer seemed
like a good idea, it just muddles thing up when you and your designer
have to learn this minilanguage, nevermind the time you might spend
supporting the more or less well thought out templating system.

So why not just use Ruby for the templating? Of course your designer
will still have to learn the basics, but you’ll save a bit of
time. And when he comes with this odd idea, you can just give him a
magic-block-of-code to fix his problem, and not waste your time
because the templating system doesn’t support getting every 3 item of
an array, or some sort.

Some might say that the same goes for PHP or Perl, but I think Ruby
got an edge there in it’s marvelously clean syntax.

So having thought these thoughts, I was rather happy to se that this
was indeed what David is doing in Rails. The templates is just eRuby
which get everything it needs handed down from the controller
including some convinience methonds, so the most it usually has to do
is <% foreach post in @posts %>. So all you got in your templates is
presentation logic.

Davids done all the hard word for you in Rails, but there’s really no
reason why you shouldn’t be able to use the same principle in mod_ruby

  • eRuby.
···

On Sat, May 29, 2004 at 08:18:42PM +0900, Andreas Schwarz wrote:

Shannon Fang wrote:

Hi All,

I am planning a web site for my company that provide e-commerce related
contents/services. I consider using eruby + mod_ruby.

I do not think that mod_ruby + eruby is a very good solution (embedding
code in HTML is evil), you should look at a templating system like
kwartz + FastCGI.


Thomas
beast@system-tnt.dk

Thomas Fini Hansen wrote:

Shannon Fang wrote:

Hi All,

I am planning a web site for my company that provide e-commerce related
contents/services. I consider using eruby + mod_ruby.

I do not think that mod_ruby + eruby is a very good solution (embedding
code in HTML is evil), you should look at a templating system like
kwartz + FastCGI.

I don’t entirely agree. Yes, having your ‘business code’ in your HTML
is bad juju, but careful with the seperation there.

Most interesting ‘templating systems’ seem to be mini-scripting
languages in themselves, because one do need different programming
constructs when generating HTML.

I was looking around at different templating solutions at one time,
because I wasn’t particularly happy with anything. Stuff like Smarty
for PHP, while being very fancy and powerful, just seemed… Wrong
somehow. It was just rubbing my aesthetics the wrong way.

I stumbled across a page where someone was making much the same point,
while the idea of having this ‘easy language’ for your designer seemed
like a good idea, it just muddles thing up when you and your designer
have to learn this minilanguage, nevermind the time you might spend
supporting the more or less well thought out templating system.

So why not just use Ruby for the templating? Of course your designer
will still have to learn the basics, but you’ll save a bit of
time. And when he comes with this odd idea, you can just give him a
magic-block-of-code to fix his problem, and not waste your time
because the templating system doesn’t support getting every 3 item of
an array, or some sort.

Some might say that the same goes for PHP or Perl, but I think Ruby
got an edge there in it’s marvelously clean syntax.

So having thought these thoughts, I was rather happy to se that this
was indeed what David is doing in Rails. The templates is just eRuby
which get everything it needs handed down from the controller
including some convinience methonds, so the most it usually has to do
is <% foreach post in @posts %>. So all you got in your templates is
presentation logic.

Davids done all the hard word for you in Rails, but there’s really no
reason why you shouldn’t be able to use the same principle in mod_ruby

  • eRuby.

Truer words were never spoken! I’m glad you wrote it so id did not have
to get beat up over it.
Templatating systems seem neat and in many cases they likely work well.
But when you investigate the use of templates you might first consider
the purpose - usually seperation of skills.
I find ruby syntax as simple and more capable than templates. ERuby can
do this very well.

And as for stability i think that is a nebulous thing to define. I’ve
been using mod_ruby for sometime and have stumped my toe more
than once but i think this has more to do with mysql and other libs and
my own dumbness. I’m inclined to believe you could build a
system as stable as those others. Just keep it simple.

I’d just recommend looking into the shared interpreter issue with
mod_ruby which basically means, realize other hosts might be using the
same space…so be aware
of that and if curious things happen make sure you’ve partitioned your
code thouroughly.

:Paul

···

On Sat, May 29, 2004 at 08:18:42PM +0900, Andreas Schwarz wrote: