What Is A Good Beginner Book To Learn Ruby?

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
I personally think that works for smart people. For me, It would take more than that. I spent couple months to learn programming. However, I could not even read a simple RM script. I could understand some of the parts in a programs but to understand all of it is just beyond my ability.

This one for example, I tried to modify it but I just can't interpret it.

http://www.rpgmakervxace.net/topic/2490-xs-popup-item/
That's why object-oriented programming techniques is apparently the better way to program stuff.

It may not be as efficient, but it's definitely easier for any arbitrary coder to just come along and add something without breaking the entire system.

You don't need to understand the whole thing. I've written maybe a couple dozen scripts, but I still have no clue how half the system works. But the stuff that I did look at, I know how they are designed.

You first start by looking at how the entire system is broken down.

Sprites? Forget it.

Windows? Irrelevant.

Scenes? Don't really need to pay much attention.

Start top-down rather than bottom-up. Figure out the general purpose of each class and see how they interact with each other.

Once you figure out what it's for, then you can figure out why others are using them that way. Maybe others are using them the wrong way.

If you don't really know what you want to do, then you won't really know what you're supposed to look for. There must be some reason why you want to script.
 
Last edited by a moderator:

BigEd781

undefined method 'stupid_title' found for nil:NilC
Veteran
Joined
Mar 1, 2012
Messages
940
Reaction score
304
First Language
Dothraki
Primarily Uses
N/A
That's why object-oriented programming techniques is apparently the better way to program stuff.
Eh, that was the original idea, and many will try to convince you that OO is well suited to all of your problems, but it simply isn't true. Code reuse is a lot more rare than you would hope because code is typically written to solve one problem per the requirements of the project you are working on. Sure, general purpose API's can be written in an OO style (image processing libraries, protocol implementations, etc.), but there's no reason they can't be implemented just as well in a non-OO way (procedural, functional).

OOP lends itself to certain problem domains, typically those which can be modeled/mapped to an object hierarchy easily. This is not true of all or even most applications though, and people tend to create a lot of classes which are poorly designed, lack encapsulation, and are essentially data stores wrapped in a class definition. This is not really OOP, it is a poor man's attempt at it.

There are exist many problem domains which do not map well to OOP. For example, non-relation databases. Scientific problems which essentially boil down to large collections of data being manipulated and processed in some way (functional style is great for this). OOP is hardly the silver bullet of programming paradigms that it was originally touted to be back in the early 90's. It has its place and serves a purpose, but it is hardly "the better way to program stuff". It can actually make what should be simple code far more convoluted and confusing to understand. Not every problem maps neatly to an object model. For these problems OOP principles fail, and your code will be worse off than it needs to be if you attempt to cram in an OO solution anyway.
 
Last edited by a moderator:

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
I agree.

Though, when it comes to problems that can be designed in an object-oriented manner (I think RM would fit anyways), it does its job pretty well.

At least in the case of RM (whether OOP is a good fit or not), new scripters should be convinced that they don't need to know everything there is to know about RGSS before trying to implement a trivial (or perhaps non-trivial, but isolated) change in logic.

There are more than enough users that are afraid to even try to touch the script editor because the size of the code base intimidates them.
 
Last edited by a moderator:

XinChao

Veteran
Veteran
Joined
Jun 11, 2012
Messages
117
Reaction score
3
Primarily Uses
I found one good free ebook, Little Book of Ruby. It teaches you in different approaches. Most of the book out there start with variable, loops, condition then class. However, this book start teaching you with class. One thing nice about the book is the excises are gaming related and or very simple to understand.
 

Tsukihime

Veteran
Veteran
Joined
Jun 30, 2012
Messages
8,564
Reaction score
3,846
First Language
English
Doesn't really matter where you start cause eventually you'd have to understand all of those concepts anyways.

I guess people start with things like variables and loops for historical reasons. Classes likely weren't around in the first programming languages, for example.

Then again, when someone tells you that this is an instance variable and that is a class variable, if you don't know what a variable is you're kind of stuck.
 

Mouser

Veteran
Veteran
Joined
Aug 19, 2012
Messages
1,245
Reaction score
264
First Language
English
Primarily Uses
I found one good free ebook, Little Book of Ruby. It teaches you in different approaches. Most of the book out there start with variable, loops, condition then class. However, this book start teaching you with class. One thing nice about the book is the excises are gaming related and or very simple to understand.
I've still got one of the first programming books I learned from: A first edition K&R 'C' programming language.

You start with variables and loops because you need to understand logical data flow. If you have sequential code execution, top check (while) loops, conditional branching, and recursive calls (for things like tall towers of Hanoi), you have all the tools you need from a program flow standpoint to 'solve' any problem. Everything else is just for convenience.

Object Oriented programming is nice for many things - you don't even need to use an OO language to do it (you can write OO code just fine in C for example, without using any C++). There is no single best way to do everything. The more tools you have in your toolbox, the more prepared you'll be. Read scripts (and other code) that work well. Try to figure out why and how they do what they do. Come up with a different way to solve the problem.

