Day 6, How to deal with files and other data streams. What’s a reliable way to get the last item in an array? ask for the -1 item, i.e. array[-1]. Finally, a logical reason to start arrays at 0 rather than 1 – so we can count backwards. Looks like the “then” part of an …
Category Archives: Ruby on Rails
Learning Ruby – Day 5
Day 5 is all about objects and their methods. Remember a few months back when Apple introduced the Shuffle? Everyone was up-in-arms about it’s lack of screen and how it was useless an mp3 player without a screen is. When in-fact, the lack of screen simplifies and improves the device a great deal. Ruby is …
Learning Ruby – Day 4
Day 4 – Iterators. First, all chapters in programming books should start with quotes from Steve Martin (t). Second, what’s a language without a convoluted loop syntax to geek out on? Geeez. I thought the purpose of learning to program was the same as learning Arabic from the Defense Language Institute – “because you can’t.” …
Learning Ruby – Day 3
Day 3 is all about strings, arrays, hashes, and ranges – abstract, geeky terms for buckets In Ruby, strings can be treated like arrays. Meaning it’s super easy to access substring. For example: theString = “It’s raining today” theString[13, 5] # returns ‘today’ Finally, I always thought substr() methods were an awkward solution for something …
Learning Ruby – Day 2
Day 2 starts with one of the most valuable programming exercises. What can I do with an object? Just ask it: self.methods With ‘self’ being the current object, the above question returns a list of all the questions ‘self’ knows how to answer. Every object in Ruby can be asked this question. So many languages …
Learning Ruby – Day 1
Mark Slagell’s writing style is conversational and educational. I’ve gone through a number of software language tutorials. I found Slagell’s first chapter a comfortable mix of background info, simple examples, and experiments. On the outset, Slagell states Ruby is based on the: Principle of Least Surprise: “If you don’t know how to do something and …
Learning Ruby in 3 Weeks
A year ago I dropped REALbasic. Since then, I’ve struggled to get my head around Cocoa and Objective-C. With the recent hype around Ruby on Rails, I started looking at Ruby and found a Ruby/Objective-C bridge. To me, this means there’s a huge potential to have tightly-integrated desktop and web-based applications in a single, easy-to-maintain …
The Object-Oriented Thought Process
On my way to better understand object-oriented programming (t d) and thereby check “Learn enough Objective-C to be dangerous” off my ThingsToDo list, I picked up The Object-Oriented Thought Process by Matt Weisfeld. Not having formal training in software engineering, I found the book’s focus on the language-agnostic basics of OO extremely helpful. Here’s what …