Learning to Code: Lessons from building a simple Rails app with Treehouse
jasonshen.com
jasonshen.com
To piggyback on that, I personally think Rails is a poor intro to programming - even web development. What it provides in terms of early results is often at the cost of understanding what it does and why.
When we teach (we run an online web development bootcamp), we teach folks Ruby first, then the general web concepts (HTTP, HTML, etc), then lay the foundation of dynamic web programming (rendering templates, routing, etc) with Sinatra, before finally tackling Rails. When we do teach Rails, we stay very close to the framework itself and ask students to build things like authentication from scratch. After they get the core of Rails under their belt, that's when the fun really starts - we introduce comprehensive testing materials, advanced Rails topics, service integrations, complex application workflow, git/github based team collaboration and production app deployment and maintenance concerns.
It takes a while to build up all this from the ground up - but we found this being very effective in pushing people to an intermediate level and build up confidence along the way.
If you think Rails is a poor first choice - what's your recommended language and why?
At the risk of being a little pedantic, I think Ruby is a great choice (Rails being a web framework). Sinatra is much more lightweight Ruby framework that I personally think is more appropriate when starting out. It offers far fewer abstractions (or, "magic") and is a radically simpler beast. To put some numbers on that assertion, the codebase itself is less than 1/100th the size of Rails.
If working with a different language, I recommend starting with some similar level of abstraction. Sinatra-esque frameworks typically offer enough functionality to make development fun while not obfuscating too much of the logic. Spark (Java) is Sinatra inspired. While I've never seriously developed in Python, web.py has been on my to-use list for quite some time.
I started trying to learn Rails at the same time that I was learning Ruby. That was a bad choice and I gave up after a couple months. When I started back at it recently, I dove straight into Ruby alone and left the frameworks out of it. After I felt comfortable enough in Ruby, I added Sinatra and love it.
Rails is powerful, but Sinatra is "just enough" for beginners like us.
Not that integrating Devise when you're new to Rails is all that much fun either.
> Isn't that the type of thing a new dev is very likely
> to get wrong and get burned by?
I doubt it.Hand-rolling your own authentication is trivial in Rails. There are plenty of good tutorials and blog posts about it. There's even a Railscast on it. Rails even has a secure password helper and a digest generator.
You're more likely to get burned by Devise when you want to make trivial customizations to it. You quickly get weird override methods in your User model and rigid behavior from code you can't grep.
I think rolling your own authentication is far more newb-friendly. You're only a handful of lines away from your own `current_user` helper, and you retain full control.
I was sick of just being the Hustler for my startups, I raised seed rounds, but could not get my hands dirty in code. Why I No Get My Act Together?!?!?
I have tried to teach myself to code since 2007. I started my first profitable web company at age 20 without being able to afford a computer, but had to pay someone to code it up for me. Why I No Get My Act Together?!?!?
I know that I am not a lead developer or even close, but I am learning the fundamentals and am able to build my own prototypes without bugging someone to be my co-founder. Now I can show them even if the prototype is sh*tty (read: less then great).
I am now going through the Rails Tutorial by Michael Hartl: http://ruby.railstutorial.org/ after going through: https://teamtreehouse.com/subscribe/plans?referrer=jameshigh... and have even played around with changing my terminal: http://net.tutsplus.com/tutorials/tools-and-tips/how-to-cust... played with heroku, github, html, css, js....
I can't wait to go through more: http://programming-motherfucker.com/ as well as learn python and django.
So right with you Jason, more non-tech guys should get their act together and put in the time.
goo.gl/0BUvL -> https://teamtreehouse.com/subscribe/plans?referrer=jameshigh...
EDIT: My inner hustler was trying to get out, I put him back in his cage where he belongs.
All of the lessons learned in your article are really good ones, particularly about reading documentation, and even copying code at first. It's something we struggle with at Treehouse, we want our courses to be as smooth and error free as possible, but it's a bit disingenuous to portray building an app as something so smooth.
Developers encounter errors, Google error messages, and dig through docs all the time. We're trying to integrate some of the bugs we encounter into the videos, to hopefully shed some insight onto how to troubleshoot when errors inevitably occur.
You'll learn syntax much faster if you hand re-type instead of copy pasting code.
Most of my coding was typed in by hand. I would have to pause the treehouse video, type in the code myself, and then continue the video. Sometimes this would result in my missing a comma or colon somewhere, but I agree that typing it feels like a better approach.
The thing about Rails, for me at least, is that there's so much to it and it covers so many different bases that it's really tough to "learn it." For me, it's been a matter of two years of starting projects, throwing them out, and starting them again to get where I am - a fairly confident Rails programmer. I was also fortunate enough to get to work with a rails app for two summers [0] where my coworkers helped me a ton.
But guides? I don't know, they never really worked for me. It was the hands-on that I really needed, and it looks like your project with Treehouse is exactly that.
I'm still looking for the hands-on stuff [1] (shameless plug) to grow as a developer, since as a student I only have so much time for side projects. I've found that teaching Rails to others - I recently started an Open Source Society at my school - also helps immensely.
Yes, I agree that nothing beats hands on work! Love the hustle.
It's good to read bits and pieces here and there, but he deviates too much into Git, Github, Heroku, Unit Testing, etc.
I want to learn Rails and Ruby. An already hard enough task.
There's no reason to smash my face into so many new concepts at once.
-Source: Myself when I starting out with Rails.
A much better source I found is the book Agile Web Development with Rails from Pragmatic Programmer Bookshelf:
http://pragprog.com/book/rails4/agile-web-development-with-r...
Starts with dumb, .html.erb files, for static HTML, then slowly builds up on previous lessons - WITHOUT GOING TOO MUCH OFF TANGENT.
Unit tests, rspec! the second coming! yada yada. I wanted to learn Rails, most newbie want that as well.
One must work hard to grasp what is being taught. It requires a lot of motivation, reviewing and double checking. Too much is given at once, in the wrong order and with little explanation (if any). Too much is left open. Proper subject matter review for a consistent explanation isn't available.There is a summary at the end of each chapter, but it is as a statement of goals "achieved" and not an explanation. I could list many examples. One can easily get lost following (or trying to follow...) the book. It can be a real pain.
You don't need confidence because your projects don't need to leave localhost. Most don't no matter how experienced you are. They're for your own education.
I have 102 projects in my Code/ directory. I have only 5 repositories on Github.