I wouldn't say that most programming languages are similar any more than most human languages are similar. Some share common roots and traits, while others are totally alien to each other. I will say that once you have a few under your belt, learning more becomes easier, because you've learned 'how to learn'. If you've found a book that works for you, great. If not, keep poking around till you find one that does. Although there are books and materials out there that just plain teach sloppy code... so a recommendation isn't a bad thing. I don't know Ruby yet, so I can 't help you with specifics on that.

Don't be afraid to roll up your sleeves and get your hands dirty. You'll learn more from writing and debugging your own code than you will from almost anything else. And then when you do go back to the books, you'll understand what they're saying a whole lot more...
 

Mouser

Veteran
Veteran
Joined
Aug 19, 2012
Messages
1,245
Reaction score
264
First Language
English
Primarily Uses
Back to books, I'll be picking up two to learn Ruby soon. I'll post some reviews once I get them:

http://www.amazon.co...1&keywords=ruby

O'Reilly books are typically pretty good, and at only 400 pages, isn't something that's going to go too in depth into everything, so probably a good intro.

http://www.amazon.co.../ref=pd_sim_b_1

This one looks like it will go into a lot more detail about specifics and what can and can't be done. It's around 800 pages, about the size I'd expect from a modern "serious" programming language book (ah, to go back to the good ole days of K&R...).

A lot depends on what you want to do. One of the first scripting projects I have in mind is a full auto-updating journalling system with room for your own notes. Yes, I know it's been done, but since I'm working on a project to sell (if not this game, one a few games down the road), it's a lot better if I handle my own scripting. Less hassle all around. I'm also really curious about reaching out and grabbing hold of the Windows API - yes it limits your potential audience, but I think I can live without non-windows gamers (or they can use WINE :) ).

Edit: They've got a pretty long preview of the first book available that I've gone through. It seems to give a pretty broad explanation of the language, which attention paid to the most important (in their opinion) methods and operators for each class. Strings, for example get a whole chapter, while concurrent programming (which should actually work pretty well with RM's "parallel process" only gets a section. But if you know about threading and concurrent programming, the syntax is probably all you need. It also covers both 1.8 and 1.9 - and details the differences when they occur, so it should be useful to both Ace and VX/HP RM users.

Definitely looks worth buying IMO. Another two or three weeks before I can actually get my hands on the books. I expect the second one to go into a lot more uses of the language from the reviews, so it would seem a logical second step. Hopefully simllar to a Design Patterns book (and every programmer/developer should own a copy of the Gang of Four's Design Patterns)

More edits to follow when I have the books in hand...
 
Last edited by a moderator:

Travatar

Summoned by candle, by book, and by bell.
Veteran
Joined
Sep 2, 2012
Messages
435
Reaction score
38
First Language
English
Primarily Uses
I found this one http://www.amazon.co...38641951&sr=1-1 and downloaded a sample on my Kindle, so I did that. I figured that way, I'd get an idea of whether this book would work for me or not. The sample went through the first 2 chapters and I was so excited about it I bought it.
I'll vouch for this book. It's a fun read, and very informative. However, I bought it shortly before moving a couple years ago, and haven't seen it since. It either got yardsaled behind my back, or is being read by someone at my old apartment who doesn't know what a Ruby is. I might have to get another copy. Rubymonk.com is pretty fun too, though. I'd love to use them both in conjunction.
 
Last edited by a moderator:

SoulPour777

Crownless King
Veteran
Joined
Aug 15, 2012
Messages
1,093
Reaction score
104
First Language
English
Primarily Uses
N/A

FenixFyreX

Fire Deity
Veteran
Joined
Mar 1, 2012
Messages
434
Reaction score
310
First Language
English
Primarily Uses
I second the Techotopia link to Ruby Essentials. That is what I learned off of. That, and writing stuff myself.
 

SoulPour777

Crownless King
Veteran
Joined
Aug 15, 2012
Messages
1,093
Reaction score
104
First Language
English
Primarily Uses
N/A
I second the Techotopia link to Ruby Essentials. That is what I learned off of. That, and writing stuff myself.
Wow, I'm reading that still up to now myself...although I would like to agree that this is a good start to learn...together with why's poignant guide.
 

Mouser

Veteran
Veteran
Joined
Aug 19, 2012
Messages
1,245
Reaction score
264
First Language
English
Primarily Uses
Ok, my books have finally arrived, so I can start to give a review on the first one:

http://www.amazon.co...pd_bxgy_b_img_y

The Preface states that the book is "loosely modeled after the classic The C Programming Language" by K&R. As that is one of the greatest computer programming books ever written, they've set a high standard for themselves. And if Ruby is such a simple, elegant language, why does it take them over 400 pages to do what K&R did in under 220?

The book is a bottom up guide (which actually should dovetail nicely with the 'pickaxe' book I also got, which is a top down guide), that doesn't waste time holding hands or going over things three different ways. The end of Chapter One is a non-brute force Sudoko Solver at about 125 lines of code, plus comments, that you should be able to follow fairly well after reading the chapter.

If you're looking for a good, nuts and bolts book that doesn't leave out any of the gory details (data and control structures, error handling, overloading, thread safety and fibers, networking - though this is disabled in RGSS) this is one to look at. It does cover 1.8 and 1.9, so that can contribute some to its length. It doesn't document the basic library (it leaves that for the hatchet book), though it hits the high points and shows where to look at the standard documentation.
 
Last edited by a moderator:

SolarGale

Learning
Veteran
Joined
Jun 8, 2012
Messages
479
Reaction score
37
First Language
English
Primarily Uses
@Mouser

Can i ask which is this hatchet pickaxe book you talk about?

Is it the pragmatic programmer's guide?

edit: thanks for clarifying this.
 
Last edited by a moderator:

Mouser

Veteran
Veteran
Joined
Aug 19, 2012
Messages
1,245
Reaction score
264
First Language
English
Primarily Uses
@Mouser

Can i ask which is this hatchet book you talk about?

Is it the pragmatic programmer's guide?
Yeah. the 1.9 edition. I know the 1.6 is up on the web somewhere.

It's actually updated to 1.9.3, so it's a bit ahead of RGSS... EB needs to get on the ball and start patching :)
 

Solistra

Veteran
Veteran
Joined
Aug 15, 2012
Messages
593
Reaction score
247
Primarily Uses
For future reference, the Pragmatic Programmer's Guide is usually called "the pickaxe," not "the hatchet," considering the tool on the cover of it is... a pickaxe.

To stay on-topic, though, I can't really recommend anything for learning Ruby that hasn't already been mentioned here. Personally, I mostly just looked at a lot of code other people wrote and kept the documentation for the standard library handy.
 

Mouser

Veteran
Veteran
Joined
Aug 19, 2012
Messages
1,245
Reaction score
264
First Language
English
Primarily Uses
For future reference, the Pragmatic Programmer's Guide is usually called "the pickaxe," not "the hatchet," considering the tool on the cover of it is... a pickaxe.
Oye! I've edited my post to correct it. It was late and my words got jumbled. A pickaxe it is :)
 

SoulPour777

Crownless King
Veteran
Joined
Aug 15, 2012
Messages
1,093
Reaction score
104
First Language
English
Primarily Uses
N/A
If you are into videos as well, you could check up thenewboston or Bucky in YouTube. He has tutorials for you for Ruby Programming Language :)
 

