Stories
Slash Boxes
Comments

News for nerds, stuff that matters

Slashdot Log In

Log In

Create Account  |  Retrieve Password

Ajax On Rails

Posted by CmdrTaco on Sat Jun 11, 2005 08:26 AM
from the can-you-hack-it dept.
mu-sly writes "Ajax and Rails - probably two of the biggest buzzwords in web development at the moment. In this article over at ONLamp, Curt Hibbs introduces the incredibly powerful Ajax support that is part of the Ruby on Rails web application framework. It's a great read, and serves as a gentle introduction to the cool stuff you can accomplish with ease using the Ajax features of Rails."
+ -
unknown
This discussion has been archived. No new comments can be posted.
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More
Loading... please wait.
  • by newdamage (753043) on Saturday June 11 2005, @08:33AM (#12788622) Homepage Journal
    I'm sure many developers like myself have a day job that probably involves J2EE. The first time I did the iniitial tutorials for Rails several weeks ago I was blown away. Connecting to a database is not susposed to be this easy.

    Even when using newer frameworks like Spring, Tapestry and Hibernate (I hate you so much Struts) Rails still manages to be easier.

    I highly suggest any developers looking for a change of pace at least give Ruby on Rails a few hours of your evening. While it's not nearly as comprehensive as Java, it's gaining libraries and functionality by leaps and bounds.

    And just so I don't get labeled as a Rails fanboy/Java basher: Rails is not perfect, I still would recommend using J2EE for large corporate projects. It's just a much more mature solution with less unknowns. I think Rails needs another year at least before people are ready to really give it a shot in the corporate environment.
    • I've not tried RoR from a development perspective (I have no need/desire to write web apps), but from a user perspective it rocks! Well done Javascript can be a nice user experience, but sites that need regular reloading rarely use it, the main exception I can think of being Gmail.

      RoR, IMHO, is a major step forward to web deployed applications becomming mainstream.
    • I'm sure many developers like myself have a day job that probably involves J2EE. The first time I did the iniitial tutorials for Rails several weeks ago I was blown away. Connecting to a database is not susposed to be this easy.

      Damn right! Databases all ought to be like Oracle, where even typing in a query is a hellish quest involving obscure replacements for DNS (tnsnames), client software that's incompatible when even a minor versionnumber changes, convoluted connectstrings and non-gui client tools (un

      • And since you're paying thousands of dollars for this database the command-line based client should under NO circumstances be easy to use! Do not allow command line history, or the ability to edit the line you're working on!

        Seriously, I don't know how Oracle gets away with sqlplus... Would it be *that* hard to add readline support?
    • Ruby is easier. Until you try to do something even moderately complex.

      Our company recently tried to do a web-project (workflow management application for a publishing house) based RoR. It was a spectacular failure - LOTS of things are mostly absent from RoR: caching and transaction support, object-relational mapping is inferior (yes, ActiveRecord is NOT enough), etc.

      RoR is nice, but it needs lots of polishing and some redesign. In its present state RoR can't be compared with J2EE solutions, they are far m
      • by sucresemoule123 (462966) on Saturday June 11 2005, @09:43AM (#12788852) Homepage
        RoR has caching : here [rubyonrails.com] and supports transactions : here [rubyonrails.com]
      • hmmmmm troll alert?

        Ruby can't do complex things java can??? You meant rails, probably, and such confusion of terms is not a good sign.

        Have you checked out the latest rails versions' API? I see transaction support and caching of db data and cgi actions too.

        As for the 'inferior' object relational mapping: indeed Active record tries to keep things simple: I'm grateful for it. Rails developers got too far sometimes, as you see if you have a column named 'type' in your tables ;)
        But, that's not being inferior, it's being different. If your app requires convolute mappings, either extend active record to suit your needs or do without it (possibly dropping rails altogether and wasting precious ram with a JVM ;) ).
        • So what you're saying is that RoR is becoming more complex as it tries to handle the complex things J2EE has to handle? There is a certain irreducable amount of complexity in writing enterprise software (whatever that is). Frameworks that try to support this completely generally become more and more complex themselves until they reach J2EE levels. The vast majority of the "complicated" things in J2EE are in there because they are needed to solve real world problems. Anything that attempts to solve the same
            • Scripting is not a holy grail. The only fundamentall advantage of scripting is name-based polymorphism (i.e. dynamic dispatch), it allows you to skip extracting common interfaces in your object model. As the software grows this advantage soon becomes negligible, and may even turn to disadvantage, because you'll have to find and isolate general interfaces manually.
              • No, the fundamental advantage of dynamic languages is programmer productivity. You can accomplish a goal in a dynamic language like Scheme, Smalltalk, Python, or Ruby in 100 lines that would require 500 or more lines of Java. That's also an advantage when you have to modify the code--there's less of it and it's faster and easier to read as a result. It's also much simpler and faster to create unit tests in dynamic languages, leading to more and faster testing of projects. These advantages grow with the
      • by zorander (85178) on Saturday June 11 2005, @10:42AM (#12789045) Homepage Journal
        Enterprise software is a different game. Rails is pretty all around terrible at integrating with non-rails-intended database schemas which are plentiful in any enterprise situation.

        I'm going to overlook the fact that a flexible caching mechanism has been in place since pre-snowdevil (maybe february) and transaction support was added at some point before the last time I worked with rails (late april). Keep in mind that it's still pre-1.0 and beta and not yet feature-complete. Criticizing it for a lack of features it supports, though, is in poor taste.

        Furthermore, almost all rails development at this point has been executed using very small (5 people) core teams. J2EE supports large scale development because it was designed for it. Rails was designed to let a relatively small number of people write an agile application using the set of paradigms which rails was built on. Coming at it from an "I use java in the enterprise and couldn't plug rails in its place tomorrow" is a little bit unfair, because in the same sense, I couldn't just drop J2EE onto my own desktop and start developing with it tomorrow. (Not to mention that my boss would not even begin to authorize such an expenditure for one developer on one product).

        I see rails more as a contender to PHP than to J2EE. J2EE and rails are not really comparable in the same market. Sure, rails beats the crap out of J2EE when you've got 1-3 developers on the project, and inversely, when there's more than 10, J2EE has a clear advantage. Coming from java, you're likely to miss many of the benefits of metaprogramming in rails. Even coming from python (a somewhat similar language to ruby), I was a bit startled at some of the techniques being used.

        Your project might have failed, but I'm not sure it was completely rails that caused it. AR is very easily extensible (in a matter of hours, usually) to do all sorts of more enterprise-java-like things. Ruby's dynamic messaging and open classes makes that a much simpler affair than it would be in java. Why didn't you extend it to meet your needs? Also, how did you miss the fact that caching and transactions have been there for a while? Were you trying to shoehorn rails onto an old schema? Did you have prior ruby programming experience or were you learning as you went? Did you have prior experience in a dynamically typed language writing an app of similar complexity? Nothing is going to make the solution of a hard problem easy. Some things can make it more pleasant, if used correctly.
        • by abulafia (7826) on Saturday June 11 2005, @11:04AM (#12789117)
          Were you trying to shoehorn rails onto an old schema?

          This, I think, is the crux.

          My company has a library, too, that makes certain assumptions about the DB. We're really wicked-fast when using it, when building an app from the gound up. It has hooks for overriding some assumptions, so we can shoe-horn it in to some other projects. But if the DB is hopeless, the game is over, and we have to do things like everyone else.

          And nearly every company out there has a hopelessly messy DB, that can't be refactored because of X, where X is legacy apps, no money, management resistance, [...]

          Hell, even Hibernate/middlegen has a problem related to this: all it takes is one clueless app developer that scorns DB constraints, and you have a Situation that can cost 10s of K to fix.

          Rails is neat (I'm a pretty big perl bigot, and I like it), but it isn't designed for integration. Folks playing around with it should recognize that up front, so that they don't try to do the wrong thing with it.

        • by Cyberax (705495) on Saturday June 11 2005, @11:21AM (#12789212)
          First, you have some misconeptions about J2EE.

          True, you can't just drop J2EE on your desktop because there's no such _thing_ as J2EE. J2EE is a set of standards (which contains just about everything).

          The only things you need to start developing J2EE applications are: Tomcat (http://jakarta.apache.org/tomcat/index.html [apache.org]), optionally a web-framework (like http://jakarta.apache.org/tapestry/index.html [apache.org]) and you can start developing tomorrow (if you know Java of course) and a decent IDE (http://www.eclipse.org/ [eclipse.org]). It will cost you about $0.

          Java has some metaprogramming featues starting from version 1.5. Right now we're writing application in C++ and Python, so I don't miss metaprogramming features :)

          RoR is extensible, but some features are just very hard to implement: maintaning persistent object identity, complex mappings support, distributed caching and long-running transactions with optimistic locking.

          We had previous expirience in dynamic languages (Python, Perl, PHP). This project was a sort of expirement - we wanted to see what can be done with RoR.
          • ActiveRecord is a *design pattern*. It dictates, to a certain extent, the shape of the database it supports. In reality, using it well is often a relatively good way to get a flexible/good schema from scratch with less db knowledge. It's not completely braindead, but a reasonably aware developer can do much better with the active record limitations than with a blank slate IMHO.

            Rails itself could be put on top of any persistence layer. Instiki uses Madeliene instead of AR and it works fine. It just comes, o
        • by Some Random Username (873177) on Saturday June 11 2005, @12:04PM (#12789427) Journal
          I am sick of seeing this excuse. You can't run around the internet screaming how rails is the greatest thing since the wheel, and how it renders java obsolete because its 100x faster to work with, and then say "its not done" when people actually try to use it. If you are ready to hype something and tell everyone how great it is, then you need to be ready to accept criticism too. If we can't compare it yet because it isn't finished, then stop running around telling us how great it is and how we should all be using it.
  • Can this again help reducing bandwidth consumption in a similar, but prettier way, than html frames?
    • Yes, as the article points out. Ajax has also a problem in common with html frames, as it's difficult to associate content to an uri. The article covers this, too.

      BTW I recommend giving rails a try, it's really a well thought out environment for your web apps. The site linked in my sig is a quick and dirty powerdns + lighttpd + rails experiment on a debian UML host (still on 2.4)
  • by Sv-Manowar (772313) on Saturday June 11 2005, @08:40AM (#12788642) Homepage Journal
    Every time I see material surrounding Ruby on Rails, I'm further convinced that it could be the web application programming foundation that starts to displace PHP as developers start to look at the transition from PHP 4 to PHP 5. Getting an increased install base for ruby on rails, as is the case with php (a fairly difficult task, admittedly) would definitely help no end in increasing the framework's popularity, at least amongst those programming smaller web applications.
      • What a troll. PHP is so low performance and scales so poorly that major web sites moved to it from the Java world, and there are enterprise-focused solutions like Active Grid [activegrid.com] that are now available. It's so un-"useful" that myriad discussion boards and community portals are invariably PHP-based. New development tools and plug-in support for popular design/programming tools are popping up. Each of these web technologies has a sweet spot, but your narrow-minded viewpoint is best revealed by your aversion to "
  • by gavri (663286) on Saturday June 11 2005, @08:43AM (#12788651) Homepage
    Get the Beta book http://pragmaticprogrammer.com/titles/rails/index. html [pragmaticprogrammer.com] If you're interested in Rails at all, this book is all you need.
    • by mav[LAG] (31387) on Saturday June 11 2005, @09:21AM (#12788783)
      Agreed 100%. I bought it last week. Don't be fooled by its "beta" status - it's a thoroughly well written introduction to Rails that takes you through everything you need to know - including building a REAL application (a shopping cart) from start to finish.

      I also bought Programming Ruby by the same author because I want to do more with Ruby than just Rails, but this isn't necessary for those who just need Rails - all Ruby constructs and idioms are cross-referenced with an included introduction to the language.
  • by smitty_one_each (243267) * on Saturday June 11 2005, @08:43AM (#12788654) Homepage Journal
    Then Microsoft created XMLHttpRequest in Internet Explorer 5, which let browser-side JavaScript communicate with the web server in the background without requiring the browser to display a new web page. That made it possible to develop more fluid and responsive web applications. Mozilla soon implemented XMLHttpRequest in its browsers, as did Apple (in the Safari browser) and Opera.
    XMLHttpRequest must have been one of the Web's best kept secrets. Since its debut in 1998, few sites have used it at all, and most developers, if they even knew about it, never used it. Google started to change that when it released a series of high-profile web applications with sleek new UIs powered by XMLHttpRequest.
    a) Microsoft as a first-mover in a technology, or
    b) Microsoft's own technology being used by Google to loosen Redmond's deathgrip on the market?
  • Dont Forget Zope (Score:4, Insightful)

    by salimfadhley (565599) <ip.stodge@org> on Saturday June 11 2005, @08:47AM (#12788666) Homepage Journal
    Of course Rails isnt the only completely F/OSS web application framework; Rails is best when you want to put relational data online: It's edge is it's simplicity.

    On the other hand remember Zope - If you can get your head around Aqusition, the ZODB and Product Deveopment then Zope is a super-fast development platform.

    • If you can get your head around Aqusition[sic], the ZODB and Product Deveopment[sic] then Zope is a super-fast development platform.

      I recenty became the web administrator at a small university and the college I work for uses Zope. I knew a little Zope and Python beforehand and it helped me get the job. I was all hot and heavy to switch them to a PHP/MySQL solution, though my first love is Perl. Doing stuff in PHP was fast. As I studied Zope and Python more and more I came to realize that my initial impre
  • by udderly (890305) on Saturday June 11 2005, @08:48AM (#12788668)
    From the article:The most visually impressive of these is Google Maps, which gives you the illusion of being able to drag around an infinitely sizable map in its little map window.

    It's illusory alright, when I start at the US and scroll due west the first thing that I come to is the UK. Where'd all the other countries go?
  • Ajax grew from one of those hated, non-standard Microsoft features.
  • AJAX meme (Score:3, Informative)

    by broward (416376) <broward@re a l m e me.com> on Saturday June 11 2005, @08:53AM (#12788681) Homepage
    The rise in AJAX is almost solely due to the recent AdaptivePath article. I'm not sure it's a major trend.

    http://www.realmeme.com/miner/technology/ajaxDejan ews.png [realmeme.com]

    However, Ruby on Rails is clearly rising,
    moving steadily upward for over a year. Thanks to a reader for bringing this to my attention.

    http://www.realmeme.com/miner/technology/hibernate vsrubyDejanews.png [realmeme.com]
    • Re:AJAX meme (Score:4, Informative)

      by shashark (836922) on Saturday June 11 2005, @09:19AM (#12788776)
      From http://en.wikipedia.org/wiki/AJAX [wikipedia.org]

      There have been some critics of the term AJAX, claiming that the Adaptive Path [wikipedia.org] consultancy who created it [com.com] are using it as a marketing vehicle (and as a meme [wikipedia.org]) for previously used techniques [25hoursaday.com]

      It has been pointed out that the AJAX technologies did not have a common name before, and that some welcome a unifying term for the process. However it is also reported that the Google engineers who have created the most prominent applications using this technique consider their technologies as 'Javascript'

      AJAX is not a new approach of building software. From a higher perspective the presentation layer is like a form and a programming layer behind handling the events, commonly known in programming terms as MVC [wikipedia.org]. This kind of programming is very well known in older programming environments like Delphi, MFC, Visual Basic, Oracle ADF, and Windows Forms, just to name a few. Applications using this model of programming have been around for years: Microsoft Outlook Web Access using WebDAV and the Web based ERP system P2plus using web services directly from the browser. However, because there are no standards available for the communication model behind previous implementations, all use proprietary extensions.

      A new aspect to AJAX is that there are now multiple browsers that can be used to realize this type of application, as opposed to earlier technologies which were frequently limited only to Microsoft's [wikipedia.org] Internet Explorer [wikipedia.org].

    • AJAX is just a catchy name cooked up by a few guys and embraced by O'Reilly, who no doubt are in the works with about 2 dozen books on the topic.
  • by Peter Cooper (660482) on Saturday June 11 2005, @09:21AM (#12788784) Journal
    Most of this product comparison site [godefy.com] was developed in Ruby on Rails within the last two months, and it already does more than Froogle, has more search features, etc.

    I've also developed a large marketing system for the restaurant industry in Rails which lets restauranteurs develop e-cards, e-gifts, and send them to their customers on certain days.. or certain days away from their birthdays, etc.. and that will be going fully live soon.

    My 10,000 user strong RSS Digest [bigbold.com] will be making the leap to Rails soon (July 1st) and this is a system driving over half a million uses a day.

    I developed a del.icio.us-style tagged Code Snippets [bigbold.com] site in Rails within two days! It's had further refinements since then, but less than two weeks after launch, it was getting thousands of pageviews a day and hundreds of visitors a day from Google.

    I was ready to give up development work 6 months ago, and now it's the most fun and profitable work out there for me. Ruby on Rails deserves the attention it's getting. You can put together your ideas in a fraction of the time you'd have ever imagined.
  • First thing this title reminded me of was Cheech & Chong's Up In Smoke. That chick does a couple rails of ajax that Chong was cuttin up for fun. I was surprised no one else posted about it.
  • by GoofyBoy (44399) on Saturday June 11 2005, @09:37AM (#12788835) Journal
    Time to add Ajax and Rails on my resume!

    (To all potential employeers: I kid!)
  • Has the performance of Ruby gotten much better since the early days?

    I started using Ruby a long time ago, back when no one knew about it. I liked it because it was like a better Perl (better OO support but with Perl syntax). However, I quickly tired of its lackluster performance. I mean it was a lot slower than even Perl or Python. I eventually moved on hoping to return when Rudy had matured and performance was kicking. Last time I checked the performance was the same as always. So much for the "tune
  • Get the book (Score:4, Informative)

    by Ridgelift (228977) on Saturday June 11 2005, @09:46AM (#12788865)
    I first heard of Ruby on Rails here on Slashdot [slashdot.org]. Although Rails is dead simple once you get it, getting to the "ah ha" point is a bit of a steep climb.

    If you want to learn Ajax in Rails, the best thing I've read has been Dave Thomas' new book "Agile Web Development with Ruby on Rails" [pragmaticprogrammer.com]. The author of Ruby on Rails itself, David Heinemeier Hansson, is also a co-author. Great book, absolutely fantastic web development framework.
  • ASP.Net 2.0 (Score:3, Informative)

    by DigitlDud (443365) on Saturday June 11 2005, @12:03PM (#12789419)
    ASP.NET 2.0 does this also. You can define client callbacks on web controls which let you run code on the server-side and get the results back without reposting the page.
    http://www.developer.com/net/asp/article.php/35068 96 [developer.com]
    • In just about every way you could possibly imagine.
    • Re:ASP.NET (Score:2, Funny)

      by Anonymous Coward
      How is eating feces not better than ASP.NET?
        • What features of ASP.NET and J2EE are so unique and essential that they make them a "vast improvement" and the only viable choices for larger web apps?

          You don't understand one of the most important necessary preconditions for a larger web app in corporations - someone to approve it.

          J2EE and ASP.NET have rich organizations that they can loan you to take key decision makers (CFOs) out to lunch to help approve expensive J2EE projects.

          Compared to the Oracle sales guy flying my previous CFO out to some g

    • It's possible, but not a good idea. RoR is like a Mac. It thrives on integration. Running the Darwinport of XMMS may work for you, but using iTunes is ultimately the overall better solution.

      Hope that helps.

      (This comes from someone who runs XMMS on a Mac ;)