Friday 25 February 2011

The SDL Perl Game Contest!

Sure, you know what SDL is, right? Well, SDL has very nice Perl bindings that let you use the power and flexibility of Perl to write awesome games in no time!

There's even a manual to help you get started, including full game tutorials and a list of free/open-source resources for your games, like sprites, sound effects and music.

But by far the Coolest Game Ever is the one *you* write, from that silly idea you had the other day to a playable game you and your friends can enjoy.

And this march, the SDL Perl team is going to help you take that project out of your dusty drawer of "TODO"s and turn it into a reality, with the SDL Perl Game Contest!

The rules are simple, and much like the Perl Ironman contest:

"One game per week. Every week of march."

This means by the end of march you'll have not one, but FOUR games to show for. How cool is that?!

In fact, you can even make your weekly game the subject of your Ironman posts this month, and take out two birds with one stone (hmm... more game ideas)!

This monday (feb. 28), start writing your game! You have until the following monday to make it playable ("complete") and start all over again with a brand new game for the next week.

But what if I miss a deadline? What if I can't start this monday?

It doesn't really matter - just join the party and have some fun! Even if you only get to do one game, it's still a great opportunity to improve your skills and learn a bit about game design and development.

If you need any assistance writing your game, from ideas to code, WE WILL HELP! Just send an email to the SDL Perl mailing list with your questions (subscribe by sending an empty email to sdl-devel-subscribe@perl.org, then fire your questions to sdl-devel@perl.org) or, better yet, join us live in #sdl over at irc.perl.org and we'll be more than happy to assist you and try your game out. If you never used irc before, please keep in mind people might be busy or in different timezones than you, so you may get instant responses or have to wait a few of hours before you get a reply. Be patient!

It can be a game about anything. Just make sure it's doable in a week. Some games take years to be complete, but you might be surprised at how much you can accomplish in just a few hours with SDL Perl :)

Oh, there's one extra rule, actually, and that's mandatory - HAVE FUN!! :)

Friday 18 February 2011

Teaching Perl to Undergraduates

Perl is an amazing programming language. And, with its growing worldwide re-popularization, it was an easy sell to the Computer Science Department of the Federal University of Rio de Janeiro, one of the best and most famous universities in Brazil, when I offered to give a free Perl summer class to the undergrads.

The idea was to give students the opportunity to learn a new language, presenting the concepts, structure, best practices and design patterns of modern Perl 5. It was also my response to seeing so many companies here complaining about the lack of Perl developers, forcing them to use other languages even when Perl would be the best alternative for them.

And what a huge success it was!

The course was given by Bruno Buss and myself, with me doing the talk and him preparing and giving exercises to the students and helping them with their code. At first we were hoping to get about 10 students interested, specially since we didn't have time to advertise the summer class at all. In fact, due to uncontrollable events, we could only confirm it and open registration two weeks before the class itself started. Even so, we decided to carry on with it. Later that night I got a message from Buss: "we're gonna need a bigger room".

Turns out that in less than 24 hours we already had over 25 undergrad students registered for the course! We kept registration open as a waiting list, since we couldn't find an available lab with more than 25 PCs in such a short timeframe. A day before the beginning of the class there were over 50 students applying for a spot, even though they already knew the class was full!

And this is Perl competing against student vacations, during summer, in Rio.

The course was one week long, from 1pm to 5pm (yes, we had to compensate $dayjob during nighttime, but it was well worth it). Slides for all 5 days are available. It's mostly Perl, with a little Portuguese here and there like variable names, values and complementary information whenever necessary. Here's what we covered:

  • Day 1 (slides) - What's Perl all about; how to use perldoc; the modern and safe header (use 5.12.3; use warnings); basic I/O; scalar variables; manipulating numbers and strings; conditionals; loops; and file I/O, with autodie to capture exceptions. We also spoke about the Perl community, showed off a bit of Padre, the Perl IDE, and encouraged students to use chromatic's brilliant "Modern Perl" book as reference material.
  • Day 2 (slides) - Running external programs; arrays (and how to manipulate them); hashes (and how to manipulate them); scalar x list x void context. That, and lots of exercises to fixate what they learned so far.
  • Day 3 (slides) - References; building complex data structures; functions (subroutines); stack traces with Carp and Carp::Always; and retrieving command line arguments with Getopt::Long. While explaining anonymous subs we also mentioned/demonstrated closures and state variables, but didn't really get into it as it was a beginners class. The day ended with an explanation of Perl's sweetheart, the CPAN. We showed students not only how to install modules (with local::lib), but included an explanation of the full CPAN stack, including web search, CPAN Testers, Deps, Ratings and Bug/Request Tracking. We also discussed how to exploit those features (and other common tips) to pick a good module (and, of course, Task::Kensho).

Students were mostly from Computer Science, with around 6 of them being from Biology/Biophysics/Bioinformatics, and one or two from Electric Engineering and Applied Mathematics. In the end, there were 27 undergrads. Yes, 27. It was very rewarding to see 2 booted students showing up anyway, with their laptops, asking if they could sit on the back and participate. Of course they could :)