This week at The Starter League I went back to basics… as in Ruby fundamentals. Without a programming background, these IF/THEN statements have been challenging. After constantly getting errors like, “wrong number of arguments” and “haven’t defined this method” I knew that I needed to get clear on my understanding of how the Ruby “thinks.” Turns out it thinks very logically…
My task last night was to create a program which would ask for a number between one and ten then repeat it back to you. Simple enough. After trying a few different approaches with varied success I went back to what would be considered our textbook for the course, “Learning to Program” by Chris Pines, and was able to create the ideal solution. Something interesting I took from this experience, Ruby reads “0” as zero, however it read “00” as a string, meaning just the characters with no inherent functionality. Also “007” is read simply as seven. The deeper I get with Ruby the more I am starting to see some of the human touches. At some point an actual person had to decide if “00” was going to mean zero or was it going to mean just two characters next to one another which happen to be zeros, I’m sure there was a good reason for “00” being a string.
These human touches are also apparent with rails, the web application for ruby programs. This is one of the reasons that Ruby on Rails is so popular amongst beginners as well as experts. For instance, when you start a new Rails application dozens of folders and files are created to help get you started. The alternative would be having to create each and every file and folder yourself. This is just one example of how Ruby on Rails favors Convention over configuration. If most of the time users are going to need the same files then why not make that the default?
This next week I will continue to spend some time focusing on understanding how Ruby “thinks”, so far I am quite pleased. When you mess up, Ruby lets you know, sometimes even making suggestions for solutions. Ruby is slowly starting to occur for me as a helpful tool rather than an impediment that I have to beat into submission. At then end of the day Ruby exists to enable my potential not to inhibit it.