Archive Page 2

24
Feb

Making a plan and checking it twice…

I was recently made painfully aware my Rails skills are suffering. I need a plan of attack to get and keep my skills sharp. What am I going to do? Well here it is, my plan:

The Plan

1. Blog More
I’m going to start a new series, of sorts. I’m going to start an Engineer Notebook, tidbits of information I’ve discovered and/or found useful and I want to share. The entries will start with ‘NTS:’ -> which stands for Note To Self.
2. Read More
There are a few blogs that I need to go back and start paying attention to, like Daigle’s blog. I have a few PDFs and books I need to read and continue reading. I also plan to continue my online CS reading list, albeit not as high a priority.
3 Listen More
Like the blogs and books there are a few podcasts I should be listening to; there’s the Rails Envy podcast, the Railscast podcast.
4. Do More
I’m going to write a b-billion small Rails apps and keep them on my local machine. Right now I’m not sure what kind of apps I’m going to write.

As much as I love Smalltalk, I feel right now it makes more sense to pursue a career in Ruby on Rails. Smalltalk still holds a special place in my heart, always will. Looks like I’ll get there through Ruby.

I welcome your suggestions as well.

Cheers!

19
Feb

Writing a bit of Ruby code does the body good…

Last night I spend about 4 hours writing some Ruby code to solve a particular Coding Problem. That time includes reading the problem description, creating the design, writing specs and code, and looking up API calls. It was mad fun.The coding problem dealt with a couple of Mars rovers. The problem description was very detailed; I wish most clients had as detailed requirements.

Design Time

After reading the problem description a couple of times to get a feel for what I’m trying to solve I opened a new document in TextMate (which rocks and every Mac developer should own a copy) and started putting down my thoughts in a semi-freeform manner. I could see I would have a Rover, of course. However I also seen that the Rover would have a Motor and a Navigational System; the Navigational System would also have a GPS Unit. I then wrote down notes on movement and direction; I also defined movement in a particular direction in terms of the x,y coordinates. Coding Time!

BDD Time

I like using Rspec and wanted to use it for my coding solutions. It provides a nice narrative over my code base; what I needed since I would not be creating a ‘Main’ script. So having just wrote down some design notes I thought to myself, “What is the driving context? What’s going to manage my Rovers?” I came up with the idea of a Mission - back to my design notes.

Mission Design

What is this Mission object and what does it do? Well, it defines how many Rovers are going to be used. It also defines how large the movement area will be. It’s also responsible for issuing the commands to the Rovers and handling any errors and output. Cool - now back to coding…Coding:

I created a Mission Spec but then switched gears. I thought I should probably define my Rover first to make sure it knows how to handle all the input I’m (the Mission) is going to throw at it. Super! I create a Rover Spec. Then in an iterative fashion I create my tests and the simplest implementation that works.

Iteration 1

First my Rover has a default location and heading and knows how to report this information separately and combined. Pretty simple - all hard coded values because the spec just expects values.


  it "should be pointing North" do
    @rover.heading.should == 'N'
  end

  it "should be located on 0 0" do
    @rover.location.should == '0 0'
  end

  it "should be positioned at 0 0 N" do
    @rover.position.should == '0 0 N'
  end

 

Iteration 2

My Rover learns to spin to the left or the right. This is a little trickier since it changes the heading of my rover. I add the Navigational System because it knows about headings, or compass directions.


  it "should be pointing West" do
    @rover.input('L' ;)     @rover.position.should == '0 0 W'
  end

  it "should be pointing East" do
    @rover.input('R' ;)     @rover.position.should == '0 0 E'
  end

  it "should be pointing South, spinning Left" do
    @rover.input('L').input('L' ;)     @rover.position.should == '0 0 S'
  end

  it "should be pointing South, spinning Right" do
    @rover.input('R').input('R' ;)     @rover.position.should == '0 0 S'
  end

  it "should be pointing East, spinning Left" do
    @rover.input('L').input('L').input('L' ;)     @rover.position.should == '0 0 E'
  end

  it "should be pointing West, spinning Right" do
    @rover.input('R').input('R').input('R' ;)     @rover.position.should == '0 0 W'
  end

  it "should be pointing North, spinning Left then Right" do
    @rover.input('L').input('R' ;)     @rover.position.should == '0 0 N'
  end

  it "should be pointing North, completing a full spin" do
    4.times { @rover.input('L' ;) }
    @rover.position.should == '0 0 N'
  end

 

Iteration 3

The Rover learns to move. Now I have to add the GPS Unit since it knows where the rover is located. It was at this time that I realized, for this exercise the Motor class adds no value to the solution. I leave it in anyways. I had to tweak the Navigational system so that it knew the size of the movement area. I did this because I didn’t want my Rover to travel beyond the boundaries of the movement area.


  it "should not move pass border" do
    @rover.position.should == '0 0 N'
    @rover.input('M' ;)     @rover.position.should == '0 0 N'
  end

  it "should move one unit" do
    @rover.set_grid_system(1, 1)
    @rover.position.should == '0 0 N'
    @rover.input('M' ;)     @rover.position.should == '0 1 N'
    @rover.input('M' ;)     @rover.position.should == '0 1 N'
  end

 

Iteration 4

I felt at this point I had enough behavior to start implementing the Mission spec. I started creating the spec and the corresponding Mission object. I quickly discovered I didn’t have a way to set the size of the movement area; Rover, Navigational System updated. I then discovered I didn’t have a way to set the initial position of a Rover; back to the Rover Spec, implemented. Lastly I wanted to process the command of movements as entered: a single line of characters. This was added without a corresponding spec test (bad Mel).


  it "should have an initial position of 3 3 E" do
    @rover.position.should == '0 0 N'
    @rover.initial_position('3 3 E' ;)     @rover.position.should == '3 3 E'
  end

 

Iteration 5

Thank goodness I had tests! My movement wasn’t working as expected. My initial set of tests didn’t cover a particular case. However, when implementing the Mission Spec and not getting the expected results I was able to discover a typo if my movement logic.


  before(:each) do
    @mission = Mission.new
    @mission.define_plateau(5,5)
  end

  it "should command Rover 1 from [1 2 N] to [1 3 N]" do
    rover_1 = @mission.rover_1
    rover_1.initial_position('1 2 N' ;)     rover_1.issue_command('LMLMLMLMM' ;)     rover_1.position.should == '1 3 N'
  end

  it "should command Rover 2 from [3 3 E] to [5 1 E]" do
    rover_2 = @mission.rover_2
    rover_2.initial_position('3 3 E' ;)     rover_2.issue_command('MMRMMRMRRM' ;)     rover_2.position.should == '5 1 E'
  end

 

So all in all I had a great time last night (I’m sure I’m missing some details - I’m sleepy for goodness sake). I’ll try to add bits of my code to this blog if I can figure out how to do code highlighting.

Cheers!

15
Feb

Going back to school…sort of…

One thing you should know about me is that I absolutely love to learn new things. I’m always reading and asking questions; I’m not afraid to admit when I don’t know something or don’t have the necessary skills to perform a task. I also enjoy mentoring others. I particularly enjoy the social aspect of learning/teaching, but I digress from my intended point: Books!

I used to buy a lot of books, a lot of technical books. If you’ve been to my home I have a bookcase filled with, now, out-dated books from Visual C++ (oh god i can’t believe i just admitted i know c++) to Java 1.1 to Visual Basic Algorithms (thanks jamie!). However I also have, in my opinion, timeless tombs: GOF Design Patterns, Mythical Man Month, Analysis Patterns. I love to read. Might also explain why I have so many feeds in my feed reader (a much slimmed down 251 feeds).

When I started this career, my life-long hobby, I was actually going to school to learn the hardware side of computer technology. I had, and still have, a fascination with robotics. I just knew I was going to build robots. However, I fell in love with Assembler. I displayed aptitude in my programming classes: Pascal and Fortran. It was in fact my Fortran Professor that brought me on board to my first professional development gig; he had hired in recently and had asked me if I was interested in joining him. I’ve been writing software solutions ever since; this was back in August of 1993.

