Live data from Hacker News

Ask HN: Ruby on Rails why the hype?

news.ycombinator.com

21–29 of 29 posts

Re: Ask HN: Ruby on Rails why the hype?

#21
post #2

Do you have a specific example of something you feel Rails doesn't do? Maybe that way somebody can tell you where in the rails ecosystem that falls.

Here is an example: User uploads and image to be OCR'ed and the resulting text is to be displayed (in process). Say I have the OCR algorithim (the business) in a c library. In the .Net world I would create a dll from the library, reference it and call the ocr function and display the results. Does RoR have the ability to include external late binding libraries where the "business" can be implemented?

With Ruby, anything you can call from the command line can work via system() (http://ruby-doc.org/core/classes/Kernel.html#M005971).

Alternatively, you can wrap into a gem with a C extension and call it with all the Ruby goodness you should expect (recommended route).

Pseudo-code (wordier than it need be):

class MyModel

  def self.ocr(file)

     result = system("my_ocr_prog", file.path)

     return result

  end
end

A good example of a gem with a C extension might be RMagick (http://github.com/rmagick/rmagick/tree/master/ext/RMagick/)

Re: Ask HN: Ruby on Rails why the hype?

#22
post #20

RoR has a lot of advantages for rapid development and prototyping early on. I think over the course of the development cycle, the advantages even out with other frameworks. In other words, for the first 10% of your development, you'll get much more accomplished than if you decided to use pure Ruby (or even Django or Symfony). However, this "magic" comes at a price, and at some point you will hit a wall, and if you're…

What is the difference between Rails and Django in the first 10% of development? I'm pretty into Django right now, but haven't yet given Rails a shot other than reading a short book about it.

Mostly, python v. ruby; they're different flavors of a pretty similar Kool-Aid.

Re: Ask HN: Ruby on Rails why the hype?

#23
post #20

RoR has a lot of advantages for rapid development and prototyping early on. I think over the course of the development cycle, the advantages even out with other frameworks. In other words, for the first 10% of your development, you'll get much more accomplished than if you decided to use pure Ruby (or even Django or Symfony). However, this "magic" comes at a price, and at some point you will hit a wall, and if you're…

What is the difference between Rails and Django in the first 10% of development? I'm pretty into Django right now, but haven't yet given Rails a shot other than reading a short book about it.

Although this has been just my experience, Rails' convention over configuration means that there is minimal configuration needed to get a new app up and running. I have found that Django needs more configuration (then again I'm a Django novice). So perhaps one spends a greater proportion of the first 10% just doing config with Django.

Re: Ask HN: Ruby on Rails why the hype?

#24

RoR has a lot of advantages for rapid development and prototyping early on. I think over the course of the development cycle, the advantages even out with other frameworks. In other words, for the first 10% of your development, you'll get much more accomplished than if you decided to use pure Ruby (or even Django or Symfony). However, this "magic" comes at a price, and at some point you will hit a wall, and if you're…

I've heard these references to "hitting a wall" a few times now, and it's a bit perplexing. From what I gather, it means that you'll get to a point where you need to understand more about the underlying framework in order to accomplish a particular task. Isn't this a given in any environment? Perhaps in some other stacks, you need to get your hands way dirtier way earlier, so the learning curve is much more spread out. But I don't think I've ever run into an issue with Rails where I've thought "oh no, the framework can't do this... time to start over." It's just Ruby, the entire thing is well documented, and there's a very helpful community glad to answer just about any any question you might have (in my experience, anyway).

That isn't to say that Rails is a panacea, or even appropriate for projects of every shape and size. But if you're building an MVC web app, then it's really well thought out, allows you to be very productive, and in my dealings with it, those benefits don't go away, even as your application grows significantly in scope and complexity. YMMV etc etc...

Re: Ask HN: Ruby on Rails why the hype?

#25
post #2

Do you have a specific example of something you feel Rails doesn't do? Maybe that way somebody can tell you where in the rails ecosystem that falls.

Here is an example: User uploads and image to be OCR'ed and the resulting text is to be displayed (in process). Say I have the OCR algorithim (the business) in a c library. In the .Net world I would create a dll from the library, reference it and call the ocr function and display the results. Does RoR have the ability to include external late binding libraries where the "business" can be implemented?

You could certainly do this in-process, either shelling out or by creating a gem that calls your C library. Additionally, if you're fronting your app with a server like nginx, you could use something akin to http://www.grid.net.ru/nginx/upload.en.html, so you wouldn't have to buffer the entire image into your Rails process.

Re: Ask HN: Ruby on Rails why the hype?

#26
post #2

Do you have a specific example of something you feel Rails doesn't do? Maybe that way somebody can tell you where in the rails ecosystem that falls.

How about some "complex" validation....lets say (just for example) you try to change the STATUS of an employee....if there are all sorts of business rules that have to be run through to validate whether it is valid to set the status to this new value....how & where in the rails framework would one write this code?

Re: Ask HN: Ruby on Rails why the hype?

#27
post #2

Do you have a specific example of something you feel Rails doesn't do? Maybe that way somebody can tell you where in the rails ecosystem that falls.

Here is an example: User uploads and image to be OCR'ed and the resulting text is to be displayed (in process). Say I have the OCR algorithim (the business) in a c library. In the .Net world I would create a dll from the library, reference it and call the ocr function and display the results. Does RoR have the ability to include external late binding libraries where the "business" can be implemented?

You've got two options for integrating C code in any Ruby application: RubyInline and Ruby C extensions.

RubyInline is incredibly powerful. You can drop C straight in to your Ruby scripts for operations that would be too computationally intensive for Ruby.

Ruby C extensions are more powerful, as they allow you to call C code from within Ruby. However, it does require some alteration to the C code, so this won't do if you have a closed source C library.

As others have suggested, there are ways to make system calls from within Ruby, and with the way things work on Unix systems, that's a perfectly acceptable alternative.

Also, to address your question more generally, there's nothing that says you must constrain all your code to the confines of MVC logic. Gems are packages of Ruby code. If you find that you need a set of objects to handle complex business requirements, you could always package up that code as a Gem for use and distribution within your company. Gems are very easy to build and include in your projects, so the barrier of entry is very low.

I've been working with Rails since version 0.7. I've seen a lot of developers convince themselves that their problem doesn't fit in to the Rails box. While I always advocate using the right tool for the job, most people are wrong when they reach the belief that what they're doing isn't a good fit for Rails. It's usually an inability to understand where their ideas fit in to the broad scope of the MVC design pattern.

Having said that, there are plenty of ideas that don't fit Ruby on Rails, or MVC for that matter. Twitter was a great example. You don't implement a ultra-high-volume, low-package-size messaging system using an off-the-shelf MVC framework.

Very few problems are Twitter, however. Most business problems are 90% CRUD with a sprinkles of interesting work in between. Rails is a great fit for these types of projects because the "magic" peels away gracefully when you need it to.

There is another aspect of Rails that doesn't get much lip service. Rails is great because it makes a lot of decisions for you. The developers call this being "opinionated software". Maybe I'm just a little too humble, but a lot of the guys that work on Rails are bigger thinkers than I am when it comes to software frameworks. A lot of people won't admit it, but there is plenty of software that tries to copy the Rails way of doing things. That's at least some level of acknowledgement that they're things right. What I'm getting at is that there is a lot to learn from digging in to Rails on a deeper level.

The "Rails way" also extends beyond actual development and in to deployment strategies. Before we moved to Rails, we didn't have a sound deployment strategy. Rails developers just assume that you're going to use some type of SCM and deployment strategy. The most common being Rails/Git/Capistrano. If you say on the beaten path, there is a tremendous wealth of information available for all manner of deployment strategies. Again, these solutions fork for 99% of use cases. If you're a one-percenter, you're not going to benefit much from Rails, but make sure you've qualified your case and not just suffering from a case of "I'm smarter than the world."

That wraps up my thoughts on the matter. I'm sure there are other perspectives out there.

Re: Ask HN: Ruby on Rails why the hype?

#29

RoR has a lot of advantages for rapid development and prototyping early on. I think over the course of the development cycle, the advantages even out with other frameworks. In other words, for the first 10% of your development, you'll get much more accomplished than if you decided to use pure Ruby (or even Django or Symfony). However, this "magic" comes at a price, and at some point you will hit a wall, and if you're…

> However, this "magic" comes at a price, and at some point you will hit a wall

Only that wall is at the end of a 50 mile runway. Don't let these sorts of pronouncements scare you ... by the time you get to this bogey man 'wall' you're going to be doing a million page views a day, dealing with replicated databases or just generally dealing with really big big problems. And even then you'll have a very supportive community of people who have had the same exact problem ... (example ... github coming up with Unicorn to help them server pages in a better way for them).

Long story short, for starting out and even a good ways into any application lifecycle. Rails is going to do you just fine.

Post reply on HN