Category Archives: GitHub

Season of Ruby – Iteration 1 Restrospective

Same 3 questions that I laid out in the last retrospective post.

What Went Well

  • Broke through the “no code” barrier – I was learning a lot with with the Ruby Koans, but they also gave a false sense of knowledge.  Doing the String Calculator Kata got me writing my own code, posting it to github, and developing something of a “new” comfort zone.  I was definitely feeling somewhat uncomfortable as I was struggling to do things that I could do instantly in my familiar .NET surroundings, like project setup, working with version control, etc, so this was a good hurdle to clear.
  • Pushed code to github – OK, so it wasn’t a lot of code, but same idea: break through a barrier.  It also re-familiarized me with git which I had used a little over a year ago.

What Can Be Improved On

  • Not writing Ruby code in the Ruby style – Or maybe I am and just don’t know it.  Regardless, I still feel very much like a .NET developer writing Ruby code.  Bottom line, start to investigate and use Ruby as it is intended.  That means reading and writing more Ruby code.
What Am I Going To Do To Improve Things

Writing code will continue to be the main focus of the iteration,  but I also need to be focusing on what makes Ruby special.  To do that I want to work with some open-source Ruby code that will hopefully point out good Ruby style and also point me towards implementations or Ruby features that I have not seen yet.

I got some books from the library that I also hope will help educate me on elements of the Ruby language, style, and best practices.  I will fill in some non-programming time with going through the books for tips.

Iteration 2 Stories
The theme for this iteration is fundamentals.  I want to continue writing code and exploring features of Ruby, especially OO best practices as well as how Ruby implements blocks and iterators.  Building a strong base of fundamentals will position me to start doing some Ruby on Rails work in subsequent iterations.
Here are the stories for this iteration
  • As a .NET developer learning Ruby, I want to build a strong fundamental base of OO techniques with Ruby so that I can move onto more substantive uses of Ruby such as a Ruby on Rails application.  A 2-hour, time-boxed exercise of Conway’s Game of Life will provide an opportunity to get more experience using classes in Ruby.  Implementation will be stored on github exercises’about_methods’
  • As a .NET developer learning Ruby, I want to learn good Ruby style so that I can contribute to an open source project in the near-term future.  One way to learn style is to work with someone else’s code, so I will fork a repository on github and look at the style used and compare it against the style that I have been using for my development.  I want a project that is a “pure Ruby” project as opposed to Ruby on Rails to keep the scope manageable.  Since I was recently at thoughtbot for a seminar, I found a small project on github, Cocaine, that seems to fit the bill.  This will be a 1 hour, time-boxed, exercise.
  • Continue with the Ruby Koans to get more practice and understanding of blocks and iterators
    • require ‘about_exceptions’
    • require ‘about_triangle_project_2’
    • require ‘about_iteration’
    • require ‘about_blocks’
Advertisements

Season of Ruby – The String Calculator Kata and GitHub

Last iteration I realized that I needed to start writing some code, so the big story for this iteration was to do Roy Osherove’s String Calculator Kata and also to push the code up to github. Mission accomplished! But unlike ‘W’ standing on the aircraft carrier, I know there is a lot more work to do.

I used git a little bit a few years ago, and initially it was a painful adjustment because all my past experience was with centralized repositories like Subversion, Team Foundation, and CVS. Distributed repositories were a paradigm shift, but after some getting used to it really started to grow on
me. I loved home easy it was to create branches and that developers could work on different features in isolation before bringing their code back into the “trunk”. So it was great to get some code up on github, using both the RubyMine integration and plain old git command line tools. I need to spend a little time refamiliarizing myself with the terminology and workflow, but it was a great start.

As far as the kata goes I feel similarly. Did everything turn out exactly the way I wanted? No, but it is a kata. You do it, you learn something, you take those lessons forward, and you move on. Maybe I will do it again in a few weeks and see how the outcome is different. It served it’s purpose in getting me out of my comfort zone and writing code in a new language. It also got me asking new questions and places to take the journey. Some of the things that I wondered about as I was doing the kata

  • Does Ruby have the philosophy that there is one “right and obvious” way to do things, ala Python, or is it more Perl-like in that there are a many ways that are acceptable and it is a developer choice. At least according to this page it seems to borrow from Perl in that there is more than one way to do it.
  • How do private and protected variables/methods work in Ruby?  Are they often used or are there other patterns that are applied?  I remembered with Python that the notion of “private” was downplayed, at least with what I saw. I am not a Python expert so I may be mis-representing here.
  • Are instance variables used much?  In one of my refactorings I noticed that I was passing the same argument to a lot of methods, and decided to keep it in an instance variable. Was that Ruby-esque? Was it habits from .NET creeping in?  Was it the “best” solution

I don’t know the “Ruby Way” yet, so these questions are all the more reasons to start looking at OPC (other people’s code). So it is probably time to fork a Ruby open source project and start playing around with it.

I want to make sure I keep writing code too, so I think I will take a time-boxed stab at Conway’s Game of Life. I had a lot of fun with that at the Global Day of Code Retreat. I want to time-box it because it is something that I could spend a lot of time on, depending on how far I want to take it, and I am not looking for a complete solution but to exlore some different ideas in code. Maybe it’s time to start thinking about bring Rails into the mix too.

All these ideas make me think I should be keeping a formal backlog and continuing with the notion of treating this journey as an Agile project. I use a tool called Rally at work, maybe I’ll use that or investigate another tool. Any ideas or recommendations from the blogosphere?