I was recently made painfully aware of my lack of formal CS education. Which is fine. I don’t know it all (though I act like it). A list of authors was rattled off (I recognized The Don [as in Knuth] and Design Patterns was mentioned) of which the majority I didn’t recognize. So I asked for the list. I wanted to start reading - so I can have a new set of questions to ask. Crickets!

I hdan’t received any feedback and decided to start with Google and work my way down to something useful. And something useful is what I found! Over on E7L3 I found the following:

So I’m going back to school! A sort of unofficial correspondence school. I’m way excited. And I already know of a couple of friends to help me with the “big” words.

Oh and one other thing: For the naysayers out there - you won’t keep me down because you don’t power my dreams.

Cheers!

14
Feb

On getting back into Smalltalk development…

Today I was asked what I would to do change Smalltalk. I have to admit I was not prepared for that question. However, I have a deeper question I’m attempting to answer: Is this a good time to get back into Smalltalk development? To which I’m answering: Yes.

I believe Smalltalk is starting to enjoy a rediscovery due to Seaside and, indirectly, Ruby on Rails. It seems to me that Dynamic Languages in general are enjoying a bit of the limelight; Groovy on the JVM. I have to ask myself why. I believe I already know the answer since I have a well-known affinity for Smalltalk and dynamic languages in general: development can be and often is more productive.

I’m not going to argue specifics; these are my observations and experiences. However, for me, when using a dynamic language to develop a particular solution it seemed I spent more time solving the problem then trying to fake-out a compiler. I also wrote less code. Imagine that: less code to solve a given problem. Simple is always easier to debug then Complex.

Plus I tend to follow the thinking: Make it work, Make it right, Make it fast (attributed to Kent Beck). Which means, to me, solve the problem first, in the simplest manner that will work. After I get the solution working and tested I then spend time refactoring and ensuring the overall design of the solution remains coherent. To me this flies in the face of current J2EE development which seems built on the mantra: Write a Million classes that apparently do nothing. This is completely unnatural to me.

When I started this career, some 14 years ago, I was fortunate enough to start in a Smalltalk development shop. I got OO. My former manager called me a ‘natural’ programmer; I finally appreciate what that means. Everything came so easy to me. I seen the objects in the application. I seen them working together to accomplish their goals. I instinctively understood anthropomorphism before I learned the term. “The Contact does what?” “How is the Account and Contact related?” Whiteboards and Booch diagrams were my friends. It was my former manager that gave me a copy of Design Patterns; telling me, “this is going to be important.”

I was/am used to objects knowing how to do things. I mean when my wife asks me to take the garbage out I don’t ask my father for instructions - I do it. With Java, most of the community I interacted with was afraid of this kind of pattern. “What do you mean the object will know how to save itself? That’s what the DAO’s are for.” I rolled my eyes. Great! More code to write, maintain and debug. Clueless

Then comes along Ruby on Rails. I had heard about Ruby around the same time I heard about Java. Unfortunately I was not on the right path at the time and dismissed Ruby out of hand. However by the time I was exposed to Rails I was ready for a change. Actually truth be told I was ready to leave Java to moment I started developing in it - there just weren’t any Smalltalk jobs where I lived. I digress.

Since Ruby, at least to me, appears heavily influenced by Smalltalk I was immediately comfortable with Ruby’s syntax. I understood the concept of Blocks. I understood the idea of “everything is an object.” As with anything new, there was a learning curve when it came to Rails, the web application framework built on top of Ruby. But it was exhilarating and liberating to develop applications using Rails. This was 2 years ago. It was then I was able to use my Smalltalk experience. Finally! It was then I made the decision to seek out Ruby on Rails gigs. Still working on it. It was then I made the decision to forego statically typed languages in favor of dynamically typed languages.

The journey began 2 years ago and continues today and tomorrow. Today found me in the unique position of talking to several Smalltalk experts, displaying the experiences I’ve gathered over my 14+ years doing software development. Today, no matter the outcome, got me one step closer to my goal for 2008: a paying gig developing Smalltalk or Ruby on Rails applications.

