Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entertaining and Interesting example to teach Ruby

Tags:

ruby

I have to take a small introductory talk on ruby tomorrow, I want to avoid going the boring power point presentation way and have a hands on session. The goal would be to introduce ruby to people, just the basic concepts really.

I'm planning to take an example from Why's Poignant Guide, do you know of any interesting example that would captivate the attention of the audience and make it an interesting talk.

EDIT : I'm done with the talk, it went reasonably well, there were about 50 people who turned up, About 10 of them picked up ruby really well. Some complained that I went too fast. All in all I covered the basics of ruby, didn't touch the OO Stuff. As for the examples I gave one in which we could scrape data from our college website using watir-webdriver. Thanks to all for your valuable answers and comments.

like image 316
nikhil Avatar asked Dec 27 '22 16:12

nikhil


2 Answers

Ok, so your audience are not programmers, so there's no point of pointing out Ruby's advantages over other languages. Also, there's no place for advanced topics such as metaprogramming or more serious OO or functional programming.

  • What I would try to show them first is irb, how they could evaluate simple mathematical expressions, and show them the concept of variables.
  • Strings and string interpolation.
  • Loops (10.times{ puts 'Hello world!' }) and branches (if-then-else).
  • If you have time, show them arrays (not sure about hashes)

I would also try to squeeze in a simple program in Sinatra as well. Students already know web and you can show "how the web really works" using couple lines of Sinatra code.

like image 194
Mladen Jablanović Avatar answered Jan 13 '23 10:01

Mladen Jablanović


Maybe they'd be interested in a bit of web scraping.

My project Easy Roommate parser visits a flat-mate sharing web site, and parses profiles to see which ones are compatible with what you want. My main warning is that my code isn't very good, and if lots of people used it, the web site owners may complain. However, it would be solving a problem that's common to many students.

Another project I did ages ago was Get to philosophy, which tried to work out why, when you click on the first link in each Wikipedia article you come across, you usually end up at Philosophy. Warning: this project is abandoned.

like image 44
Andrew Grimm Avatar answered Jan 13 '23 09:01

Andrew Grimm