9 Comments
Oh, my… God.
What is this? First post in a century? What’s going on here Fleebie? Our beloved readers are going to stop respecting us, and for good reasons.
For those who care, I am not dead, I am not sick… I am just working like crazy on Azanka, the company I started with Dan recently.
Ok now it’s time for a brand new edition of Rubyize this. Let’s get the ball rolling. Hold on… I’m going to google images to get a picture of a ball rolling.

Hmm… I’m afraid this isn’t going to roll at all
Anyway, consider this :
I am an old and unhappy programmer from the late eighties and you secretly watch me coding the following lines :
class VotingSystem
#Hello, I am Rodger the old and unhappy programmer. the variable nbrOfVotes is an array of 2 dimensions. The first dimension contains the number of votes for the answer "YES, IT SUCKS"... and the other dimension contain the number of votes for the answer "NO, IT DOESN'T SUCK". In the near future there will be other possible answers... but I don't care! I retire in 2 days!
@@nbrOfVotes = Array.new
#The users who sent their vote arrive in this very top secret method!! (I retire in 2 days!)
def receiveAVote(theVote)
if theVote == "YES, IT SUCKS"
@@nbrOfVotes[0] = 0 if @@nbrOfVotes[0].nil?
@@nbrOfVotes[0] = @@nbrOfVotes[0] + 1
else
if theVote == "NO, IT DOESN'T SUCK"
@@nbrOfVotes[1] = 0 if @@nbrOfVotes[1].nil?
@@nbrOfVotes[1] = @@nbrOfVotes[1] + 1
else
puts "THIS IS NOT A VALID ANSWER YOU MORON... btw i retire in 2 days!"
end
end
end
#This is the function that compile ALL the votes... I retire in 2 days!
def compileAllTheVotes
for i in (0..1)
if i == 0
@@nbrOfVotes[0] = 0 if @@nbrOfVotes[0].nil?
puts "HERE IS THE NUMBER OF VOTES FOR 'YES IT SUCKS' : " + @@nbrOfVotes[0].to_s
else
if i == 1
@@nbrOfVotes[1] = 0 if @@nbrOfVotes[1].nil?
puts "HERE IS THE NUMBER OF VOTES FOR 'NO IT DOESN'T SUCKS' : " + @@nbrOfVotes[1].to_s
end
end
end
end
end
Bring the light to this man who retires in 2 days
9 CommentsRubyize this : 6th edition…
…
Rubyize this : 6th edition…
almost the same as Vince. But he did a hell of a job, so there isn’t much left to change….
Rubyize this : 6th edition…
Here is my solution… nothing revolutionary but it does the job. I also added the possibility to vote on multiple questions…
Rubyize this : 6th edition…
not much different than what has already been submitted….
Rubyize this : 6th edition…
…
Rubyize this : 6th edition…
Maybe not quite a refactoring……
Rubyize this : 6th edition…
most of the suggestions are great, here is my one.
while i complied this suggestion i had the following points in mind –
1. extensibility
2. simplicity in terms of exposing api
…
Rubyize this : 6th edition…
System is a vile word in a class name. It is meaningless and encourages a pile up of concerns that should remain separated.
Since that dude retired 2 weeks ago, I think it’s safe to scrap that piece of code. Normally it’s better to refactor than re-…
Rubyize this : 6th edition…
May be not the best refactoring – but my own…
…

