Setting up Ruby on Rails beginner netbeans - ruby-on-rails

WOW. Setting up is complicated, can anyone recommend a link or provide me with some advice.
I have two options, a Linux Hosting server with it pre-installed or through NetBeans.
Sorry for the generic question.

I think that you are going to want both of your options. You will want to have a hosting server with Rails installed on which you will deploy your Rails application. You will want to use NetBeans on your development machine to develop the application in the first place.
It is good to note that using NetBeans is not mandatory; you can -- and many others do -- use any random text editor for building Rails applications. However, I use NetBeans for Rails development, as I find that it greatly increases my productivity.
Don't let yourself get overwhelmed by the feeling of complexity at the beginning. While getting on to the learning curve can be tricky for any system, I believe that climbing the curve with Rails is easier than with many or most other web application frameworks.

Related

Developing Ruby and Rails in Windows? Or Linux VM

I've been doing front end web work for a while. I maintain several company websites and etc, mostly on Joomla. I'm getting bored with it and I really want to expand in to development. I have a few web app ideas for the company and some personal stuff I'd like to do.
Ive decided I want to learn Ruby and Rails and have been pursuing it for about a month now. I read a lot of tutorials and work through stuff I find online. I'm also diving in to git and trying to use it more.
I feel like Windows is not going to be conducive to me getting efficient at this. I know that you can, and some do, develop in Windows but I'm wondering if its time for me to move past it.
I picked Ruby to be my first real programming language because of the simplicity I read about. For both Ruby and RoR and I want to be able to learn a language that will let me build apps and web apps that are cross platform.
On to the problem, I can't immerse myself completely in a linux world. I have to have photoshop and indesign for part of my job. So I'm thinking maybe I should just do a live usb key install and take it back and forth between work and home. Is that a better solution than dual booting for what I want to do? I also realize that a mac would give me the best of both worlds, but I am budget constrained and I can't make that leap yet.
Also, is there a good place to hang out to learn more? I have paid codeschool and tutsplus accounts. Should I be back on IRC? What do you think? I'm looking for guidance more than anything I guess. I feel kind of lost on where to go how to not waste time and start developing real skills. Thanks.
You should also checkout the vagrant project which creates headless (non-gui) VMs and makes it easier to work with your files, etc in Windows while the code actually gets run on the Vagrant VM. Also, since its headless, the graphical UI isn't eating up resources and has less impact on your host machine.
Check out these resources:
http://www.vagrantup.com/
http://blog.dcxn.com/2013/07/12/introduction-to-vagrant-for-rails-developers/
http://railscasts.com/episodes/292-virtual-machines-with-vagrant
*Also if you're learning Rails, you MUST checkout Railscasts http://railscasts.com/
The last thing I knew about this is that:
In Linux you can use RVM which handles pretty well everything about your Ruby environment. In Windows I tried pik, but it does not have support to install newer Rubies.
Also, Linux console is much friendlier than Windows one, regarding appearance and functionality. I have explored console2 for Windows, but it did not feel so comfortable that time.
In Linux you have plugins like oh-my-zsh which allows you to speed up your development. But maybe there are kind of this plugin for Windows.
Other than those, I don't know why you should choose Linux VM.
I've developed a Rails app under Windows, and it turned out to be a huge mistake. Near the end of the development, I had to make my webapp multithreaded. The default Rails server does not allow multithreading, and all the alternative servers are either Linux-only, or I couldn't get them to work.
I also considered using JRuby(because Java threads), but by then my app was too big to convert to JRuby(there are some syntax differences that I couldn't track, and I relayed on some gems that don't work on JRuby). However, if you go for JRuby from the beginning, you might be able to pull it off.

Using Rails as a framework for a large website

