Ooooh fun, fun, fun!!!! :D

Gemma Cameron
Software Engineer
 
BAE Systems Integrated System Technologies Limited
Registered Office: Warwick House, PO Box 87, Farnborough Aerospace Centre, 
Farnborough, Hants, GU14 6YU, UK
Registered in England & Wales No: 3456325 


-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of 
Paul Robinson
Sent: 22 October 2008 14:30
To: [email protected]
Subject: [NWRUG] NWRUG Quiz? (Exercise 1: Fibonacci numbers)

               *** WARNING ***

This mail has originated outside your organization, either from an external 
partner or the Global Internet. 
     Keep this in mind if you answer this message. 


I've been teaching Ruby and Rails to some young 'uns who've been doing some PHP 
or Java at Uni but not coded in anger recently.

Note to all universities: it would have been easier if you'd taught them what 
words like "version control" and "test harnesses" meant in their first week. 
Trust me. These guys think svn is some useless extra chunk of work to be done 
and that unit tests are just there to keep me quiet... *sigh*.

Anyway, last week I set them a simple pure Ruby exercise. The solutions I got 
back were interesting: people have clearly been taught some very bad 
programming techniques, and when they move to Ruby it confuses the hell out of 
them. When I showed them my solution, they thought it was one of the most 
beautiful pieces of code they'd seen, but I considered it quite ugly.

I'm curious as to whether anybody would like to try a peer code review/ quiz 
via the mailing list in the spirit of helping us all produce better/more 
elegant Ruby.

We'll keep it simple and in the spirit of Ruby Quiz so anyone can compete, but 
I thought it would be fun and not quite as scary as the main Ruby quiz which to 
me at least felt like walking into the 100m Olympic finals and going "I can 
compete with these guys" when I tried it last year.

If people like this, we could consider making it a weekly exercise.

Here's the exercise I set last week, which is ultra-simple to get us
started:


The Fibonacci sequence is a sequence beginning with 1, and producing the next 
number in the series by adding the previous two numbers. Here is the start of 
the sequence:



1, 1, 2, 3, 5, 8, 11



Write a program that will output the Fibonacci sequence either to infinity, or 
to a pre-set number of iterations. This is very easy, so "points" will be 
awarded for elegance, simplicity, beauty, brevity and other factors that make 
us go "that's nice!"



I also want to have a predicate method that can tell me if a given number is in 
the Fibonnaci sequence. I want to be able to do this:

1.is_fibonnaci? # returns 'true'
2.is_fibonnaci? # returns 'true'
4.is_fibonnaci? # returns 'false'

This is also very easy, but the "points" here will be awarded for performance - 
so your sequencer above might be very elegant, but is it *quick*?

If you're playing, please don't post your code or solutions until Monday 
morning to give others a chance to play. I hope plenty of you join in.

--
Paul Robinson

http://vagueware.com :: [EMAIL PROTECTED] :: +44 (0) 7740 465746

Vagueware Limited is registered in England/Wales, number 05700421 Registered 
Office: 3 Tivoli Place, Ilkley, W. Yorkshire, LS29 8SU
Correspondence:   55 Velvet Court, Granby Row, Manchester, M1 7AB






********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"NWRUG" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/nwrug-members?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to