Mouser

Veteran
Veteran
Joined
Aug 19, 2012
Messages
1,245
Reaction score
264
First Language
English
Primarily Uses
Didn't want to start a new thread for this, so figured I'd bring this one back up :)

Has anyone here had experience with "Mastering Regular Expressions"? I've heard at this point it's as much required reading as the Gang of Four. I'm asking because I've noticed all the scripts using the note boxes for input and settings, and they're (I think) regexp's. Being able to really parse and dynamically work with them could open up a lot of possibilities.
 

Solistra

Veteran
Veteran
Joined
Aug 15, 2012
Messages
593
Reaction score
247
Primarily Uses
I'm asking because I've noticed all the scripts using the note boxes for input and settings, and they're (I think) regexp's. Being able to really parse and dynamically work with them could open up a lot of possibilities.
I don't have any experience with the book you're talking about, but I thought that I could at least confirm that most people are working with regular expressions -- and they are. Honestly, I think a lot of people use them unnecessarily, but that doesn't change the fact that they're widely used and have a lot of potential.
 

Mouser

Veteran
Veteran
Joined
Aug 19, 2012
Messages
1,245
Reaction score
264
First Language
English
Primarily Uses
I don't have any experience with the book you're talking about, but I thought that I could at least confirm that most people are working with regular expressions -- and they are. Honestly, I think a lot of people use them unnecessarily, but that doesn't change the fact that they're widely used and have a lot of potential.
It's one of those things that has hung around for historical reasons but has also gained some real modern applications. Before the days of SQL all data was stored in flat or delimited text files (security wasn't as big of an issue back then...). People needed ways to sort through this stuff quickly, so the "languages" of sed and awk were written. Perl inherited a lot of syntax from awk, and Ruby inherits a lot of stuff from Perl (Thank the Goddess it didn't inherit the indentation requirements).

I don't doubt they're used in a lot of places where strings would do the job just as well, though with strings being mutable in Ruby, I don't know how much of a performance edge one has over the other.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

How many parameters is 'too many'??
Yay, now back in action Happy Christmas time, coming back!






Back in action to develop the indie game that has been long overdue... Final Fallacy. A game that keeps on giving! The development never ends as the developer thinks to be the smart cookie by coming back and beginning by saying... "Oh bother, this indie game has been long overdue..." How could one resist such? No-one c
So I was playing with filters and this looked interesting...

Versus the normal look...

Kind of gives a very different feel. :LZSexcite:
To whom ever person or persons who re-did the DS/DS+ asset packs for MV (as in, they are all 48x48, and not just x2 the pixel scale) .... THANK-YOU!!!!!!!!! XwwwwX

Forum statistics

Threads
105,853
Messages
1,016,986
Members
137,561
Latest member
visploo100
Top