Hi, I have been working with Java for about 7 years, some C++, C#, using J2ee with Struts, Webwork, etc Now, I am just exploring Ruby and Ror as an option for version 2 of an "enterprise" web application, current version is around 50k lines of code. Coming from the Java world ( hype, buzzwords, over complex frameworks, etc) I am looking at Ror BUT with a lot of questions. I was planning to implement version 2 without an ORM tool ( was using Apache DB and some Hibernate ) just plain JDBC with DAOs for performance reasons in certain business logic operations which makes me think twice about ActiveRecord no matter how cool and fast it is to get something running, but I am a new around here...maybe it handles complex database relationships well. Taking account of my lack of knowledge about Ruby and Ror, I hope you could give me some feedback, non biased opinions... ;-) 1. Connection pooling? How it works? How to configure it? 2. What about doing certain stuff with the ActiveRecord but executing plain SQL for optimizations, Could this be done in the same transactions context? 3. How to implement a background task after a user request, for sending an email for example with the result of a complex operation requested by the user ( in j2ee for example JMS can be used ) 4. how to scale with more than one machine serving requests? 5. Any known plan for a Postgres 8 support? 6. Ideas about how to implement this example without writing checking code every time: if a transaction exists, etc... Code path 1: class P1 changes an X persistent objects and saves it. ( should happen inside a transaction ) Code path 2: class P2 changes a Y persistent object and calls a method in P1 ( the same Code path 1 ). All this should happen in the same transaction context 7. Disappointed and surprised that it has no i18n support, what could be a good approach from a Ruby point of view to do it now? 8. I have used Tiles (http://struts.apache.org/userGuide/dev_tiles.html) and Sitemesh (http://www.opensymphony.com/sitemesh/) for building "complex" pages, how can I do a similar approach in Ror? Or it is no longer needed because Ror has feature X? 9. Locking ( timestamp , etc ) I read a thread about proposals for modifications in ActiveRecord but how to do it now? 10. Every technology has disadvantages that are never shown in demos. What are the problems I could face in implementing a "transactional" web app with Rails? Thanks for your comments. Andres
On Fri, 18 Mar 2005 11:12:26 -0600, ANDRES VALENCIANO MONTERO <katarn-Kp5VGQjTsCPnAruVU7VYdw@public.gmane.org> wrote:> 5. Any known plan for a Postgres 8 support?I''ve been using Rails with Pg 8 with no problems so far.
On Fri, 18 Mar 2005 11:12:26 -0600, ANDRES VALENCIANO MONTERO <katarn-Kp5VGQjTsCPnAruVU7VYdw@public.gmane.org> wrote:> Hi, > > I have been working with Java for about 7 years, some C++, C#, using > J2ee with Struts, Webwork, etc > > Now, I am just exploring Ruby and Ror as an option for version 2 of an > "enterprise" web application, current version is around 50k lines of > code. Coming from the Java world ( hype, buzzwords, over complex > frameworks, etc) I am looking at Ror BUT with a lot of questions. > > I was planning to implement version 2 without an ORM tool ( was using > Apache DB and some Hibernate ) just plain JDBC with DAOs for performance > reasons in certain business logic operations which makes me think twice > about ActiveRecord no matter how cool and fast it is to get something > running, but I am a new around here...maybe it handles complex database > relationships well. > > Taking account of my lack of knowledge about Ruby and Ror, I hope you > could give me some feedback, non biased opinions... ;-) > > 1. Connection pooling? How it works? How to configure it?There is no connection pooling. There''s one connection per process. You can add more fastcgi processes which adds more threads and adds more connections.> 2. What about doing certain stuff with the ActiveRecord but executing > plain SQL for optimizations, Could this be done in the same transactions > context?Yep, you can execute stuff directly. For SELECT''s theres ActiveRecord::Base#find_by_sql and within your model classes theres a connection variable which lets you issue arbitrary SQL.> 3. How to implement a background task after a user request, for sending > an email for example with the result of a complex operation requested by > the user ( in j2ee for example JMS can be used ) > 4. how to scale with more than one machine serving requests?RoR has a shared nothing architecture. Just add more web servers, and change your session store to something like drb, memcached or active record.> 5. Any known plan for a Postgres 8 support? > 6. Ideas about how to implement this example without writing checking > code every time: if a transaction exists, etc... > Code path 1: class P1 changes an X persistent objects and saves it. > ( should happen inside a transaction ) > Code path 2: class P2 changes a Y persistent object and calls a > method in P1 ( the same Code path 1 ). All this should happen in the > same transaction contextI''m a little confused, but to wrap it all in a transaction you just use transaction: http://rails.rubyonrails.com/classes/ActiveRecord/Transactions/ClassMethods.html#M000353> 7. Disappointed and surprised that it has no i18n support, what could be > a good approach from a Ruby point of view to do it now? > 8. I have used Tiles (http://struts.apache.org/userGuide/dev_tiles.html) > and Sitemesh (http://www.opensymphony.com/sitemesh/) for building > "complex" pages, how can I do a similar approach in Ror? Or it is no > longer needed because Ror has feature X?Layouts & Components have pretty much the same functionality as Tiles. I''ve never used sitemesh, but it''s the same idea.> 9. Locking ( timestamp , etc ) I read a thread about proposals for > modifications in ActiveRecord but how to do it now?Just have a column called lock_version in your database, the rest will take care of itself. It behaves a lot like hibernate''s <version /> locking> 10. Every technology has disadvantages that are never shown in demos. > What are the problems I could face in implementing a "transactional" web > app with Rails?The main thing I miss when building rails apps rather than Java ones is Eclipse. But if you''re using a mac TextMate is almost as good. Refactoring is still missing, and code completion. But in the scheme of things, I''m writing less code so I can handle it.> Thanks for your comments.No worries, good luck and I hope you enjoy the transition as much as I did.> Andres > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails >-- Cheers Koz
* ANDRES VALENCIANO MONTERO <katarn-Kp5VGQjTsCPnAruVU7VYdw@public.gmane.org> [0319 17:19]: I''ll field a few:> 1. Connection pooling? How it works? How to configure it?Nope, use fastcgi as a pool instead - it scales just as well.> 2. What about doing certain stuff with the ActiveRecord but executing > plain SQL for optimizations,yup, I''ve done that - nice and easy.> Could this be done in the same transactions context?Don''t see why not, although I haven''t used transactions much in Rails.> 5. Any known plan for a Postgres 8 support?It''s been there a while.> 7. Disappointed and surprised that it has no i18n support, what could be > a good approach from a Ruby point of view to do it now?Check the archives, there is something out there. -- ''Everybody I know who is right always agrees with ME.'' -- Rev Lady Mal Rasputin :: Jack of All Trades - Master of Nuns
Michael Koziarski wrote:> On Fri, 18 Mar 2005 11:12:26 -0600, ANDRES VALENCIANO MONTERO > <katarn-Kp5VGQjTsCPnAruVU7VYdw@public.gmane.org> wrote: > >>1. Connection pooling? How it works? How to configure it? > > There is no connection pooling. There''s one connection per process. > You can add more fastcgi processes which adds more threads and adds > more connections.Andres, you mentioned you''ll be using PostgreSQL 8. You may use pgpool for connection pooling and failover: http://pgpool.projects.postgresql.org jeremy
>>8. I have used Tiles (http://struts.apache.org/userGuide/dev_tiles.html) >>and Sitemesh (http://www.opensymphony.com/sitemesh/) for building >>"complex" pages, how can I do a similar approach in Ror? Or it is no >>longer needed because Ror has feature X?Whoops, how''d I miss this one? I know this one! Koz wrote:> Layouts & Components have pretty much the same functionality as Tiles. > I''ve never used sitemesh, but it''s the same idea.which is right on. Here''s my own take. You can think of Rails as coming with these two baked in already. I haven''t used Tiles myself, but I know one of its major functionality areas is equivalent to partials (e.g. render_partial and render_collection_of_partials). Layouts offer equivalent functionality to SiteMesh. In addition, control is a little finer-grained, as some of the steps taken automatically by Rails would require finesse with your decorators.xml There''s only one area that SiteMesh has a slight advantage, and that''s being able to specify page specific JavaScript and CSS and have it percolate up the "call chain" to end up in the high-level page definition. (There probably is some way to do this, I just don''t know how. :-) ) I don''t count the "you can serve .html, .php, etc" feature from SiteMesh, because I think that''s more academic. Besides, there''s probably a way to do that in Rails, too. Components blow both these away, in my own opinion. Koz also said:> The main thing I miss when building rails apps rather than Java ones > is Eclipse. But if you''re using a mac TextMate is almost as good. > Refactoring is still missing, and code completion.+1 Cheers, Jim
On 18.3.2005, at 19:12, ANDRES VALENCIANO MONTERO wrote:> > 7. Disappointed and surprised that it has no i18n support, what could > be > a good approach from a Ruby point of view to do it now?You might want to take a look at MLL (http://dev.digitpaint.nl/projects/mll). //jarkko -- Jarkko Laine http://jlaine.net http://odesign.fi _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
> There''s only one area that SiteMesh has a slight advantage, and that''s > being able to specify page specific JavaScript and CSS and have it > percolate up the "call chain" to end up in the high-level page > definition. (There probably is some way to do this, I just don''t know > how. :-) )This is coming in the next version, it works like this: layout: <html> <head> <title>Great App, Inc.</title> <script><%= @content_for_script %></script> <style><%= @content_for_style %></style> </head> template: <% content_for "script" do %> function beam_me_up_to_head() { alert(''Mighty cool!''); } <% end %> <input type="button" onclick="beam_me_up_to_head()" /> <% content_for "style" do %> .chaching { color: red; } <% end %> <p class="chaching">We sold out</p> It works like a container too, so you can have multiple calls to content_for and they''ll all get added up and injected into @content_for_x -- David Heinemeier Hansson, http://www.basecamphq.com/ -- Web-based Project Management http://www.rubyonrails.org/ -- Web-application framework for Ruby http://www.loudthinking.com/ -- Broadcasting Brain
This looks extremely handy. Does this involve a major change in the way action view renders pages or has it always buffered everything? What is wrong with putting <script></script> tags everywhere? Does it only work for things in the head or could you "beam" things into the body onLoad attribute? -Jeff ----- Original Message ----- From: "David Heinemeier Hansson" <david-OiTZALl8rpK0mm7Ywyx6yg@public.gmane.org> To: <rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org> Sent: Friday, March 18, 2005 3:48 PM Subject: Re: [Rails] Ror questions from a J2ee captive>> There''s only one area that SiteMesh has a slight advantage, and that''s >> being able to specify page specific JavaScript and CSS and have it >> percolate up the "call chain" to end up in the high-level page >> definition. (There probably is some way to do this, I just don''t know >> how. :-) ) > > This is coming in the next version, it works like this: > > layout: > > <html> > <head> > <title>Great App, Inc.</title> > <script><%= @content_for_script %></script> > <style><%= @content_for_style %></style> > </head> > > template: > <% content_for "script" do %> > function beam_me_up_to_head() { alert(''Mighty cool!''); } > <% end %> > > <input type="button" onclick="beam_me_up_to_head()" /> > > <% content_for "style" do %> > .chaching { color: red; } > <% end %> > <p class="chaching">We sold out</p> > > It works like a container too, so you can have multiple calls to > content_for and they''ll all get added up and injected into @content_for_x > -- > David Heinemeier Hansson, > http://www.basecamphq.com/ -- Web-based Project Management > http://www.rubyonrails.org/ -- Web-application framework for Ruby > http://www.loudthinking.com/ -- Broadcasting Brain > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
I find it amazing at the speed Rails is progressing, a good amount of the most useful features in frameworks I''ve been using in Java (webwork2,hibernate,spring,sitemesh) are getting put into Rails at great speed, you guys rock! David Heinemeier Hansson wrote:>> There''s only one area that SiteMesh has a slight advantage, and >> that''s being able to specify page specific JavaScript and CSS and >> have it percolate up the "call chain" to end up in the high-level >> page definition. (There probably is some way to do this, I just >> don''t know how. :-) ) > > > This is coming in the next version, it works like this: > > layout: > > <html> > <head> > <title>Great App, Inc.</title> > <script><%= @content_for_script %></script> > <style><%= @content_for_style %></style> > </head> > > template: > <% content_for "script" do %> > function beam_me_up_to_head() { alert(''Mighty cool!''); } > <% end %> > > <input type="button" onclick="beam_me_up_to_head()" /> > > <% content_for "style" do %> > .chaching { color: red; } > <% end %> > <p class="chaching">We sold out</p> > > It works like a container too, so you can have multiple calls to > content_for and they''ll all get added up and injected into @content_for_x > -- > David Heinemeier Hansson, > http://www.basecamphq.com/ -- Web-based Project Management > http://www.rubyonrails.org/ -- Web-application framework for Ruby > http://www.loudthinking.com/ -- Broadcasting Brain > > _______________________________________________ > Rails mailing list > Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails
Hi Andres,> 7. Disappointed and surprised that it has no i18n support, what could be > a good approach from a Ruby point of view to do it now?I am just working on a detailed tutorial for translation / localization with gettext. This is not full i18n, but translation usually solves most of the problems. Of course dates and currency is another thing altogether. At the moment I don''t need that personally. I will announce on the list when it is ready. I am hoping to get it published on http://manuals.rubyonrails.com Sascha
Great! Thanks to everyone for the answers. I will be "playing" with it while learning Ruby, I really want a change so I hope I could get to some speed soon. Andres ----- Mensaje Original ----- De: Sascha Ebach <se@digitale-wertschoepfung.de> Fecha: Sábado, Marzo 19, 2005 9:53 am Asunto: Re: [Rails] Ror questions from a J2ee captive> Hi Andres, > > > 7. Disappointed and surprised that it has no i18n support, what > could be > > a good approach from a Ruby point of view to do it now? > > I am just working on a detailed tutorial for translation / > localization > with gettext. This is not full i18n, but translation usually > solves most > of the problems. Of course dates and currency is another thing > altogether. At the moment I don't need that personally. > > I will announce on the list when it is ready. I am hoping to get > it > published on http://manuals.rubyonrails.com > > Sascha > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails >