Main Content

Can you learn to program in 4 days?

Archive - Originally posted on "The Horse's Mouth" - 2009-07-16 16:13:39 - Graham Ellis

"New to programming" on Monday Morning ... and understanding a program that reads and analyses a web access log file, reporting back on remote hosts that visited us and stayed for between one and five minutes by the end of Thursday. That's a good advert for Ruby - and a good advert for our Learning to Program in Ruby course, and a good advert for Ruby too!

I have added the program that I wrote, with delegate help, here (that's the source for you). The program - even after such a short time with the language - was already revealing useful information from the data about the metrics of visitors too our web site.

Have a look at the example to see Ruby code for quite complex structures (a hash of arrays of objects, no less), directory handling, formatting output, regular expression work, and much more.

I have files the source code, ironically, under "Introduction to Ruby". It's not the first thing you would write, but it's certainly an example of what you can do very quickly with the language ... and its OO structure and maintainability shines through. Some of the more awkward time handling algorithms are encapsulated and reused, and the code to identify which records are automata (spiders and other robots), which are web site attacks, and which are real users is all held in one small area too.