small medium large xlarge

Exercises for Programmers AND Learn Game Programming with Ruby now in print

September 16, 2015

Now in print and shipping! Two great titles to hone your skills this week and beyond:

  • Exercises for Programmers: 57 Challenges to Develop Your Coding Skills, now in print and shipping from Read on below for Q&A with the author!
  • Learn Game Programming with Ruby: Bring Your Ideas to Life with Gosu, now in print and shipping from

Come and get 'em!

Exercises for Programmers: 57 Challenges to Develop Your Coding Skills

One of the best ways to learn a programming language is to use it to solve problems. That's what this book is all about. Instead of questions rooted in theory, this book presents problems you'll encounter in everyday software development. These problems are designed for people learning their first programming language, and they also provide a learning path for experienced developers to learn a new language quickly.

Start with simple input and output programs. Do some currency conversion and figure out how many months it takes to pay off a credit card. Calculate blood alcohol content and determine if it's safe to drive. Replace words in files and filter records, and use web services to display the weather, store data, and show how many people are in space right now. At the end you'll tackle a few larger programs that will help you bring everything together.

Each problem includes constraints and challenges to push you further, but it's up to you to come up with the solutions. And next year, when you want to learn a new programming language or style of programming (perhaps OOP vs. functional), you can work through this book again, using new approaches to solve familiar problems.

Q&A with Brian Hogan, author of Exercises for Programmers

Why did you decide to write this book?

I learned to program when I was in fourth grade. I was struggling with some math problems at the time, and my dad showed me how to write a program to quiz me at math problems. My dad wasn't formally trained, he just knew enough to show me what to do. And so programming, to me, was about solving problems.

But when I got to college, my professors were more interested in doing algorithms and puzzles. I was never great at mentally connecting the dots. But I had one teacher who was very focused on real-world programming; writing programs to solve business problems. And everything clicked.

When I got into the field, I found myself in many situations where I was teaching people to code, and I needed exercises for them to do, so I started looking at the things I had to write at work and simplifying them down. I've written BMI calculators, widgets for web sites that pulled down the weather, URL shorteners, and many other things that can teach programming concepts in context.

So when I became a teacher full-time a few years ago, I began introducing these exercises into my classes for additional practice in order to prepare students for assessments. I saw student performance improve significantly. And I figured that if it worked for me, it would work for everyone.

So this book is for beginners?

Over the years I've had to learn some new programming languages, and I've returned to these programs to get me through that. When I was learning Go a few years ago, I tried these programs. And I just did the same thing this last year with Elixir. I've seen how the "todo list" program has become the way for developers to get their minds around an MVC framework, so I think there's a ton of value in solving known problems with a new language. I also think it's easier to learn a language when you have some goals and direction. When you've never used Swift before, even something as simple as making a mad-lib program can be a great experience.

What's your favorite exercise in this book?

One of the exercises in the book uses an API to show you how many people are in space. The API shows you their names and which spacecraft they are on. First, I think it's awesome we live in a time where people are in space. But also, I think the exercise is interesting and engaging, while still having you work through the concepts of pulling down remote data and formatting it.

What do you hope readers take away from the book?

I think we get better with practice. If you are playing piano and you only go to your lessons, and you never practice in between, you won't be as good as you could be. And I think that is the same with writing code. I think if you go through a degree program and only do the work that's assigned, you won't get as much experience. And I believe that the more languages you explore, the better you'll get at solving problems. So I hope that by reading this book, people will be inspired to practice with the language they know, or even to try a new language.

Now available from

Learn Game Programming with Ruby: Bring Your Ideas to Life with Gosu

If you have a little experience programming in Ruby or another language, then you're ready to start making your own video games. In this book you'll learn concepts such as animation, keyboard and mouse movement, sounds and music, and physics as you build four exciting games.

Your first game will test your reflexes as you try to click on a ruby that pops in and out of your screen. Learn how to draw images and text, and how to make objects move around the screen. You'll make a space-shooter where you defend your home base from a seemingly endless stream of enemies, as you discover how to use keyboard input, add music and sounds, an opening title screen, and scrolling end-credits. Next up: make a sliding number puzzle game where you'll learn to incorporate more complicated logic and user interaction into your game. Learn all about game physics as you build a game where a bold adventurer must climb out of a pit while dodging bouncing, spinning rocks. Finally, package up your games as Windows and Mac apps so you can share them with your friends.

When you're done with this book, you'll have improved your programming skills, and you'll have all the tools you need to make your own arcade-style games.

Now available from

Upcoming Author Appearances

  • 2015-09-17 Chris Adamson, CocoaConf Boston
  • 2015-09-18 Chris Adamson, CocoaConf Boston
  • 2015-09-23 Mattias Skarin, Upphandla IT, Göteborg
  • 2015-09-24 Alex Miller, Strange Loop – St. Louis, MO
  • 2015-09-29 Jesse Anderson, Strata NYC
  • 2015-09-29 Johanna Rothman, Agile Cambridge
  • 2015-09-30 Johanna Rothman, Agile Cambridge
  • 2015-10-05 Adam Tornhill, GOTO Copenhagen, Denmark
  • 2015-10-05 Janie Clayton, 360|iDev Min; Greenville, SC
  • 2015-10-07 Adam Tornhill, GOTO Copenhagen, Denmark
  • 2015-10-09 Janie Clayton, CocoaLove 2015, Philadelphia, PN
  • 2015-10-12 Adam Tornhill, 8th Light University (London, UK)
  • 2015-10-13 Adam Tornhill, Software Architect 2015, London, UK
  • Don't Get Left Out

    Are your friends jealous that you get these spiffy email newsletters and they don't? Clue them in that all they need to do is create an account on (email address and password is all it takes) and select the checkbox to receive newsletters.

    Are you following us on Twitter and/or Facebook? Here's where you can find us and keep up with the latest news and commentary, and occasional discounts:

    Tell your friends! Tweet this

    Follow us on Twitter: @pragprog, @pragpub, Andy @PragmaticAndy and Dave @pragdave.

    Coming Soon:

    • Programming Phoenix in beta
    • iOS 9 SDK Development: Creating iPhone and iPad Apps with Swift in beta
    • Modern Perl, 4th Ed.

    Recently Released:

    Thanks for your continued support,

    Andy & Dave The Pragmatic Programmers

    Books • eBooks • PragPub Magazine • Audiobooks and Screencasts