Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Programming IT Technology

Ajax On Rails 235

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."
This discussion has been archived. No new comments can be posted.

Ajax On Rails

Comments Filter:
  • by Sv-Manowar ( 772313 ) on Saturday June 11, 2005 @09: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.
  • by smittyoneeach ( 243267 ) * on Saturday June 11, 2005 @09: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 ) <[gro.egdots] [ta] [pi]> on Saturday June 11, 2005 @09: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.

  • by TrappedByMyself ( 861094 ) on Saturday June 11, 2005 @09:49AM (#12788670)
    Ajax grew from one of those hated, non-standard Microsoft features.
  • by systems ( 764012 ) on Saturday June 11, 2005 @11:07AM (#12788949)
    You should probably read this paper on scripting [pacbell.net]
    The moral is, no matter how complex a system build on Ruby will get, it will always be more simple to use than a system build on Java, just because Java carries the characteristics of a systems programming language while Ruby carries the characteristics of a scripting programming language.
  • by Cyberax ( 705495 ) on Saturday June 11, 2005 @11:26AM (#12789019)
    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.
  • by Some Random Username ( 873177 ) on Saturday June 11, 2005 @01: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.
  • by Anonymous Coward on Saturday June 11, 2005 @01:53PM (#12789685)
    Your comments on Ruby on Rails are utter nonsense. Clearly you've never programmed in Lisp or pretty much any other dynamic language, and have no clue what it means to generate the body of function at run-time. If you don't like what Rails is doing, just create your own version of the method, and Rails won't replace it.

    A web application framework that includes a web application program generator

    No, Rails generates many methods "on the fly", but it doesn't generate any program for you. You still have to write the program. However, there are many cases where if you don't write your own code for something, Rails will supply a "default". When you get started writing your app, do you really need to waste time writing code to "display the template"? No, rails does it for you and chooses the template with the same name as the action. However if you need it to do something different, which is common, you simply have to add the one line of code to render the template. This saves a lot of time!

    Think of it this way: when you log into a Unix shell, you need to "ls" some files, "cp" some files, etc. Luckily, most Unix shells have those commands available, already written for you. Does that mean you can't write your own? No. Does that mean you can't customize what they do? No, they have lots of flags. Do you often need to write your own? No, usually the existing functions are good enough.

    That's what Rails is: a domain-specific language for writing web apps. Of course you can throw all that out the window and write *any code you want*, Ruby is a general programming language, but it's kinda silly to waste your time like that.

    a database

    what database?

    ,and the Ruby language (and optionally a web server written in Ruby).

    Rails doesn't "include" the Ruby language! And the web server is part of the Ruby library, not Rails!

    The program generator accepts a description of database tables and generates generic Ruby code (web pages) to do CRUD (create, read, update, delete) maintenance of each table.

    Man, you are really lost. ActiveRecord (a PART of Rails, you can use your own model classes) queries the DB to find methods *if you haven't defined them*. It also makes time-saving assumptions like, the name of the table is derived from the name of your class. Most people of course, use the defaults.

    With very little initial effort one can create a (very) basic web application.

    Delete "initial". Delete "(very) basic". Replace "create" with "create and maintain".

    Same weaknesses as most one-way program generators:

    Rails is not a code generator. Do you understand? No .rb files are created. It's all done dynamically, on the fly, with well-factored libraries. You can rewrite or replace any part of it.

    Once a site is generated, modifying the generated code slows things to a near-halt since

    Man, when you're in a hole, stop digging. All you have to do to "modify" the "generated code" is write a method that overrides the default. If you're an OO programmer you already understand the concept. (And no, it's not hard to do. If your table has a "first_name" column, and you want to override Rails' generated method, name your method "first_name". The original value is in a hash called "@attributes". It ain't rocket science).

    There is no round-trip capability (i.e., if you hand-coded changes to a web app, regenerating the app in RoR will wipe out those changes.

    You seriously need to take 10 minutes to look at Rails so you can realize how ridiculous this is.

    Both RoR and AJAX are being pitched to communities not particularly skilled in development.

    If this community doesn't include folks like you, count me in.

    I've been coding since before the web, for nearly 20 years. I've done "real" MVC. Rails is a collection of all the good ideas people have been using for years, all in one pac

  • Re:ASP.NET (Score:3, Insightful)

    by team99parody ( 880782 ) on Saturday June 11, 2005 @02:46PM (#12789976) Homepage
    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 golf conference to pitch their J2EE-based framework, Rails has NOTHING..

    I speak from experience - We had the case of One Oracle Salesguy against EVERY SINGLE internally developer telling this CFO that the Oracle framework sucked and that even Oracle was moving to Tomcat. Guess who won.

    That feature - the lunch&conference&golf budget - and that feature alone is enough to make J2EE and ASP.NET win most corporate environments.

  • by zorander ( 85178 ) on Saturday June 11, 2005 @05:54PM (#12790969) Homepage Journal
    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, out of box, with AR installed and that is the most natural. If you write your own ORM, it can work with rails. People have had success working with legacy schemas by frontending them with postgres views that behave more in the way that AR expects.

    In any case, rails is more suited to new projects with new databases at this time. AR doesn't propose nonstandard database design in principle, it just dictates certain facts (mostly naming conventions for columns/tables) which can often be overridden. The most obvious one is that rails expects non-join tables to have an INT(11) PRIMARY KEY AUTO_INCREMENT field. Not being a DBA, I don't know what database design patterns are out there. Being a performance and efficiency conscious developer, I don't see how AR's patterns could get you into a performance or maintainability muddle by using them on a new project.
  • Re:Ruby? (Score:1, Insightful)

    by I Like Pudding ( 323363 ) on Saturday June 11, 2005 @06:51PM (#12791298)
    So much for the "tune for performance later" crap. When will programmers learn that doesn't actually work? You need a good design that includes tuning for performance early on.

    Algorithmic and architectural optimization is best accomplished after you fully understand the problem domain, and low-level code optimization is best done only after you've optimized the big stuff. Most of the time, you don't go in knowing exactly what you're doing, so you can't make big gains without refactoring a ton. In fact, the more you design up front, the more work it is to go back and change things around. This is one reason why iterative development methodologies are gaining in popularity.

    Our example, Ruby, is currently a 1.x release. A feature-complete 1.x release, as far as I'm concerned. Now, Ruby 2's VM is planned to be JIT and generally faster. But, I guess it won't because apparantly refactoring "doesn't actually work". Just the other day I was writing some new code that ran faster, but it actually didn't because, see, I had written slower code to begin with, which makes all succeeding versions work at exactly the same speed. Yeah.

    -/ILP/-

    So much for make it work, make it right, make it fast
  • by cquark ( 246669 ) on Saturday June 11, 2005 @09:57PM (#12792242)
    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 size of the project.

    The other advantage of dynamic languages is flexibility. While Java has limited support for features like reflection and generics, dynamic languages have offered much more powerful and easy to use versions of these features for years. Java is also missing other dynamic features like closures and metaprogramming. Groovy's feature list is an inverted list of many of the limitations in Java's dynamic capabilities.

    Java's main contribution to programming languages isn't any new feature. It doesn't have any significant new features, and most of its main features like object orientation, byte-compilation/VM and primitive concurrency were in other languages like Simula and Pascal in the 1960s or 1970s. Java's primary contribution is that it was well marketed and that its limited dynamic features have inspired a large number of programmers to want more of the flexibility that languages like Scheme and Smalltalk offered decades ago.
  • by shutdown -p now ( 807394 ) on Sunday June 12, 2005 @12:14AM (#12792892) Journal
    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.
    You forgot the "learn J2EE" part, which is going to be a task at least a magnitude more complex than learning Java itself.

If you think the system is working, ask someone who's waiting for a prompt.

Working...