
Learning Rails – or not as the case may be - thehodge
http://www.thehodge.co.uk/programming/learning-rails-or-not-as-the-case-may-be.php
======
Groxx
> _So I started to look back at why I’m having such a hard time learning when
> I picked up PHP and ran with it so quickly, again partly its because RoR
> have a much greater complexity rating (in my mind) that just plain
> procedural PHP but heres the biggest issue I have... Rails tutorials are too
> long..._

Try comparing RoR to a similarly-complex PHP framework. You'll find they all
require a _lot_ more groundwork to be able to do Random Thing X regardless of
what X may be than a bare-bones PHP / Ruby / what-have-you implementation.

But that's normal. Essentially any framework necessarily increases the breadth
of things you must learn to do what you want - languages are simple. The
advantage is they trade that increased breadth off for decreased _depth_ \-
you don't need to know how to _write_ a JSON parser or crypto code or ORM
logic to be able to _use_ it.

As apotheon mentions, give Ruby a try on its own, it's a heck of a lot
simpler, and the core library is by far the most brain-friendly I've
encountered. If you need things to do with it, you can always try
<http://www.projecteuler.net> .

edit: geh. I always type .com first :\

~~~
thehodge
broken link?

~~~
Groxx
Yeah, I type .com so much out of habit, and so many redirect automatically, I
don't even think about the non-dot-com sites existing as such most of the
time. Fixed now!

------
rbranson
While reading this, I kept having flashbacks to PHP code written by lazy
developers that didn't take the time to learn either PHP or MySQL very well.
They would do things like use MySQL to format dates (paraphase:
mysql_query("SELECT FORMAT_DATE(" . $date . ")")), because that's just what
they remembered, and didn't want to take the time to find the right PHP
function. Of course, there's always the opposite side of the same coin, like
where they'd use loops of PHP code, executing hundreds or thousands of SELECT
statements, instead of just learning how to use a JOIN.

EDIT: Just to be clear, I'm not implying that the author produces this kind of
code.

~~~
thehodge
It's not THAT bad, I'd say two or three steps up from that ;)

------
seldo
As a PHP developer, I found learning Ruby _and_ Rails at the same time too
much. I went back to PHP, learned MVC in a language I was familiar with, and
then when I went back to rails it was clear which bits were Rails features and
which bits were Ruby language constructs.

Of course, I then decided that I didn't like Rails enough to put up with its
performance issues, and went back to writing MVC in PHP, so I may be a bad
case study. (I hear RoR 3.0 is much better performance-wise, but my current
solution works well enough that I'm not interested in trying it out again)

~~~
regularfry
I found precisely the opposite. Because it was relatively quick to get
something impressive working in Rails, it didn't matter to me initially which
bits were Ruby and which were Rails. That all came later.

------
joshuacc
Personally, I recommend <http://railstutorial.org/>

That moved me further along the path to understanding Rails than any of the
other books or tutorials I tried. Still not there yet, but closer.

~~~
thehodge
I'd never seen that before... will put it on the of things to checkout, thanks

------
trustfundbaby
Going from just PHP to Ruby on Rails requires a huge change in Mindset that
isn't apparent when you're starting out. Rails is a framework that is much
larger than Ruby the language, so understanding why certain things work the
way they do is a very important part of learning it.

I feel particular empathy for you because I absolutely _hated_ the 'Agile Web
Development with rails book' too.

Here's my suggestion ... Get 'Simply Rails 2' (I'm assuming the project you're
working on is in Rails 2 not 3) ... work through it, then move on to 'The
Rails Way' by Obie Fernandez.

If you're really serious about it, getting through the first one should set
you up for success ... Obie's book will take a while go go through, because
you're going to keep reading and re-reading things as you code.

------
drdaeman
Almost a cliché — comparing simple (and poor-designed, in this case) language
to a complex framework.

If we'll try to compare — PHP is just a quite thin layer above HTTP — you get
$_REQUEST/$_SERVER and you write data back. So it's easy to learn "ground-up".
Compared, Rails is an extremly complex infrastructure filled with lots of
magic. So, the only way for newbie to learn it is to write code without
understanding how they work internally — it would take too much time to do it
the other way.

And when you learned PHP (then invented your own "DB abstraction layer module"
bicycle, haha; then learned some simple framework; and so on...) you expect to
learn Rails the same way, which is almost impossible due to its complexity.

------
sunkencity
Comparing rails to just plain PHP pages - yeah, rails is VERY MUCH MORE
COMPLEX. The rails 3 project is like some 2500 files and I dunno how many
lines of code. There's great benefits in using a framework, most of which is
consistency and no need to write the boilerplate functions. Here's a few
things to think of:

1\. When using a framework you can treat it like a black box, you don't
actually need to know how it works, but you need to have a good enough _idea_
of how it could work - that's why so many people roll their own framework in
the beginning of their career - it's very useful to have done that.

2\. Do you know Object-Orientation works? Can you program object oriented
code? I did a lot of programming before I knew OO and could _just not
understand a single line_ of object oriented code (that I sometimes had to
write in perl using the godawful OO syntax at that time). I just poked at that
code until it worked, but I had no way of understanding the code. Took a class
in OO programming at the university and it was dead easy after that. I suspect
that it would be VERY HARD to grok rails without being able to code object
oriented code.

3\. Perseverance - for me learning new programming languages and environments
always includes making the code work first and then understand. Programming is
a practical thing, it either works or not works and the theoretical
understanding is just a tool that's more or less useful. You'll just have to
keep on working on it until it runs and then try to understand what you have
done, you might not even have to understand how rails works, you just have to
know enough where to put stuff and have enough experience to know what to do.

------
thehodge
It's a post from my own blog, but I'd really be interested in what HN thinks
(are any others in the same position or have they been and how did you get out
of it)

~~~
apotheon
I found Ruby itself a lot easier to learn than Rails, actually. Try doing some
plain ol' Ruby learning instead.

You know at least a little programming, so I'd recommend starting with
_Everyday Scripting With Ruby_ rather than with _Learning Ruby_.

I don't know much about the more recent editions of _Agile Web Development
With Rails_ , but I have a copy of the first edition. In it, Appendix A is
_Introduction to Ruby_. That introduction is about useless to someone who
doesn't know any programming, but provides an easy, quick familiarization with
the basics of how Ruby (the language, as opposed to Rails the framework)
works. If you have access to a copy of the book that has such an _Introduction
to Ruby_ appendix, combining that with _Everyday Scripting With Ruby_ makes
for a _very_ effective start in the language for those who already dabble in
programming.

I'd recommend starting out on a Unix-like platform, and using Ruby to automate
small tasks as a way to get used to using the language. While you're at it,
learn the OptParse core library, which is great for adding command line option
handling to your utilities, as well as help output.

If you want to migrate from there to simple Web coding, you do not necessarily
have to jump straight into Rails or any other framework. You can do CGI
programming in Ruby, or you can use eruby to do template-based development
much like the basic means of using PHP on most Webhosts.

edit: Wow. Maybe I should write a book introducing people to Ruby.

~~~
thehodge
Thanks, I'll definitely checkout that book :)

