Skip to Main Content
Learn to Program, 2nd Edition
book

Learn to Program, 2nd Edition

by Chris Pine
March 2009
Intermediate to advanced content levelIntermediate to advanced
194 pages
4h
English
Pragmatic Bookshelf
Content preview from Learn to Program, 2nd Edition

A Few Things to Try

  • Even better profiling. After you do your profiling, see the slow parts of your program, and either make them faster or learn to love them as they are, you probably don’t want to see all of that profiling anymore. But (I hope) you’re too lazy to go back and delete it all…especially because you might want to use it again someday. Modify the profile method so you can turn all profiling on and off by changing just one line of code. Just one word!

  • Grandfather clock. Write a method that takes a block and calls it once for each hour that has passed today. That way, if I were to pass in the block:

    do
    puts 'DONG!'
    end

    it would chime (sort of) like a grandfather clock. Test your method out with a few different blocks.

    Hint: You ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learn to Program, 3rd Edition

Learn to Program, 3rd Edition

Chris Pine
The Book of Ruby

The Book of Ruby

Huw Collingbourne

Publisher Resources

ISBN: 9781680500172Errata