Skip to content

Pragmatic Studios Finds My Review Of It’s Ruby Course

Recently, The Pragmatic Studio found and tweeted a link to my blog post reviewing their Programming Ruby course.  I haven’t been actively blogging since last October due to some changes with my job at that time.  However, things have changed with my job situation and I plan to begin blogging more regularly.

Stay tuned for what’s next.

Textmate and RSpec

Part of this course I’m taking through the Pragmatic Studio has us learning about TDD (Test Driven Development). Rather than using the built in Ruby testing library (Unit Test), they have us using RSpec. A large part of the course has us running code both in Textmate and on the command line. However, when I tried to run the RSpec test files from Textmate, I wasn’t getting any results.  I didn’t get any errors, but I got no results either.

I did some researching and I found this site referenced by Jason Seifer that fixed my issues.

Textmate, Rspec, and Dot Spec Party

I hope you find this helpful.

Code Examples Based On Principles Learned From The Pragmatic Studio

One of my good friends is a professional Ruby/Rails developer, and he challenged me to apply the principles from what I’m learning by posting some code examples.  So, in response to that friendly challenge, I’m posting a sample class I wrote on the fly.  As I shared with my good friend, I wrote this code all on my own, without any help from any other source.  Here is a link to the code gist:

Sample Ruby Class

Please feel free to leave questions, comments, or feedback regarding this code.

 

Update: The Pragmatic Studio Ruby Course

I can’t say enough good things about The Pragmatic Studio Ruby Course.  Seriously, forget trying to learn Ruby by piecing together bits from a variety of sources.  If you want to learn Ruby, and I mean REALLY learn Ruby, then take this course.  I promise you that it’s a $200 investment that you won’t regret.  Purchasing this course has launched me in two days further than I’ve been able to get in months of trying to learn on my own.

As of this moment, I can, without using any notes for reference, write my own Ruby classes and instantiate them flawlessly.  I understand instance variables and how they are used in Ruby apps.  I understand object attributes, their significance, and how to use them.  I understand why/how to use the “initialize” method in a Ruby class as well as when and how to use the “attr” (Ruby’s getter and setter) class methods.

It’s amazing how quickly the fog in my mind is clearing.  I’m absolutely thrilled with my progress.  The next lessons will deal with how objects interact with other objects.  That’s where the rubber really meets the road in Ruby development.

In order to be fair to the Pragmatic Studio, I’m not going to post any samples/examples from the course.  However, I’m going to write my own little Ruby app after the course is finished using the principles that I’ve learned, and I’ll push that app to my Github account.  I’ll post the URL once it’s ready.  Until next time.

Rails App For My Church

Last night I started writing an announcements application for my church.  We’re a fairly new church plant without a permanent building.  This app is very raw, but at least it’s started.  About all it has at this point is a .rvmrc file with Twitter Bootstrap installed.  I’ve posted the source code on Github.  I’m hoping to have it posted to Heroku very soon.

I’m trying to get a good amount of the work done over the next couple of weeks so that our church leadership team can do an initial review of the app.  I’ll post my progress here on the blog as well as any progress with my studies.

The Pragmatic Studio Ruby Course

Just to have a little bit of a change of pace, I’m going to put the Programming Ruby book down for just a little bit.  I don’t know about anyone else, but I learn best by looking at the same thing from different perspectives.  The Programming Ruby book is fantastic, but I need a break from reading and I’d like to use some videos for a season.

What caused me to consider this is that I had to take a SQL Server DBA course last week for work (our DBA resigned and we needed to get something/someone in place quickly).  I learned so much by sitting in class and being able to actually work through the material.

So, I’m going to purchase the course and work through the material.  The details of the course can be found here: The Pragmatic Studio Ruby Course.  Until next time.

The Goodness Of Regular Expressions

This morning I have continued to work my way through the Programming Ruby book. Once again, I find myself learning about concepts that I’ve only grazed in the past.

According to Programming Ruby, on page 24, here is the definition of a regular expression:

A regular expression is simply a way of specifying a pattern of characters to be matched in a string. In Ruby, you typically create a regular expression by writing a pattern between slash characters(/pattern/). And, Ruby being Ruby, regular expressions are objects and can be manipulated as such.

This concept was awesome to discover. I remember watching Ryan Bates one time in a particular Railscasts episode, and I was totally confused when he used all of these special characters to validate a form to ensure that the user was typing a valid email address in a particular field. I remember thinking, “How in the world could someone just know that pattern and be able to remember it?” It honestly looked like Greek to me.

Well, now I see that he was using character classes (space, tab, newline, etc) stored in a regular expression to match against what was entered in the form by the user. If the format of what the user entered matched the regular expression stored in the model, then the form input was accepted. If it didn’t match, then a validation error was thrown.

