multidimensional approach to learning Ruby (& CS in general)
I'll try to not make this question too personalised, so here we go.
I'm currently studying Pickaxe to learn Ruby (This is my first programming language). The goal is to develop strong ability in Ruby, then learn Rails in order to freelance.
Pickaxe certainly has a pleasing layout, but I feel that there is much to开发者_开发问答 be desired in trying to really learn material when just a single resource is used. Following along with the book doesn't prompt one (or maybe its just me) to experiment enough. Therefore I am interested in perspectives concerning other methods so that I may develop a deep understanding of the language.
I believe that I would retain material much better with a multifaceted approach, so I would like to know what others to do in order to develop the understanding required to create quality code.
I added (& CS in general) to the title because I am relatively confident that I will be messing with supercomputers sometime in the future, so I wish to develop understanding of CS concepts that will aid me with Ruby, and with (presumably) C later. I'm trying to approach programming like I approach my other intellectual pursuits. Define the universe, define the axioms, and build up from there. Essentially, I'm attempting to define the axioms of Ruby.
The best thing is to start a pet project. Think of something cool you'd like to do - a text based game maybe - and simply start coding. Every time you hit a dead end try very, very hard to figure it out. That's how you train your brain to become an awesome programmer. The check out the book or search online for help. After you're done, go through it and try to improve your code as much as you can.
Rinse, repeat.
Have an open mind, pursue your interests, investigate what appeals to you, and have fun... :) Research the problems you run into and Google around. If you don't "get" what you read right away, at least you know there is information available, and that some concept exists, and that you can come back later. This really applies to pure CS, data structures, algorithms and so on. Don't learn them all at once, but make use of them when needed..
OR become really interested and study lots of material. It all depends on what works for you and the mood you're in..
Let ideas come and go, and you will probably find that you learn just as fast or faster than if you were following a book. Really getting into books is great too, when you're in the right mood. In my opinion, the Pickaxe is a great book to come back to, not to read sequentially.
MIT and Berkely have good theoretical CS courses available as free video lectures, on ther home pages and on YouTube.
Look around open source projects. Start looking through the libraries you use in your code whenever something is unclear.
Don't end up as a consumer of a particular language or "right way", framework or API. Keep reevaluating the way you do things.
Or be a fundamentalist for a while. Or forever. Whatever you like!
When coding this way, you can gradually identify the key concepts and see how they relate in a way that is meaningful to you personally.
The way of the Tao... ;P
I can give you an answer on the Ruby part of the question
I found the book http://pragprog.com/titles/ppmetr/metaprogramming-ruby a good way to learn the ruby language, It gave me among other things a deep understanding of method lookup and self in Ruby
Also https://github.com/edgecase/ruby_koans
And there is a nice interactive rails site
http://railsforzombies.org/
For the learning Ruby part, you might consider the core course at RubyLearning. I've found that a lot of people seem to enjoy the group learning provided by the forums. Disclosure: I'm one of the mentors there. It's a non-profit site, unfortunately we lost our sponsor and thus there are now small course fees to pay for the servers etc).
Book-wise, I'd say with "The Well-Grounded Rubyist" followed by "Eloquent Ruby" and rounded off with "Ruby Best Practices" (in that order), you can't really go wrong. There obviously needs to be a bit of time between each book, where you experiment on the level you already gained to let things set it.
For CS in general I'd recommend checking the curriculum of a CS course and picking out some of the books (SICP is a classic for example and I really like the stuff from compiler construction courses).
There's also a freely available book called "How to Think Like a Computer Scientist - Learning with Python" that I've heard is good, but did not read myself.
When all is said and done though, writing code is where you really learn. If you can't come up with a project of your own, go through code katas or koans, follow the Ruby quiz and check out the "code-challenge" on the Code Golf Stack Exchange.
I have a background in both science and engineering, and I've always taken the pragmatic approach to learning engineering (including computer languages). Specifically:
1) I think of something I don't know how to do, and then learn to do it. (What "it" is, is almost immaterial.)
2) I find something in someone else's code, in a keyword reference, etc., and then try to figure out what it is.
I generally then go back and learn the computer "science" part after tackling the pragmatics.
I don't think this is a unique approach or necessarily the best approach, but it's one that works for me. Tackling the pragmatic aspects first gives learning the feel of a puzzle and makes it fun. And then, when I turn to the theoretical aspects, I'm able to draw on examples from my own experience.
(I should note that I take a similar approach to learning other disciplines that combine pratical and theoretical aspects.)
精彩评论