Ask A Question

Notifications

You’re not receiving notifications from this thread.

Your biggest aha! moment?

Exequiel R. asked in Tips

Basically, what has been your biggest code aha! moment. That time when you understood some concept or mantra that you were familiar with but couldn't wrap your head around.

For me, being the noob I'm, I think it was the "keep your controllers RESTful" concept.

I heard about the concept before but never truly understood it until I got how would one go around the "design" of such controllers thinking about the RESTful actions performed over models.

In case some of you don't know, the basic premise is trying to have only REST actions in your controllers: show, index, new, create, edit, update, destroy, delete.

This post makes it pretty clear:
http://jeromedalbert.com/how-dhh-organizes-his-rails-controllers/

Even though it's a pretty basic concept, I think it's really powerful and sometimes ignored.

What about you? Do you have any aha! moments you can remember of?

Reply

I've had so many of these over the years, they were clear moments when I could tell I leveled up.

I think one of the big ones for me was realizing that Rails, Django, and all the other frameworks are simply text parsers. They parse HTTP requests, organize the request for you in regular old Ruby code and then you get to choose what to do based on that. It's so unbelievably simple, but yet hard to wrap your head around as you start. That was big for me.

Reply

That's really interesting Chris, I don't know if I came to the same realization but I do constantly remember while coding or doing stuff that seems complicated that it's just data passing around.

We love to create terms, buzzwords, new solutions to old problems but at the end of the day it's just data so if we think about it that way the journey gets easier.

Reply

Exactly. And that's why I tend not to talk in buzzwords as best I can on GoRails. Most of what we do is really not that complicated, it just appears that way because we try to name every little detail. If you can get rid of all that, you can start really understanding things. And once you do, that's where the names come from, as succinct descriptions of things you commonly see. The trouble is trying to learn the names first without having seen the underlying patterns repeatedly in their raw, unnamed format.

Reply

I would recommend this book:

https://rebuilding-rails.com/

It explains in a simple way how the different parts of rails (ORM, routing, auto-require, rendering, etc.) work under the hood and on the top of that It's way easier to understand than rails source code.

Reply

@Szilard Magyar thanks for the recommendation. I just bought the book and started reading it.
I had already seen it but I finally took the decision to buy it,

It seems pretty interesting and even thought I kinda get how Rails work I'm sure I'm going to learn tons of stuff from it.

Thanks again!

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,796+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.