More Ruby Stuff

Standard

I spent some time this evening messing around with Ruby again – I wish I was dedicated enough to work on learning Ruby more frequently because it’s always such a pain to leave it for several weeks/months and then come back to it having forgotten almost everything. Like learning any language, repetition is the key to memorizing the syntax.

Anyway, here’s some code I slapped together this evening – something to track my run dates and distances. The added value in this code, versus my previous work with hashes, is that this offers the user a choice of options up front (add, update, display, delete).


run_miles = {
 "033016" => 2,
 "032916" => 1.85,
 "032816" => 1,
 "032116" => 3.5,}

puts "What would you like to do?"
puts "-- Type 'add' to add a run."
puts "-- Type 'update' to update a run."
puts "-- Type 'display' to display all runs."
puts "-- Type 'delete' to delete a run."

choice = gets.chomp
case choice
when "add" 
 puts "What is today's date in mmddyy format?"
 date = gets.chomp
 if run_miles[date].nil?
 puts "How many miles did you run?"
 miles = gets.chomp
 run_miles[date] = miles
 puts "A run on #{date} for #{miles} has been entered!"
 else
 puts "A run on #{date} of #{miles} has already been recorded!"
 end
when "update"
 puts "Enter the date in mmddyy format."
 date = gets.chomp
 if run_miles[date].nil?
 puts "Date not found!"
 else
 puts "What is the new mileage?"
 miles = gets.chomp
 run_miles[date] = miles
 puts "The run on #{date} has been updated to #{miles} miles!"
 end
when "display"
 run_miles.each do |date, miles|
 puts "#{date}: #{miles}"
 end
when "delete"
 puts "Which date do you want to delete?"
 date = gets.chomp
 if run_miles[date].nil?
 puts "Date not found!"
 else
 run_miles.delete(date)
 puts "#{Date} has been removed."
 end
else
 puts "Sorry, I didn't understand you."
end

It’s a cute little program – downloaded Ruby 2.2.4 on my Windows machine and ran it from the command line. I’d like to start getting into real web-based stuff soon.
 

Organizational Authenticity

Standard

I recently started listening to the Harvard Business Review Ideacast podcast. Today I enjoyed a thought-provoking Q&A with the author of Why Should Anyone Work Here, the topic of which was authentic organizations. The authors stated that authentic organizations share the following six criteria:

  • Difference beyond diversity. I want to work in an organization were I can be myself.
  • Radical Honesty. Tell me the truth before someone else does.
  • Extra Value. Add value, don’t exploit me, develop me.
  • Authenticity. Mean what you say and say what you mean. Don’t change the mission statement every three years because there’s widespread cynicism about that.
  • Meaning. I want a meaningful job in an organization which itself has meaning.
  • Simple Rules. I want to live and work in an organization which has created, agreed, simple rules, and not a fog of bureaucracy.

If you’re quick, you’ve noticed that the six words form the mnemonic DREAMS, which the authors use to say that an authentic organization is the “organization of your dreams”.

Easier said than done when you talk about creating an authentic organization, or transforming a highly political organization into an authentic one. But according to the authors, the long-term benefits of pursuing authenticity far outweigh the momentary struggle.