I've been playing around with Rails (version 3) for a few months now and I understand the framework fairly well. However, I have yet to develop a large website which offers lots of database access and user interaction.
I'm fairly skeptical of the following:
The Speed and Scalability of Ruby (I've heard that its up to 10 times slower than most other server-side languages).
The extra background processing that Rails as a framework (multiple levels of abstration).
The lack of enterprise-level web apps that run on Rails (the only ones that I can think of Groupon, Github and Hulu).
The complexity of the environment (nginx > mongrel > rails > ruby > website).
The behind-the-scenes SQL operations (I know that these can be optimized, but I'm sure that I'll miss some).
For these reasons, I'm unsure whether to continue using Rails or to switch to something that is built ontop a more performant language .. say Java Spring.
Please advise :)
There are tons of large sites and infrastructures in production that use Rails. This question has also been asked to death over the years of Rails being actively used for all manner of web apps, large and small.
Short version is that it is not the fastest language around but despite that scales fine if you know what you are doing. And you should have enough money to hire people that know what they are doing if you actually have any problems of scale.
Scaling any webapp is hard, use the language/framework you know. Programmer happiness is king.
You can get good performance with Ruby. Easy:
require 'inline'
inline :C do |builder|
builder.c <<-C_CODE
void run() {
// Write your entire application in C here
}
C_CODE
end
run
Problem solved ;)
Not the speed and scaling discussion again?
In webdevelopment the things that are the slowest is the network communication (receiving the request, getting al your data back), the database (getting all your data from the database), and most of the times it is not about the computation time at all.
While it is true that Ruby and Ruby on Rails seem more focused on programmer happiness, I think that every decent web-application built in .NET or Java has as many levels of abstraction.
The complexity of the environment? I think you mean deploying? There are a lot of options, but the most used options are Passenger (very easy deployment on top of an apache or nginx), or Torquebox.
Torquebox for the moment is the fastest, best scaling solution (based on JBoss Application server), and several big names in the Ruby community are calling Jruby the implementation of choise to deploy your applications. While AFAIK the commonest deploy still is using REE (Ruby Enterprise Edition) and Passenger.
Unless you know you are going to have to do serious mathematical, cpu-intensive operations, I think the question you should ask yourself is: which framework/language will give me the quickest result?
If you are very proficient in Java/Spring, that might be the answer for you. But if your only worry is performance in general, I would say: do not hesitate and go for Ruby on Rails. It is a pure joy to develop in. The ruby community is really awesome if you would encounter any issues: support is just a post away.
And to conclude, I want to add a few very big sites using Rails: LinkedIn is using rails (and jruby), and Twitter still is using Rails for their frontend.

ASP MVC3 vs Ruby on Rails

I have mainly developed in the .NET world, but I have a project coming up which needs to really favor the front end. Lots of UI love.
Is there value in using to Ruby On Rails instead of MVC3? How should I go about choosing between the two? Are there other options worth looking at?
I know Ruby On Rails is pretty popular, but how does it differ from MVC3?
Is there value in using rails instead of mvc3?
YES. If nothing it will give you a different perspective and broaden the way you think about programming problems. There's something about the terseness of ruby, usefulness of blocks, and dynamic behavior of the language that allows you to really think differently.
How to choose between the two?
If the project is a short one then stick with what you know. But if it'll end up being a longer project it might be worth the effort to start digging into the learning curve of rails. Most people will tell you that rails is faster to develop in than .net mvc. If the project is long enough, you might end up being able to develop faster on rails once you get comfortable with it.
That being said, the learning curve for a Microsoft programmer can be STEEP! If you're a unix guy then it wont be so bad but if not, get ready to learn about a LOT of different topics. The command line and your shell, TDD, homebrew or macports, git instead of subversion, gems, bundler, rvm, rspec or some other testing framework, etc.
Also, if you don't own a mac or aren't on some flavor of *nix then you might want to stick with .net. From what I hear it's a painful experience developing rails on windows.
If TDD is important to you then rails is the way to go. Also deployment is much easier on rails.
The ecosystem is something that might be a factor if you like to use tools built by others. Rails has a huge base of open source developers that contribute a lot back to the community. If you want to compare take a look at github.com (for rails) and codeplex (for microsoft). However, with Microsoft's NuGet system maybe the Microsoft side will start creating a better ecosystem. But right now it's not even close.
Other options worth looking at?
If you need to develop a pretty dynamic, database backed website then rails or .net mvc are good options. If it's something much simpler/smaller then some simpler/smaller frameworks are sinatra (for ruby) or webmatrix for .net. You'll be able to get up to speed much quicker with these frameworks.
How do the two frameworks differ?
The biggest difference I notice are from the underlying langues, ruby for rails and c# for .net mvc. Ruby is dynamic while c# is static. Rails is not compiled while .net mvc is. You'll get more raw performance out of .net mvc.
Rails is really built with TDD and BDD in mind. The last time I used .net mvc 1.0 it was really hard to do TDD.
When developing, pretty much everyone on .net mvc will use Visual Studio but I'd say most rails developers don't use an IDE. They just use a simple text editor (textmate, vim, emacs) and debug using the console.
EDIT:
*Bonus tips*
If you want to get started with rails (which I highly recommend) the easiest and most thorough way is to go through the rails tutorial by Michael Hartl. In it you'll learn about ruby/rails along with the following
git - source control
rvm - for running different versions of ruby on the same computer
rspec - for TDD
heroku - free web hosting with SIMPLE deployment
Once you get a good understanding of rails you'll want to improve your ruby skills to really become a good rails developer.
Ruby and RubyOnRails sounds like it would fit the bill.
And if you really wanted, you could use IronRuby for .NET goodness.
As for justification - many successful sites have been written with the framework. It has a proven track record over MVC3.

