Hi,
I am working on a short article about rails in German.
Could s.b. who has experience with Java Struts and rails
comment on it?
Thanks,
-Armin
Hi,
I am working on a short article about rails in German.
Could s.b. who has experience with Java Struts and rails
comment on it?
Thanks,
-Armin
wrote:[mailto:armin@xss.de]
Hi,
I am working on a short article about rails in German.
Could s.b. who has experience with Java Struts and rails
comment on it?Thanks,
-Armin
Also, would someone be willing to translate it to English?
Curt
Could s.b. who has experience with Java Struts and rails
comment on it?
One of the first differences is one of kind. Rails has an answer for all three letters in MVC. Struts is squarely focused on providing the C. In Rails, that layer is handled by Action Controller (part of Action Pack which also includes Action View).
A few other quick differences:
* All actions in Struts must be mapped in an XML file. All return values use indirection (SUCCESS/FAILURE) that must be mapped in the XML file. In Action Controller, this is all handled by reflection (the framework figures out how the configuration should look).
* Action Controller cares deeply about Pretty URLs, such as /customers/show/154. It's baked right into the framework. Default Struts exposes technology in the URLs (*.do) and generally doesn't work hard to care for the beauty of the URL. (Third-party add-ons can alleviate that to some degree).
* Struts' actions are full-fledged classes, actions in AC are just methods. The default number of lines for an action in Basecamp[1] is 5. Look at any struts example and find any action. It's not even funny.
* Action Controller supports the concept of layouts natively. Struts requires the aid of Tiles, which in turn requires its own set of XML files for configuration (on top of what's already required in Struts).
* Validation in Struts requires the use of "model mirrors" called ActionForms. These mirrors have a 1-1 mapping to your model files a lot of the time, but uses a different syntax. This means you're Repeating Yourself. In Rails, validation is pushed to the model, while the _presentation_ of validation errors are kept in the Action Controller.
* Action Controller has deep support for filters/interceptors (running shared code before and after all actions). Struts have a research project called SAIF to get this type of support, but nothing in the main framework.
* Action Controller has scaffolding to quickly bring a model class "online" (provide CRUD operations without doing code).
...and then of course, Action Controller is built with a whole MVC framework in mind. So it works exceedingly well Action View and Active Record. There's definitely preferential treatment going on there, even if Action Controller is a separate framework.
I hope that helped a bit. Have in mind that I'm pretty biased, though :). Struts personifies much of my animosity towards the Java/J2EE world. It has XML-files up to here, duplication and repetition coming out of the wazoo, and very little to show for it when it's done.
What I _do_ like about Struts is how it some how got positioned itself as the default controller in the majority of run-of-the-mill J2EE apps. That's a freaking awesome piece of PR work there. I'm still learning on that account
[1] Basecamp was the first application to use Rails. It's a web-based project management tool available at http://www.basecamphq.com.
--
David Heinemeier Hansson,
http://www.rubyonrails.org/ -- Web-application framework for Ruby
http://www.instiki.org/ -- A No-Step-Three Wiki in Ruby
http://macromates.com/ -- TextMate: Code and markup editor for OS X
http://www.basecamphq.com/ -- Web-based Project Management
http://www.loudthinking.com/ -- Broadcasting Brain
http://www.nextangle.com/ -- Development & Consulting Services
Curt Hibbs wrote:
wrote:[mailto:armin@xss.de]
Hi,
I am working on a short article about rails in German.
Could s.b. who has experience with Java Struts and rails
comment on it?Thanks,
-Armin
Also, would someone be willing to translate it to English?
I can try todo that .. no big deal.
Curt
Yes, I wouldn't take Struts to be the shining example of Java MVC toolkits, even if it is the most popular.
I also can't claim to know the entire range of them intimately, but I have been liking the Spring Framework's MVC stuff, even if it does use XML configuration files : )
-Your model can be your domain object, or not, depending on which you think is a better choice
-You define how your action return value maps to your views (so that you don't have to define success and failure views for every controller)
-Implementing actions does not require implementing them one per class (although often I do this, but that doesn't seem like such a terrible thing to me)
-Spring MVC is also view agnostic, so you can pick the view technology you like the best, the layout thing is left up to you (tiles, sitemesh, whatever you like, and by the way tiles does not require use of XML files, only if you are doing something fairly complicated do you need them)
-And, in the greater Spring framework, there are some nice simplifications for JDBC access that can simplify this code as well, although these are not part of the MVC framework. The greater framework also provides simplification for Hibernate, JDO and other ORM tools. Technically I don't think an MVC framework should choose an unrelated technology for you like that. Does Rails allow you to swap out something in place of ActiveRecords? I have very limited experience with rails (I've gone through the basics of the installation and tutorial only).
Moses
On Oct 8, 2004, at 6:20 AM, David Heinemeier Hansson wrote:
I hope that helped a bit. Have in mind that I'm pretty biased, though :). Struts personifies much of my animosity towards the Java/J2EE world. It has XML-files up to here, duplication and repetition coming out of the wazoo, and very little to show for it when it's done.
What I _do_ like about Struts is how it some how got positioned itself as the default controller in the majority of run-of-the-mill J2EE apps. That's a freaking awesome piece of PR work there. I'm still learning on that account
Technically I don't think an MVC framework should choose an unrelated technology for you like that. Does Rails allow you to swap out something in place of ActiveRecords? I have very limited experience with rails (I've gone through the basics of the installation and tutorial only).
Sure it does. Instiki uses a Madeleine back-end and is hooked up with an older version of Action Pack.
But I really disagree with the "those an unrelated technology" theme in regards to Rails. I actually think the biggest asset of Rails is that it _does_ chose a full tech stack for you. Who wants to program control-flows? I want to create web-applications.
So in that sense Rails is more focused on the goal (a web-application) than the means (just control-flow or just ORM).
I think that's a good part of the reason why Rails is gathering some momentum now. It's a full solution to a problem (creating a web-application). This idea of course isn't new. You mention Spring which is also attempting to archive a full solution. And then there are projects like AppFuse that attempts to tie a given stack together.
--
David Heinemeier Hansson,
http://www.rubyonrails.org/ -- Web-application framework for Ruby
http://www.instiki.org/ -- A No-Step-Three Wiki in Ruby
http://macromates.com/ -- TextMate: Code and markup editor for OS X
http://www.basecamphq.com/ -- Web-based Project Management
http://www.loudthinking.com/ -- Broadcasting Brain
http://www.nextangle.com/ -- Development & Consulting Services
Technically I don't think an MVC framework should choose an unrelated technology for you like that. Does Rails allow you to swap out something in place of ActiveRecords? I have very limited experience with rails (I've gone through the basics of the installation and tutorial only).
Sure it does. Instiki uses a Madeleine back-end and is hooked up with an older version of Action Pack.
That's good to know. Whatever Madeleine is. : ) I am a nuby.
But I really disagree with the "those an unrelated technology" theme in regards to Rails. I actually think the biggest asset of Rails is that it _does_ chose a full tech stack for you. Who wants to program control-flows? I want to create web-applications.
So in that sense Rails is more focused on the goal (a web-application) than the means (just control-flow or just ORM).
I think this is good, too. By "choose", I meant "force you to use", not "provide a default option". I was just wondering whether Rails made it difficult to swap out parts of your stack if you happened to prefer another library for ORM or whatever, which I think a framework should allow you to do. It sounds like Rails doesn't force anything on you, so that's good.
Moses
On Oct 8, 2004, at 8:37 AM, David Heinemeier Hansson wrote:
http://www.suneido.com/ is interesting too.
martin
David Heinemeier Hansson <david@loudthinking.com> wrote:
I think that's a good part of the reason why Rails is gathering some
momentum now. It's a full solution to a problem (creating a
web-application). This idea of course isn't new. You mention Spring
which is also attempting to archive a full solution. And then there are
projects like AppFuse that attempts to tie a given stack together.
Moses Hohman ha scritto:
That's good to know. Whatever Madeleine is. : ) I am a nuby.
a lovely persistence system based on Object Prevalence concepts
I think this is good, too. By "choose", I meant "force you to use", not "provide a default option". I was just wondering whether Rails made it difficult to swap out parts of your stack if you happened to prefer another library for ORM or whatever, which I think a framework should allow you to do. It sounds like Rails doesn't force anything on you, so that's good.
Indeed, indeed. You want people to reach their own conclusions.
(*Flute playing*, *Man dancing* -- yes, that's one for the RubyConf'ers ;))
--
David Heinemeier Hansson,
http://www.rubyonrails.org/ -- Web-application framework for Ruby
http://www.instiki.org/ -- A No-Step-Three Wiki in Ruby
http://macromates.com/ -- TextMate: Code and markup editor for OS X
http://www.basecamphq.com/ -- Web-based Project Management
http://www.loudthinking.com/ -- Broadcasting Brain
http://www.nextangle.com/ -- Development & Consulting Services
Martin DeMello wrote:
David Heinemeier Hansson <david@loudthinking.com> wrote:
I think that's a good part of the reason why Rails is gathering some momentum now. It's a full solution to a problem (creating a web-application). This idea of course isn't new. You mention Spring which is also attempting to archive a full solution. And then there are projects like AppFuse that attempts to tie a given stack together.
http://www.suneido.com/ is interesting too.
martin
Very interesting, but MSWind only. So to me it's useless (I can't even test it).
I think this is a good idea but it should work another way:
Not take snapshots of the whole system in constant periods and store all
classes in memory.
My idea is:
1. Command (object) to application object are marshalled and dumped,
that's ok.
2. But each application object will be automatically dumped if long time
unused.
3. The system should dump as well object class after long+n time unused.
In memory there should be only used classes and objects, not garbage.
MiG
Dne 8/10/2004, napsal "gabriele renzi" <rff_rff@remove-yahoo.it>:
Moses Hohman ha scritto:
That's good to know. Whatever Madeleine is. : ) I am a nuby.
a lovely persistence system based on Object Prevalence concepts
Watch 'em. They're porting the server part to Linux. The switch from
MSVC to gcc is already done, IIRC.
s.
On Sat, 9 Oct 2004 05:16:22 +0900, Charles Hixson <charleshixsn@earthlink.net> wrote:
Martin DeMello wrote:
http://www.suneido.com/ is interesting too.
martinVery interesting, but MSWind only. So to me it's useless (I can't even
test it).
MiG ha scritto:
I think this is a good idea but it should work another way:
Not take snapshots of the whole system in constant periods and store all
classes in memory.My idea is:
1. Command (object) to application object are marshalled and dumped,
that's ok.
2. But each application object will be automatically dumped if long time
unused.
3. The system should dump as well object class after long+n time unused.In memory there should be only used classes and objects, not garbage.
MiG
well, comment on the prevayler wiki:
http://www.prevayler.org/wiki.jsp
But you would break an assumption of the prevalence theory, and you'd not get a system 3000 times faster than MySQL
Stefan Schmiedl wrote:
On Sat, 9 Oct 2004 05:16:22 +0900, >Charles Hixson <charleshixsn@earthlink.net> wrote:
Martin DeMello wrote:
http://www.suneido.com/ is interesting too.
martinery interesting, but MSWind only. So to me it's useless (I can't even test it).
Watch 'em. They're porting the server part to Linux. The switch from
MSVC to gcc is already done, IIRC.
s.
But they say the client end will take much work. (They did indicate that moving the server part would be easy.) To me this indicates that I shouldn't expect much until, at best, this time next year. I can't wait for that, even though the concept looks quite good.
Queries with Prevayler are more than 9000 times faster than querying Oracle through JDBC.
Queries with Prevayler are more than 3000 times faster than querying MySQL through JDBC.
This implies MySQL is 6000 times faster than Oracle
and I 999 times can't believe it :-))
And this implies as well instantiation of one Java object takes 868.5
minutes and that is why you must keep it all in RAM, of course. Buying
new RAM every week is the new age of new age of garbage collecting
(NAONAOGC).
I think objects and classes should disappear from RAM if unused for long
time. You free RAM and the performance of your computer will be 5458
times better.
Am I right? We will see after 648 years...
MiG ha scritto:
I think this is a good idea but it should work another way:
Not take snapshots of the whole system in constant periods and store all
classes in memory.My idea is:
1. Command (object) to application object are marshalled and dumped,
that's ok.
2. But each application object will be automatically dumped if long time
unused.
3. The system should dump as well object class after long+n time unused.In memory there should be only used classes and objects, not garbage.
MiG
well, comment on the prevayler wiki:
http://www.prevayler.org/wiki.jspBut you would break an assumption of the prevalence theory, and you'd
not get a system 3000 times faster than MySQL
On an a little off the topic, I am trying to compose a web application with
Java Struts, for my graduation project.Problem is time is running out, and I
keep getting bogged down with the little details and excessive clutter of
hibernate and it's xmls, struts and it's xmls, tiles and it's xmls,
validator and it's xmls...This not to mention the wealth of properties files
too...This is hindering me to no end...
I would really like to do the whole thing in Rails, or another Ruby web
framework if rails does not cover my needs.
The motives for that are:
- Learn Ruby, as I am a nuby and would like to get more profficient in it,
even if here in Brazil people don't even heard of it (most people).
- Simplify the development of my application and accelerate it, as time is
running out...Only 1 month and a half left to deadline.
- Promote Ruby
- Get away from Java.I have enough of it at my daily job.Not that I like it.
Now a little about my application:
It's something like an online auction, but on a much lower scale, and the
other way around.People don't put their products for sale and wait for
potential buyers to bid.Instead, only companies are allowed to register on
the system.Then they schedule a session, and this information is used to
generate e-mails inviting potential suppliers for the product they need to
buy.When the suppliers receive these e-mails, they are informed about the
session and the product and the e-mail also contain a link to a page where
they can confirm their participation.
If there are enough suppliers, then at the time of the session the suppliers
and the contractor log in the system and have a real time auction session
where they take turns bidding, until the number of turns previously
registered by the contractor ends.At the end the one with the lowest price
for the product wins the contract of providing the company with the
product.Simple reports of session statistics are sent to the suppliers and a
more complete report is sent to the company.
That's about it.The features I am interested in a framework are:
- Validation of html forms
- Authentication
- Some kind of template mechanism, for sending the e-mails and the reports
- Some kind of clock mechanism, like Quartz for Java, to deal with the
starting and ending time of the session.
Is it possible to learn Ruby and do it all, alone and single-handed, in just
one month and 15 days? I have 1 to 2 hours per day to spend on this from
monday to friday and the whole saturday and sunday until the succesful
completion (or failure) of the project.
Another obstacle is that even tough the team has 3 components, only myself
knows and likes programming.The other is taking care of layout and html
issues and the other is doing nothing.
If I come to then and tell then we dropped Java I think I will get quite a
reaction, but that is expected.
I hope I made clear my questions and intetions and will be imensely thankful
for any advice the kind people of this list can give me.
Felipe
----- Original Message -----
From: "Charles Hixson" <charleshixsn@earthlink.net>
To: "ruby-talk ML" <ruby-talk@ruby-lang.org>
Sent: Saturday, October 09, 2004 3:58 PM
Subject: Re: rails vs Java Struts
Stefan Schmiedl wrote:
>On Sat, 9 Oct 2004 05:16:22 +0900, > >Charles Hixson <charleshixsn@earthlink.net> wrote:
>
>
>>Martin DeMello wrote:
>>
>>
>>
>>>http://www.suneido.com/ is interesting too.
>>>martin
>>>
>>ery interesting, but MSWind only. So to me it's useless (I can't even
>>test it).
>>
>Watch 'em. They're porting the server part to Linux. The switch from
>MSVC to gcc is already done, IIRC.
>s.
>
But they say the client end will take much work. (They did indicate
that moving the server part would be easy.) To me this indicates that I
shouldn't expect much until, at best, this time next year. I can't
wait for that, even though the concept looks quite good.
Don't forget, 86.7% of all statistics are made up.
-- Matt
It's not what I know that counts, it's what I can remember in time to use.
On Sat, 9 Oct 2004, MiG wrote:
Am I right? We will see after 648 years...
MiG wrote:
Queries with Prevayler are more than 9000 times faster than querying Oracle through JDBC. Queries with Prevayler are more than 3000 times faster than querying MySQL through JDBC.
This implies MySQL is 6000 times faster than Oracle
and I 999 times can't believe it :-))
No, it implies that MySQL is three times faster than Oracle. (It doesn't say faster at what.)
Jim
--
Jim Menard, jimm@io.com, http://www.io.com/~jimm
Watch your numbers! This implies MySQL is 3 times faster than Oracle
through JDBC...
Regards,
Ed
On Sat, 9 Oct 2004 01:32:12 +0900, MiG <mig@1984.cz> wrote:
> Queries with Prevayler are more than 9000 times faster than querying
> Oracle through JDBC.
> Queries with Prevayler are more than 3000 times faster than querying
> MySQL through JDBC.This implies MySQL is 6000 times faster than Oracle
--
" Don't relax! It's only your tension that's holding you together."