for an algorithm example use a simple insertion sort.
What would you teach in an intro programming session for librarians?
If you’re part of this group, no doubt you’ve been asked to teach programming to non-programmers. In a few weeks I’ll be playing the role of Derek Willis and giving a two-hour intro-to-programming presentation at the Special Library Association conference. If you were in my shoes, what would you make sure people were introduced to?
Two hours doesn’t seem like enough time to fully “teach” a specific topic (okay ladies and gentlemen, this is a Class and this is an Object . . .), so I think a broad introduction to programming — and speaking to programmers — is in order. I want people to leave with a good understanding of what thinking like a programmer could do for them and how they could get started learning the right skills or finding the right people. Rather than bias people with any more than that, I’m curious what this group thinks.
Leave a Reply
You must be logged in to post a comment.
13 Answers
+1 for thinking like a programmer -- something I'm still learning, myself.
This article on computational thinking by Jeannette Wing, a related podcast and other materials were huge in helping to rethink my thinking (sorry for the shameless plug there) as someone who previously didn't have much background in coding.
Also, helping them to understand the programming concepts and lexicon, as Mark alluded to, would be helpful.
To make it more engaging, near the end you could ask what parallels they see between their field and programming -- basically to create a discussion amongst themselves.
Leave a Reply
You must be logged in to post a comment.
I'm sure you thought of this already, but maybe a good start would be to do a broad deconstruction the programming behind an online library catalogue. Librarians live for collecting, organizing and cataloguing information, right? Stress that that's what it's all about. Show them how something they are intensely familiar with works, and I bet their own ideas oh how it can be applied elsewhere will take it from there.
Leave a Reply
You must be logged in to post a comment.
As a tool I've not seen many people use that I found really nice as part of my web scraping toolkit, pyquery is an implementation of jquery's CSS selection niceties in python - you can see an example of me using this to scrape the Arizona legislature members here :
http://github.com/markng/theyworkforaz/blob/master/reps/management/commands/load_house_members.py
Leave a Reply
You must be logged in to post a comment.
Thinking about what librarians are already doing, and where I'm often asking for our librarian's help, a good introduction to databases could go a long way.
Without going too deep into software specifics, I'd focus on the role of relational databases on the web, and maybe a bit about working with one in your favorite programming language (or framework).
If there's time, throw in a bit about social bookmarking (Delicious, Google Reader and esp. Publish2). Then talk about RSS and content portability, and talk a little about what's possible with the right combination of social bookmarking, RSS and a web app built on a solid database. Now you have managed aggregation and curation for the whole newsroom.
Leave a Reply
You must be logged in to post a comment.
Some good, perspective-building topics like:
- What is a program?
- The role of a compiler/interpreter.
- Major programming paradigms (imperative, procedural, OO, functional, etc.). Don't dwell too much on each though at this stage.
Programming Concepts:
- Variables.
- Control structures.
- Data structures and types.
- Operators
- Expressions (and return values)
- Functions
- Abstraction.
- Algorithms.
Again, you can look at the Pragmatic Programmer's website for intro books. There must be lots of curricula posted from intro CS courses that will give you a starting point.
Here is a whole slew of lectures that can give you a good start: http://videolectures.net/mit600f08_intro_computer_science_programming/
- Aimed at beginners.
- Uses Python.
Leave a Reply
You must be logged in to post a comment.
It's always instructive (at least for me) to actually see some code doing real work, however basic the example.
How about walking through a simple program that runs a news story or some other unstructured text through the OpenCalais API? That would let you wade into some beginner programming concepts and engage in a discussion about the potential -- or shortcomings -- of automated metadata extraction (a topic librarians no doubt have strong feelings about).
Alternatively, you could show them how to build a program that hits one of many library APIs. Either way, you can tease out some basic programming concepts with concrete examples while opening the door to a broader discussion about the power of programming and the web.
Leave a Reply
You must be logged in to post a comment.
My php scraping tools mentioned earlier.
<?php
function get_closer($string,$location){ // Takes a String and a Location. Cuts the String at the End of the Location and returns the remainder.
$location_length=strlen($location);
$break_point=strpos($string,$location);
$break_point=$break_point+$location_length;
$string=substr($string,$break_point);
return($string);
}
function get_next($string,$location,$delim){ // Takes a String and a finds the next occurance of the Location. Cuts it there and return what is between the Location and the Delim
$location_length=strlen($location);
$break_point=strpos($string,$location);
$break_point=$break_point+$location_length;
$string=substr($string,$break_point);
$to_return=substr($string,0,strpos($string,$delim));
return($to_return);
}
function cutter($string,$start,$end){ //Cuts a string between 2 deliminators but does not include the deliminator. Good when the start is unique and the end is known. Useful with get_closer
$start_place=strpos($string,$start)+strlen($start);
$new_string=substr($string,$start_place);
$end_place=strpos($new_string,$end);
$new_string=substr($new_string,0,$end_place);
$new_string=trim($new_string);
return($new_string);
}
function tailfinder($string,$start,$end){ //cuts a string between 2 deliminators but uses the end as a reference. Good when the end is unique and the start is known.
$best_start=0;
while (strpos($string,$start)>0){
$start_place=strpos($string,$start)+strlen($start);
$end_place=strpos($string,$end);
if ($start_place<$end_place){
$best_start=$start_place;
$string=get_closer($string,$start);
}
else{
break;
}
}
$new_string=substr($string,0,$end_place);
$new_string=trim($new_string);
return($new_string);
}
function curl_login($url,$data,$proxy,$proxystatus){ ///Used to start a session on a username and password site. Questions ask Jeremy
$fp = fopen("cookie.txt", "w");
fclose($fp);
$login = curl_init();
curl_setopt($login, CURLOPT_COOKIEJAR, "cookie.txt");
curl_setopt($login, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($login, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($login, CURLOPT_TIMEOUT, 40);
curl_setopt($login, CURLOPT_RETURNTRANSFER, TRUE);
if ($proxystatus == 'on') {
curl_setopt($login, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($login, CURLOPT_HTTPPROXYTUNNEL, TRUE);
curl_setopt($login, CURLOPT_PROXY, $proxy);
}
curl_setopt($login, CURLOPT_URL, $url);
curl_setopt($login, CURLOPT_HEADER, TRUE);
curl_setopt($login, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($login, CURLOPT_FOLLOWLOCATION, TRUE);
curl_setopt($login, CURLOPT_POST, TRUE);
curl_setopt($login, CURLOPT_POSTFIELDS, $data);
ob_start(); // prevent any output
return curl_exec ($login); // execute the curl command
ob_end_clean(); // stop preventing output
curl_close ($login);
unset($login);
}
function curl_grab_page($site,$proxy,$proxystatus){ ///Used to grab information from a user login site
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
if ($proxystatus == 'on') {
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, TRUE);
curl_setopt($ch, CURLOPT_PROXY, $proxy);
}
curl_setopt($ch, CURLOPT_COOKIEFILE, "cookie.txt");
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)");
curl_setopt($ch, CURLOPT_URL, $site);
ob_start(); // prevent any output
return curl_exec ($ch); // execute the curl command
ob_end_clean(); // stop preventing output
curl_close ($ch);
}
?>
Leave a Reply
You must be logged in to post a comment.
I think it's the most instructive for a beginner like myself to see a finished project, and then walk through the workflow from conception.
I'd also like to see a peek at the behind the scenes programming, maybe make a change in the code, and watch it live.
Leave a Reply
You must be logged in to post a comment.
Since you're limited to two hours, I'd make it less functional and more meta.
As such, two elements I'd be sure to include are:
- Asking the group about the kinds of problems they encounter/hope to solve.
- Provide an orderly path of online reference material (after all, they're librarians, right?). Start with something like How to Think Like a Computer Scientist.
Leave a Reply
You must be logged in to post a comment.
Have you asked reps from SLA about their most pressing needs/most frequent questions or the situations that come up most often that could be helped by programming?
Unfortunately, SLA's discussion boards are visible with list registration only, and the blogs are a bit too specific, though the Government Information Division blog might have some ideas for you.
Two hours is a lot of time for an overview -- you could cover a lot of ground in that time. But overviews might be a little frustrating to a group that, at least in my limited experience, likes explanations of real-world case studies.
Leave a Reply
You must be logged in to post a comment.
This is pretty similar to the answers above from Devin and Chris, but I think it's always helpful to explain to someone how things they already do are similar to this new thing you're helping them learn.
Way back when we first started getting our reporters into blogging, we highlighted things like:
- You send email all the time, right? Making a blog post is just like that: Subject, body, hit "publish."
- You compile news and notes columns already for print; blogging is just like that, only you get to publish them throughout the week instead of just once.
Finding relationships to existing tasks made the technical side of the training feel much less complicated for them. Sorry for being more approach-focused than topic-focused, but there seems to be a lot of good topical suggestions already ;)
Leave a Reply
You must be logged in to post a comment.
I took a class from a special librarian, and based on that experience, I'd recommend being very careful to avoid underestimating their knowledge as a group.
Most have been dealing with RSS, social bookmarking and digital taxonomies deeply for several years now.
Err on the side of going too deep, or being over some people's heads, rather than insulting the intelligence or boring the others.
A real world example that solves a problem might be most appreciated. Is it possible in that time period to show a program that does a simple automation of tagging of content? Or somehow manipulates already tagged content?
Leave a Reply
You must be logged in to post a comment.
Make them play SQL Bingo: http://www.lincproject.org/toolkit/training/sql_bingo.php
I will say that my least favorite form of programming preso to non-programmers is the classic "Rails is easy. Look! I type this, then I type that! And I have a program now!" -- just convinces me that Rails is easy for you.
I think a lot of people would actually benefit from an intro to classes, objects and MVC structures -- if you could put together an intro class that explains clearly what those are and how to sketch out a simple project and get it started (perhaps with a cheat sheet they can take home to practice on) you'd get people out the gate nicely.
Question: Will folks be in front of a computer for this session?
Leave a Reply
You must be logged in to post a comment.
Your Answer
Please login to post questions.

Ya, that would be cool to finish the talk with a complete-looking app. Would definitely inspire people to try some new toys.
One of my long-running talking points is that RSS (or Atom) is one of the most important parts of the web because it makes content portable and allows things like mashups. We pretty much built DalianDalian.com on top of Delicious, Flickr and a handful of blogs, all aggregated into a Drupal-based site.
That’s a good point about social bookmarking, and you’re giving me the idea that maybe as I show things I can build on each to put together a functioning, integrated application (maybe).