Groovy/Grails :: Ruby/Rails :: 2011 State of the framework

Yes, several similar threads exist, but we're now in 2011, and much has changed.
Grails 1.3.6 has improved hugely compared to v1.3 when I initially tried to learn the framework (and gave up to slow compile times and other groan inducing events).
Having spent a couple months with the latest release, I am impressed, protyping an app is an absolute breeze (GORM is great!). In development mode one no longer needs to restart, barring changes to domain classes. Groovy.lang is fantastic (bare in mind, this is compared to my day job life in PHP).
Now, on the flip side there is Ruby/Rails, which I have little experience with beyond perusing Ruby docs and exploring Active Record (to compare to GORM). Coming from PHP/Jquery, groovy syntax is cake, ruby not so much, although accessible.
Ruby/Rails is all the rage, while Groovy/Grails seems to be picking up speed in its own right.
I'd like to hear what both camps have to say (flame inducing lang war welcome) re: pros/cons of both langs/frameworks now in 2011. When choosing a framework it's important to know what you're getting into, so have at it, newbies will benefit, and experts can vent ;--)
Rails and Grails are both excellent frameworks with their current releases. You really can't go wrong with either. Here are some things I find interesting about them though:
Rails
Rails (Ruby) does not scale as well as Grails (Groovy). You will need more horsepower to run your application. This isn't a big deal at all with PaaS options like EngineYard (and hopefully a AWS BeanStalk Rails option in the future), but it might just cost a little more to run a Rails app vs a Grails app (obviously JRuby is also an option to though).
Rails is slightly better with NoSQL alternatives currently, but Grails is catching up quickly
Rails has many more plugins, but this can lead to trouble if you use some that aren't maintained (a lot of them don't currently work with Rails 3 yet either).
Rails is more mature and has more features at this point in time because it's been around longer
Rails REST support is amazing
There are many more "big" Rails websites than Grails
Ruby is much more popular than Groovy - TIOBE
No dependence on Oracle, ha! (Grails obviously needs the JVM)
Grails
Grails integrates with the JVM better than JRuby
Grails GORM is better than ActiveRecord (IMHO), although Rails 3 opened the door a little bit for other persistence options, but all the books, tutorials, etc all use ActiveRecord
Grails View taglibs are better than <=%...%> in view
Grails plugins are well documented and clearly state whether they are supported by SpringSource or not
SpringSource is investing heavily in Grails
There will be many more corporate jobs for Grails than Rails in the future, but more startups use Rails (where do you want to work?)
My perspective
I used Rails a couple years ago, I'm working on a Grails project now
I like them both better than Django (Python) or Zend Framework (PHP)
I plan to learn Lift (Scala) next
My Recommendation
If you have never done Java development and are working on a side project for a small to medium website, go with Rails
If you are working at a big company that uses Java, try pitching Grails to your management as the "next Java framework" they should invest in
If you are working on "the next twitter or foursquare," well then you are smart enough to answer this question yourself! :)
First time I begun a project with Rails I was really surprised:
How can I separate "repository" from "Service"? Oh my God: I have to put business logic on controllers... I can't imagine a real big project with Ruby on Rails: Is there Someone on 37signals remembering the basics of separating Business and Domain/Repository. The Rails folders/classes structure doesn't take care about this.
Second sock: "Active Record". Try to design a real complex Object Oriented Business layer and map it using the Rails Models (Active Record)... really: don't.
6 months later, with our project running: R&R is consuming 80% CPU (and memory...) using apache + passanger on a quad core server... and the Postgresql Database is in holidays (3-4% of CPU)... Oh my god (newly)
My old ASP/VB6 applications where capable of serve pages to 300 concurrent users in a real backoffice context with real complex databases and complex business installed on a standalone machine (a year 2001 1 CPU core server).
Of course, conventions and Ruby syntax are lovely... and no one needs a compiler (well... unit tests are used for this porpouses 90% of the time... just for solving the dissapeared typing each time I change some code... "Please, programming god, take care about my fingers mistakes" )
First impession with Grails:
A "Cool" stack inspired on Rails with professional power based on Spring framework (IoC, Hibernate, ...)
And YES!!!
There is a clean Domain/Service separation. NICE!!!
You can, eventually, forget Java.
Rails is fairly mature, has a HUGE ecosystem to go with it. I'm not familiar with Grails or it's support online, but the red flag I see in your post is that you've admitted Grails is playing catch up to Rails.
Ruby is an absolute joy to work with (and this coming from an old C++ hack... why, back in the day I used to program with just a hex keypad, young whippersnapper... now GET OFF MY LAWN!).
There are things about ruby that make it hard to follow at times (method_missing I'm looking at YOU) but I'm sure that can be said about any language.
Me? I'd go with ruby and rails.
Well for grails, i still think that even catching up, it has 2 main things that rails won't have in a easy way:
scaling up
tons of mature java libraries at your fingertips (personally geotools among others)
Ruby on Rails is outstanding - like the Pink Floyd of web dev.
Groovy on Grails is a decent copy of it - kind of like the Australian Pink Floyd show...
BTW - We have both at work - and I have seen many Grails developers eventually learn Rails and stick with it.
I have also seen Rails developers learn Grails, but NONE of them have preferred it.
About half of the time, our Java developers learn Grails and simply stay away from Ruby.
IMHO - If you truly know both fairly well, you will almost always prefer Ruby and Rails.
You also have to consider your IDE. When I started out with rails, it was quite painful. Rubymine was super slow and crashing, everyone I know were using textmate. Grails has STS (eclipse based) and gives you all the features you need.

Using rails or ASP.NET for website on Windows

I need to create a site that interact with some windows applications.
Currently this is done through direct calls so I would like these to run on the webserver.
This means that the site will have to run on a Windows based system.
I have been doing some ruby lately and am very keen on using rails for the site, but have at the same time seen plenty of discouraging posts regarding this.
Should I rather use ASP.NET (MVC) for a windows system or is rails stable enough to handle this?
Ruby on Rails on Windows is not ideal, but it does work, and works just fine for most purposes. The biggest issue you will likely run into is that the community of people running RoR on Windows is very small, so the issues you do run into which are specific to RoR+Windows may be harder to get help on.
If leveraging existing community is very important to you and/or your project, then I do recommend going with ASP.NET MVC. The community there is much larger and easier to connect with than RoR+Windows, which is fairly niche. Although it's difficult to put an objective value on the added benefit of having a community of support, it's clearly one of the biggest selling points for any platform - the RoR community in general, for example, is a huge part of its continuing success.
I would add to Rex's answer that RoR+Windows is fine for development, but i would not use that as a production setup. In my case i do a lot of work in Flash/Flex/Photoshop while working on the backend at the same time, and of course running those graphics heavy apps on Linux is not very ideal, but the server i deploy to is Linux which is the only part that really matters.

Resources