Sponsored by newegg
Ready. Set. Shop view!
newegg.com - Newegg.com Black Friday Sale starting 11/25 3PM PST. No Lines, No Crowds, Click and Save.
41 Comments
- rabagaz, on 10/12/2007, -1/+11rest on rails ... isn't that dangerous?
- corbanbrook, on 10/12/2007, -2/+8SOAP isnt the only protocol to use with a web service. SOAP, XML-RPC, REST(HTTP), just because you were taught to use the most bloated and complex one doesnt mean everyone has to.
- Kam3k, on 10/12/2007, -1/+6"You are absolutely right! What can it do that other languages such as C# cant? "
Absolutely nothing, or you could use Perl, or assembler to do any of this. The point is making the process more productive and enjoyable, and the end product more maintainable which Rails certainly does - covertbadger, on 10/12/2007, -1/+6@Obsidian743
CORBA has more or less died a deserved death, though it still lives on as the basis for bonobo in the GNOME desktop.
SOAP is still around - we use it where I work - but it's a pain, since you really need to be using java or .Net if you want a decent toolkit for working with wsdl etc. The SOAP stuff available for python and ruby is pretty flaky IME (though perl and php aren't too bad, though very far from perfect) so you often end up manually constructing SOAP envelopes and POSTing them to the server, then pulling the response into a DOM object to work with it. Not nice. At least with REST I'm not constrained by XML so much, and can format responses as JSON or python hashtables or whatever. - anon52, on 10/12/2007, -1/+6Again, an excellent article from IBM developerworks. I've only looked at 20-30 of these across a pretty wide variety of subjects, and each one has been clear and well edited. Kudos.
- nofxjunkee, on 10/12/2007, -1/+5Sorry, but that's not a convincing argument. I'm still a "kid" (23 if you're curious), but I've been programming for 10 years in a few languages, from VB to PHP, Motorola 68HC11 assembly, C, Perl, JavaScript, a tiny bit of Java, and others.
To me, Python and Ruby are really nice OO languages that make coding enjoyable, interesting, and productive. I actually really enjoyed assembly, and like C. Perl was great but when I learnt Python and Ruby they trumped PHP by a long shot, and Perl to a lesser extent mainly due to the clean syntax and focus on OO from the beginning.
You just gotta love that _everything_ is an extensible object in Ruby. 5.times do {...} just feels so nice. Not to mention once you get used to blocks and closures you miss them in other languages.
Going back to something like VB now would be painful. It's not because I'm a beginner or because I can't code, it's the power in languages like Python and Ruby that intrigue me. You can write C extensions for Ruby in Ruby. Ruby's OO-ness lets people do things like Rails does such as 5.days.from_now. After that, who really wants to type 5*24*3600. - ThinkFr33ly, on 10/12/2007, -1/+5"SOAP isnt the only protocol to use with a web service. SOAP, XML-RPC, REST(HTTP), just because you were taught to use the most bloated and complex one doesnt mean everyone has to."
Why are web services great? Because they allow external entites to easily utilize a service you expose. But there are significant complexities involved when dealing with exposing these services in a loosely coupled environment.
With XML-RPC and REST, there is essentially no ability to version these services, nor is there an ability to do a wide variety of usually important tasks such as routing, transactional support, anything but simple transport level security, etc. SOAP enables these things, XML-RPC and REST do not. (Not to mention the fact there is no way to automatically discover the contact information for the exposed services automatically.)
XML-RPC and REST are good for trivial applications with little need to expose them to 3rd parties. But if you're using a web service internally, chances are you don't know what you're doing.
Perhaps you should learn a bit more about real applicaiton development before you call something bloated. - covertbadger, on 10/12/2007, -1/+5"This is little more than a glorified web page that exposes an XML chunk. This is not a web service."
Er, yes it is. I think you've been sucking at the Sun/MS teat a bit too long. You do realise that under the hood a SOAP webservice is just an HTTP POST resulting in an XML response, yes? Exactly the same as REST, except for a bit of tool support. - Obsidian743, on 10/12/2007, -1/+5WTF ever happened to good old fashion things like SOAP and CORBA?
- tybris, on 10/12/2007, -3/+7Nope. I don't understand how can people enjoy the lack of control and hardly elegant looking syntax of Ruby on Rails.
- nofxjunkee, on 10/12/2007, -0/+3type casting... uh, ... what? you realize that there's no type casting in ruby, i hope...
- bmcnitt, on 10/12/2007, -0/+3REST on Rails is probably ok. Maybe you're thinking about Ren and Stimpy's "Don't Whiz on the Electric Fence"?
http://scruss.com/wordpress/wp-content/dontwhiz.jpg - hanshasuro, on 10/12/2007, -0/+2IBM DW does put out good articles. I also think it helps that it was written by Bruce Tate.
- rodrigo74, on 10/12/2007, -2/+4See, there's a "Duplicate Story"option in the "Bury Story" list, just use it. No need to whine.
- Obsidian743, on 10/12/2007, -0/+2Granted, I haven't really written anything extensive in Ruby myself, but I've ready plenty of it and have tried to drag myself through tutorials. I feel similarly about Python but I have been using Python in various projects off and on for almost a decade though I never really enjoyed it. They just don't feel very cohesive or intuitive but that may be because I come from a more traditional background. Apparently to many newbies who haven't immersed themselves in more classical OOP languages/frameworks they feel it's easier to understand and more effective to code in Python? I have no problem understanding any given code, but I just can't help but think "why?!" I think maybe I just don't like the syntax or the style more than the architecture and pragmatics. Maybe, to kids getting in CS, Python and Ruby are great languages to use from a design standpoint but I felt it divorces the developer from the true science and technical part of software development.
Of course, IMHO. But one thing I'll never understand is how someone can say it's less "ugly" than Perl or Java. Perhaps we have different ways of looking at how "beautiful" code is or isn't. - rodrigo74, on 10/12/2007, -0/+2@whoreman: It's not about "can do it", but "how you do it" and how much fun you have in the process.
But the whole argument against or for this is or that programming language is pointless. People have different ways of thinking and programming, it's just a question of finding the language that fits better your style, like a pair of sneakers. You may recommend your favorite programming language to someone who seems to have a similar approach, but that's pretty much it.
Me? I love Python, but although Ruby is supposed to be very similar, I just couldn't get a long well of some of its syntax who seemed to Perl-ish to me. So I'm sticking with Python and C# at the moment. - shadedream, on 10/12/2007, -1/+3Here's to wishing there was a "dupe-nazi" mod down for users.... though I guess block is along those lines.
- flash200, on 10/12/2007, -1/+3I haven't used Rails yet, but I'll be glad for any simplified FOSS options for web services.
I spent a few weeks trying to get started with Java EE (using Geronimo) and found what was by far the steepest knowledge barrier I'd ever encountered just to get a simple web service servlet running (which I never even got close to succeeding at it).
By comparison, it took half as long to learn how to compile and configure a LAMP server from scratch (including Perl, Python, and Ruby) and to write some practice scripts.
The knowledge barrier might not be a problem in the enterprise space, but for small companies, or college students picking up new skills in their spare time, I think it becomes a significant factor. - lalee, on 10/12/2007, -0/+2Yes, but can you Auto-Generate a client from that REST webservice? With a WSDL, I can use wsdl2java, wsdl2ruby, or just make a Web Reference in .NET. The real point being, without a WSDL, you just don't know what the structure of that REST service is.
You can't have a useful, cross-platform, enterprise-friendly Web Service without a WSDL. Like the original author said, REST is OK for small trivial apps where you have control over both ends of the service. - CaughtThinking, on 10/12/2007, -2/+3In Java 1.6, you say
@Webservice.
and you're done.
Wow Rails is so EASY. That this article is Bruce Tate isn't surprising. He's one of 7 people in the Java community interested in Rails. - covertbadger, on 10/12/2007, -1/+2@Obsidian743
Ruby's alright, much less ugly than java or perl or (god forbid) VB, but not a patch on python or haskell. Haskell is so pretty that it has become my default for visualising certain algorithms - if I need to implement quicksort, I start by visualising the haskell implementation (which is two lines long and more expressive than a pseudocode implementation or a plain English description) and then convert it to whatever language I'm working in. - lalee, on 10/12/2007, -0/+1@covertbadger,
Call it a crutch if you must, but IMHO doing things the RESTful way still isn't enterprise friendly. Take your example of receiving a "nil" across the wire: With a proper restriction and maybe an enumeration defined in the WSDL, both ends would know the data field ranges, and (even better), they'd know what values are valid before sending them across the wire.
It's also (probably) a bug to send nil over the wire, if the WSDL specifies the element with a minOccurs=0.
Adequate Documentation just doesn't exist when you start to do Real-World Enterprise programming. You can gripe and bitch at vendors to give you documentation all you want, but if they're dragging ass and you've got a deadline approaching, it's YOUR butt on the line, not theirs. At least with a WSDL, you can fumble around with that "crutch" auto-generated code and attempt to figure out what goes where.
I'm not saying REST doesn't have its place.. it's just not as useful technology for my needs without a WSDL. - merr, on 10/12/2007, -0/+1Why does the person that suggests Django get modded down? Just because it isn't Rails doesn't make this a bad comment. I develop in Rails, but I've also tried Django and the only reason I prefer the former is because I'm more comfortable with Ruby than Python. IMO, Django is just as usable and elegant as RoR... Adrian Holovaty just chose a dumb language. =P
- nofxjunkee, on 10/12/2007, -1/+2btw, you still haven't given us any examples of how Ruby is an ugly-ass language.
what would you suggest us kids learn? i'm curious, because there are at least a hundred languages I don't know. i know some scheme, i've read a bit about haskell and it's also very interesting. I think I'd learn Java properly before C++, but haven't done more in either than some trivial program to learn the basics of the languages. C# would probably also be on the list to learn, not because I think it sounds that awesome but because I think it's useful to know. - nofxjunkee, on 10/12/2007, -1/+2You're an old fart. ;-) Ruby's clean and powerful. I suggest you read a couple chapters of the pixaxe book, even the old one that's free online, before you write it off.
Out of curiosity, what do you think of python? - veza, on 10/12/2007, -0/+1aforonda : you can use of course rails, php, jsp, dot net framework (you need MONO for it) , you can also use python based frameworks ( Django, Turbogears etc.)
to install rails, use command line and type sudo apt-get install rails , it will ask your "admin" password, type it in and it will start download. Full document is here : http://wiki.rubyonrails.org/rails/pages/RailsOnUbuntu - aforonda, on 10/12/2007, -1/+1I'm a linux newbie and wanted to know what development frameworks run on linux/ubuntu? i.e. Rails, .nET (jk), etc...
- ThinkFr33ly, on 10/12/2007, -4/+4Except a real web service exposes a WSDL and response with a SOAP Envelope.
This is little more than a glorified web page that exposes an XML chunk. This is not a web service.
To make this a web service you would need to write your WSDL and properly follow that WSDL in your respose. And that's a considerable ammount of work.
In .NET this task is completely trivial thanks to the fact that the WSDL, SOAP Response, and even the XML is taken care of for you automatically. You simply write something like:
pubic class MyService : WebService
{
[WebMethod()]
public List FindPeople(string someCriteria){ ... do work, return list.}
}
Done. Not sure how much more elegant you can get than that. The WSDL would automatically be generated for you, as would the XML for your results and the SOAP Envelope. - markdav, on 10/12/2007, -1/+1@Obsidian - Horrible, ugly-ass language?
From what little I've seen it doesn't seem quite that bad. The code in the article was easily understandable and there are some nice features (closures, etc). What did you find so bad about it (e.g. features, syntax, etc)? - inactive, on 10/12/2007, -4/+3You are absolutely right! What can it do that other languages such as C# cant?
- covertbadger, on 10/12/2007, -1/+0@lalee
"Yes, but can you Auto-Generate a client from that REST webservice? With a WSDL, I can use wsdl2java, wsdl2ruby, or just make a Web Reference in .NET."
Auto-generation is a crutch. It takes me about 5 lines of code to create an http connection that can issue a POST, then once it's wrapped up in a function I never need to worry about it again. And what do you do when wsdl2java or wsdl2ruby don't work properly? My company publishes web services that rely heavily on arrays of large aggregated complex types. wsdl2ruby has never successfully generated client code for it, and we always end up writing the client manually, which is far more complex than writing a REST client. If you think relying on a tool to cover up gross complexity is a good idea, you've obviously never worked with MFC and some day soon you're going to get an extremely rude awakening. I just hope you have a good idea of what's under the hood when that day arrives.
"The real point being, without a WSDL, you just don't know what the structure of that REST service is."
Uh, documentation?
"You can't have a useful, cross-platform, enterprise-friendly Web Service without a WSDL. Like the original author said, REST is OK for small trivial apps where you have control over both ends of the service."
Tripe. People who think that SOAP means web services are automatically cross-platform and language-agnostic haven't worked with anything of a decent size. Try having a java web service return a null value when the .Net client wants to deserialize it into a non-nullable type. And I'm sure Amazon will be pleased to hear of your wisdom regarding REST not working in the enterprise, given that their REST services are an order of magnitude more popular than their equivalent SOAP services. - puggy, on 10/12/2007, -6/+4The problem with Ruby on Rails is too much commercialization among the community and the useless conferences they put up. Instead of focusing on development, everyone is instead doing redundant talks, symposiums, conferences, feasts, and gatherings. The core developers leave out some key topics in the documentation, and write books for everyone to buy. Just look at the newsgroups. If someone asks a basic question, most of the replies are "go check out this book and that book".
- cultofmetatron, on 10/12/2007, -3/+1ever tried turbo gears or Django?
- inactive, on 10/12/2007, -6/+2I have used Rails and I hated it! I wrote some two identical pieces of code (actually wrote it once and copy and pasted it) and used two different SQL statements but the results were very very different - the first worked as i had expected but the second gave me an untype-casted object that I couldnt seem to figure out how to typcast and ended up using some method to use it untype-casted
Give me .net or java any day! - Obsidian743, on 10/12/2007, -13/+8Okay, I'm just going to go against popular opinion here and ask: Am I the only one thinks that Ruby is a horrible, ugly-ass language? Or am I just an old fart?
- rushdy, on 10/12/2007, -6/+1An elegant approach would be to use Python.
- jibblies, on 10/12/2007, -9/+4I just wish someone would give this Rails crap a rest.
- blogrepublic, on 10/12/2007, -8/+3I think Ruby on Rails is way overrated.
- DuoPros, on 10/12/2007, -10/+5class CreatePeople < ActiveRecord::Migration
def self.up
create_table :people do |t|
t.column :first_name, :string, :limit => 40
t.column :last_name, :string, :limit => 40
t.column :email, :string, :limit => 40
t.column :phone, :string, :limit => 15
end
end
def self.down
drop_table :people
end
end
/Monotone voice: I understand. - maverick999, on 10/12/2007, -9/+1Duplicate Story: http://digg.com/programming/Web_services_using_REST_on_Rails_and_Java
- maverick999, on 10/12/2007, -18/+1DUPE: http://digg.com/programming/Web_services_using_REST_on_Rails_and_Java


What is Digg?