I felt like such a noob as I was working through this today. I mean, I’ve been working in Rails off and on for about two years now. How could I not know this? Once again, this is an example of jumping in feet first into a powerful (but complicated) framework without having a solid foundation in the language of that framework. I heard Michael Hartl say in a video once that you don’t have to be strong in Ruby to write Rails applications. I really respect Michael Hartl and I love his tutorials, but I have to strongly disagree with him on this point. I can honestly tell you that the more I learn about Ruby, the more I have those “Aha!” moments about Rails.

I think competent Ruby programmers take Rails for granted sometimes when they are dealing with beginners. What I mean is that Rails is such an opinionated framework that it’s easy for Ruby programmers to dive in, accept the convention over configuration nature of Rails, and produce some great applications without the headache of managing a lot of overhead. However, someone new to programming won’t have the tools necessary to either understand or leverage the power of Rails. Sure, anyone can do what I did and Google away to figure out how accomplish certain tasks. However, I can say with confidence that if someone doesn’t have a strong foundation in Ruby, then they won’t have the ability to create great applications on their own in Rails. There will always be that “brick wall” that you can’t seem to get beyond as you develop your application.

I’m so glad that I’m putting in the time and effort to go back and really learn Ruby. I’m already so much further along in my understanding of Rails than I was even a couple of weeks ago when I started this blog.

That’s all for now. Until next time.

Special Characters In Ruby Method Names

Yesterday I watched a short video on Code School’s Website regarding special character methods in Ruby.  It was a very interesting screencast.  What I learned that was most valuable to me is that special characters in method names are there only for the purpose of being expressive.

Take this sample class as an example from the video:

In this sample code, for the Banana class, the “tasty?” method has a question mark as a special character.  However, the question mark really has no value when it comes to syntax.  The “tasty?” method will execute the same way even if the question mark is absent from the method name.  However, by convention, the special character is written to be more expressive when reading the code.

This actually helped me quite a bit because I kept wondering why special characters exist in some method names and not others.  Now, I have the answer.

Finally, just in case this code doesn’t make any sense to you, here is an explanation of what it’s doing:

This is a Ruby class and the initialize method creates (or constructs) an instance of a banana.  The “tasty?” method is just a boolean that says if a banana object is black, then it’s not tasty, else it is tasty.  What’s interesting to note here is that you could instantiate this class multiple times, and each instance could be either tasty or not tasty depending on each individual object’s color.

If this doesn’t make sense right now, don’t worry.  I’ll cover classes in more detail later as I work my way through my learning material.  Until next time!

The Web And Web Technology

Since my end game is ultimately to be a Rails developer, I thought it would be a good idea to brush up on my understanding of the Internet and the technologies involved with standard web development.  Knowing Ruby is key to being a Rails developer, but there are other technologies that must be understood in order to be a good Rails developer (html, css, javascript, http and http requests, databases, etc).

Udacity has a great course for learning (or brushing up) on these kinds of things.  In Udacity’s course entitled Web Development(CS253), the entire course is spent building a blog.  However, it doesn’t just focus on the server side language.  Rather, it focuses on the entire web stack.  I’ll be enrolling in this course in order make sure I have a solid foundation in fundamental web technologies.

So, just to summarize, here is my current method of learning:

Learn To Program: The Fundamentals for helping to make sure I have a solid foundation in core programming paradigms
Programming Ruby (Book) for learning the fundamentals of the Ruby programming language
Model Thinking for helping to think through and organize information logically for the purpose of writing better and more logical code
Web Development for the purpose of making sure I have a solid foundation in core web technologies

So, I have a pretty full plate of learning over the next few weeks, but I feel quite invigorated in this quest.

Model Thinking

According to Programming Ruby, pages 15-16, here is how one should think about object-oriented programming:

When you write object-oriented programs, you’re normally looking to model concepts from the real world.  During this modeling process you’ll discover categories of things that need to be represented in code.  In a jukebox, the concept of a “song” could be such a category.  In Ruby, you’d define a class to represent each of these entities.  A class is a combination of state (for example, the name of the song) and methods that use that state (perhaps a method to play the song).

As I was browsing Coursera’s catalog, I saw an interesting course called Model Thinking.  This particular course is an interesting concept because it teaches us to think about the real world in terms of models so that one may think more intelligently and clearly about the world in which we live.  And, this course is not limited to one particular field of study.  The course teaches one to think about managing information for decision making and problem solving in any field of study.

When I saw this, I immediately thought of the quote listed above.  Object-oriented programming is modeling real world concepts in computer code.  It just makes sense to me that improving my thinking about models can only help to improve my ability to solve problems in code.  And, it should help me to write better, more logically organized code.

I think I’ve found my structure and focus for the next few weeks.  I’m going to continue working my way through the Programming Ruby book, I’m going to help my thinking about the real world by learning more about Model Thinking, and I’m going to get practical, hands-on experience writing code in a structured environment with the  Learn To Program: The Fundamentals course.

From what I can see, this looks like a winner all the way around.