P.S. Today’s experience also has me thinking I should be spending more time looking at Seaside.

Cheers!

13
Feb

New Theme…

I did a little rearranging this evening. Check out the new theme! I also moved my FeedBurner Feed Link to the sidebar.

So far I’m really liking WordPress. It seems much easier to work with then Roller (the blog software behind jroller.com). I’ll be adding more items/pages to the blog as time passes.

Cheers!

13
Feb

Getting back into Rails development…

After a bit of time off on a side project I joined, tonight, at the CVReg code jam, I updated my development environment and jumped back in. However it wasn’t a smooth re-entry.

After a fresh check out my rake db:migrate failed. And now I know why.

TIP: When you delete models from the application in addition to updating your tests, make sure you’ve checked your migrations!

In one of the migrations there was some code to preload some dummy data. Works fine when the model file is there. I had to create a local copy (which won’t get checked in of course). However after a consult the offending code was removed - not the migration file - just the offending code.I’ll be sending an email to our dev list requesting some guidance on the issue: should the model be restored or should the migration be removed.

I would suggest periodically doing a rake db:migrate VERSION=0 followed by a rake db:migrate and then running all your tests just to be sure your environment is stable.

Cheers!

06
Feb

There goes the neighborhood…

I brought over some of my jroller entries; couldn’t get them all, but oh well…

I found this wonderful blog telling me how to create a template that can be used to export some of the entries as an RSS XML document. This document is then imported into WordPress. Easy Pea-Zee.

Ok - Chat ya later…

03
Feb

Hello world!

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!

There! I edited it. Happy? cause I don’t care.

17
Jan

Scrum! Solo-style…

To stay on track, or at least remember where I left off, I’ve decided to employ a modified Scrum Methodology for my Facebook Application.

Because I am the Product Owner, Scrum Master, and Scrum Team all rolled up in one I don’t have a traditional Product Backlog or Sprint Backlogs. I’m still using the Excel Spreadsheet model albeit modified for my purposes; I’m actually using NeoOffice since I plan to do all of the development on my MacBook. :-D

So in my workbook I have 5 tabs: Project Data Sheet, Sprint 1-4.  On the Project Data Sheet I’ve listed details about the application I want to write, technology details, questions I need answered, links to online resources.  I also listed the Sprint Themes.  Because my application has only one function, right now, I decided to lay out my Sprints such that my application is iteratively built.

For each Sprint tab I have a place to enter my tasks and my estimates.  I also have a place that displays the total remaining hours for the Sprint.  Plus I added a section that contains links to online resources - I particularly like that because it helps document my application.  However, what I don’t have is a burndown chart or a set number of days for my Sprint.  I’m the only one working on the application and not in a full-time fashion.  I’m not really concerned with my velocity since I know it will vary from day-to-day, week-to-week.  What I am interested in is what tasks and how much time remain for a given Sprint.

I’ll try to post some screen snaps since I now have a new tool: Snapz Pro X.

P.S. The daily stand-ups are a trip - I’ve had to reprimand myself several times for no progress.

Cheers!

Update: Here are two screen snaps:

Project Data Sheet Sprint 1

13
Jan

Kicking off FaceBook Application project…

Over the next few weeks I’ll be working on my Rails-based FaceBook Application.  Yes, I said Rails.  I’ll be releasing details as soon as I decide how and where to do this.  Might be this site.  Might be my PBWiki site: Ka-Blam! [The PBWiki sites might be disappearing too].  I decided I had better get organized and get motivated if I’m going to do Rails/Seaside development; the application is small enough, complex enough to be interesting and will be fun to port to Seaside.

I plan to document my entire progress, no detail too small.  However for my project plan I’m not sure where I’m going to document/track my ad-hoc Product and Sprint Backlogs.  Right now I’m tracking them in a NeoOffice Spreadsheet, works quite well too.

The MB will be my primary development machine.  Should be interesting - already ran into two problems: 1) busted ssh and 2) busted mongrel.  I know, I know - Google’s my friend.  I already have those items in Sprint 1.

So today is Day 1 of Sprint 1…

Cheers!