A common task that I encounter regularly in my Rails apps is needing to setup a background job that runs on a regular schedule. Essentially what we want is a cron job but the last thing I want to be doing is fiddling around with a crontab on the server. It would be much better if I could configure the scheduling within my Rails app itself and then I can keep the schedule configuration under source control. This makes makes it easy to update the schedule and have updates deployed automatically along with my app.

Thankfully we don’t have to build this functionality from scratch as there is a great Ruby gem called Whenever that allows us to set up cron jobs from within our Rails apps using Ruby code. In this blog post I’ll cover how you can schedule your background jobs in Rails using Whenever to set up your schedule, along with Sidekiq to run the actual background jobs.

A couple weeks ago I had the wonderful opportunity of teaching some basic coding to a class of Grade 5 and 6 students at a local elementary school. This was my first time doing anything like this and so preparing was difficult as I really had no idea what to expect. I had to come to the class with a fairly broad set of expectations and a flexible plan that could adapt to both the abilities and interests of the kids. I was preparing for the worst.

Thankfully all my concerns were unfounded and it ended up being much easier that I could have imagined. The kids were all excited to learn coding and they latched on to the material quickly. What was clear to me is that they loved it and they wanted more. What was also obvious is that coding is something that is currently missing from their elementary school curriculum. While I was glad to for the opportunity to share with the kids, it seemed unfortunate that they weren’t already getting taught these skills.

Coming away from this experience, not only was it obvious that the kids wanted more, but I also wanted more. It was a learning experience for me and a very rewarding one at that. If you are a developer, I would encourage you to look for opportunities in your local community where you can share your knowledge and expertise with kids.

One of the difficult parts in teaching kids how to code is figuring out exactly what to teach and how to teach it. When I was first learned how to program there were generally two programming languages that were used: Basic and Pascal. I learned both of those in my high school computer science classes and looking back I don’t think either of those options were really very good. Thankfully there has been a lot of research and development done in this area and today there are much better options.

Let’s take a look at some of the options that are available today.

I can’t remember when I first discovered the world of podcasting but it was around the time that Apple first added Podcasts to the iTunes store, so sometime around 2005. While I can’t recall the exact moment, looking back I find it incredible to consider the massive impact that discovery has had on me. A whole new world of knowledge and a whole new way of learning was opened up to me.

I’ve been a regular listener of podcasts ever since.

Lately I’ve had a daily routine of going for walks and listening to podcasts. It’s great way to get some exercise and learn new things at the same time. I specifically use the time for listening to podcasts related to my profession as a software developer. I have found that the time spent doing so is invaluable and through it I have been helped to stay on top of new technology while getting inspired and motivated to keep improving my craft. It keeps me learning and helps to guard against burn out and learning fatigue. As someone who works from home, it’s easy to feel isolated and get lost in your own echo chamber. Podcasts help me feel connected and I feed off the energy and excitment of the hosts and their guests.

Conway’s Game of Life is one of those foundational programming exercises that goes back to the early days of computer programming. If you haven’t heard of it before, I encourage you to read all about it at Wikipedia.

My interest in Conway’s Game of Life was recently piqued when I read Corey Haines excellent little book Understanding the Four Rules of Simple Design. I highly recommend the book to any software developer who is seeking to improve their skills in the craft of software design. The book details the lessons learned from applying the Four Rules of Simple Design (which were first articulated by Kent Beck) to Conway’s Game of Life.

In reading the book and going through all the examples, which were based around the Game of Life, I realized that I had never written an implementation of the Game of Life myself. I thought it was high time to and go ahead and do that. Since my current programming language of choice is Ruby, and also since the examples in Corey’s book use Ruby, I decided to implement my version in Ruby as well.

The quest for perfection is a tantalizing yet generally elusive goal.

As a software developer I feel a continual pull towards perfectionism in my craft. It comes down to wanting to produce elegant software designs that are executed with clean code, resulting in quality software that is easy to maintain and adapt to future requirements. Essentially I like to write code that I wouldn’t be ashamed to share with other programmers whose work I look up to and admire.

This desire to write good code doesn’t just appear natually. I think it is something has been developed and encouraged by having great mentors, reading good books on software development and listening to master programmers, those who have honed the art of software development. What I love about listening to great programmers is that I always feel the push to do better, to improve myself and the code I write. This is source of the pull to perfectionism for me and I’m very glad for it.

Overall this is a great thing because I want to grow and improve, I want to learn from my mistakes and know I can do better in the future. However, there is also be a dark side which can be debilitating.

I recently worked a Rails project in which I had to automate the process of filling out a PDF form from the app. To do so I utilized a gem called pdf-forms which worked great. If this is something that you need to do, I would recommended checking out the article Pre-Filling PDF Form Templates in Ruby-on-Rails with PDFtk which gives some code examples on how to structure your code when working with pdf-forms.

The key dependency which pdf-forms utilizes for working with PDF files is PDFtk which is a command line tool for interacting with PDFs. As such, in order to use pdf-forms you’ll need a binary of PDFtk which pdf-forms can access. On my local dev environment this was no problem, just a matter of downloading and installed the binaries for my platform. However it was a different story when it came to deploying the app on heroku and getting it working there.

It took a bit of digging but I eventually got it working and thought it would be worth sharing here in case someone runs into the same issue.

I’ve always had an interest in education and learning. This has naturally fit well with my profession as a software developer / programmer. These days most professions require some level of continual improvement and ongoing education, however with programming ongoing “professional development” is our bread and butter.

To some (and I would fit into this category), this is an attractive element of the job as it keeps things challenging and the work rarely gets boring. To others it is a wearying trend, knowing that what you learn this year will most likely be obselete by the next year, or at the very least, will have gone through significant evolutionary development. If that’s you, then you probably want to find another career because it’s not slowing down anything soon.

My interest in the field of education is not limited to my own self improvement, but rather it extends out into a passion of mine, which is to teach others about technology, and specifically programming. As such, I take a keen interest in various websites, courses and tools which have been created to teach programming. Throughout the years of using and interacting with various educational materials, I’ve found that I’ve always been left wanting, but I never felt I could express what exactly was missing. Thanks to Bret Victor’s incredible article Learnable Programming, that has now changed.