We have been seeing a lot of posts about different Rails and Ruby topics,
such as benchmarks, ways to develop ,implementations and more. But if you
are a n00b in the ruby world or if you are thinking in change to ruby, but you
are not sure about it, I will try to give some answers for the most common
questions that I think you may have.
Like PHP vs Ruby? or those sorts of things...
PHP, .net, flex or ruby??
PHP advantage
Well PHP is one of the most common and widely used languages for
coding dynamic webpages. You can write code inserted directly in HTML,
it's secure, stable an open source.
I have to said that it is easy to use, I've started to write webpages
in PHP and it was easy to understand 'cause, when I began using it I knew C,
and PHP is C based. It runs in almost all systems (UNIX, Windows and MAC OSX).
Beginning to use it is as simple as installing Apache and add the PHP module,
then you’re set.
PHP has a wide community and a lot of useful libraries.
There are a lot of books to learn from, and also PHP.net is awesome.
PHP disadvantages
First of all, not everything in PHP is a piece of cake, when I was coding in it,
I got some issues when I tried doing some more "complex" things, like making a
file upload feature and things like that.
PHP is not a 100% Object oriented, it's trying to implement it in the newest version, but is not as good as others.
The error handling is very poor in PHP.
Sometimes, you will get messy code because of the lack of good practices.
You have to take care of some security flaws on your own.
.net framework advantages
I really don’t like to talk about it, but, I have to say that it's easy and it has a
very complete documentation. It's an event language, so it is easy for n00b developers.
C# is powerful, binding and a couple of more features.
.net framework disadvantages
With this framework you have to work in Windows and within this environment, you will get a
lot of issues trying to connect to other DB instead of to a SQL Server. And it is heavy as hell!
Also, you have to pay for everything.
Flex advantages
I really don’t know much about it, so I ask to a friend of mine whom is nicknamed Chicken(Adrian Castillo).
He told me that Flex had a lot of positive points, like:
* Cross-browser.
* Multiplatform.
* Multimedia content.
* Authorship, you can create digital signs for you projects.
* And it is extensible.
Flex disadvantages
The bad things about Flex are:
when you create a project you have to choose a flash version, and you will
have to use that version only. If you want the edgy stuff, It will be not available
for everyone. There’s not to many docs and examples.
It's a event language, so if you are not careful, you will get a mess
Ruby advantages
Well, I am new in ruby too, I have like ~9 months using it, I think, and I have to say that
it has been amazing time. Everything is so easy, you don´t have to worry in write
common methods, you have to worry about solving the problem that you have, not in trivial
stuff.
The guy who wrote it Yukihiro Matsumoto wants to have simple code
not so complex, something with the developers feel free and happy.
It's also fast to learn, just take a look at the documentation and that’s all you have to do, besides practicing it.
In ruby everything is an object, an example.
10.times {puts "hello world"}
Take a look at the code and you will see that "10" is an object with the method "times", and it will show on the screen “hello world” 10 times, just like that. That's simple, huh?.
Another plus is that ruby has an excellent error handler.
The community is huge now, and you have a lot of gems and plugins to help in your projects.
When we are talking of ruby and PHP, we have to talk about Ruby on Rails an
awesome framework for ruby, there are other out there(like sinatra), but
right now is the one I like the most.
So, What can I say about it?. Well you can create a web site in minutes...
I really meant that, with the scaffold function you will have a template
in a second(not recommended for important projects).
Theres a lot of cool functions, like time methods:
Time.now
#2010-12-19 23:55:57 -0600
Time.now + 1.day
#2010-12-20 23:56:06 -0600
2.day.ago
#Sat, 18 Dec 2010 05:57:15 UTC +00:00
It's a simple stuff but so useful.
In ruby on rails, you will write a lot less code,
easy configuration, it has an integrated testing framework.
And more and more and more.....
Ruby disadvantages
Like all the languages it has disadvantages, not everything is beautiful.
Ok now a couple of them:
The documentation is mostly complete, but it doesn't have method examples or stuff
like PHP.net
If you don't have the money to pay the hosting it will be difficult to get your app
online, there's a solution heroku. Heroku is a free web hosting company, but only free startups.
So I have to say that it's expensive to host apps.
Another thing is when ruby sites grow they will need a
robust infrastructure, it's heavy.
My coworkers opinion
I've asked to some of my co-workers about the things that they like about ruby,
and the things they don't. And I got the next answers about their likes:
They love the way you can change everything, like opening the methods and rewriting
them.
They said that everything is so easy to do, the syntax, write methods, the blocks,
etc.
Also, it's amazing how everything is an object, you can create methods for
that object, and access them so quickly.
It's really easy to learn.
On the other hand, I ask about the things that they don't like about it.
It's not multithread.multitask
It is so easy that sometimes it turns you into a lazy developer.
It's perfect. (I know i now I'm just telling you what they said).
It's heavier than PHP.
Final thoughts
This are a couple of things, just to get an idea across. If you dig more I am sure,
that you will find more things, good and bad ones, and it's the same in every
language, you have to try it by yourself and see what can you do with ruby.
If you have another question or if you want to say that this post it's pure
crap, don't hesitate on telling. I am open to any kind of feedback.
I hope this help you a little bit to take a step into ruby or maybe to keep
outside of it.