October 03, 2014

Teaching About Data

How do you teach beginning programmers about data in the internet age?

  • Teach the kids how to learn on their own: for example, can you find and use technical data sources using Google? Self-teaching is a key hallmark of successful students.
  • Teach using real-world mainstream idioms: Javascript, jQuery, HTML5. This lets kids directly apply code examples from the web. We take advantage of Pencil Code to make this easy.
  • Keep things real: it is more meaningful if we use real data to answer real-world questions!

It is a real pleasure to see students learning to learn independently this way.

Last week I taught a class about data that went very well. It was interesting enough that maybe others might want to try to do the same.

Using Google to find a Technical Article

The class started with an acronym: JSON. A lot of data on the internet is made available using a technology called JSON, so we began by searching Google for code ideas by using the query [Using JSON to get public data]. That query lead us to a few articles, including a blog post by Mark Lee....

The article is a typical technical blog post, including a bit of a story, some explanations, links to running code, and snippets of source code.

After the girls skimmed the article, they put Pencil Code into HTML/Javascript mode (using the "gear" button) and pasted the code in. Another tool that you can use this way is jsfiddle; the difference is that Pencil Code lets students save work with readable URLs.

After copying and pasting the HTML and JS code, I encouraged the students to try running the code before stopping to understand it. Our first mission was to test if the example worked.

Running the code produced a nice dropdown menu with Denver-area zip codes and a submit-button. Beautiful!

But clicking the button did not work.

Time to debug.

Debugging a Code Sample

The broken code was a good chance to learn a few concepts.

  • We started by checking the JSON URL. We clipped the base URL out of the code example (http://data.colorado.gov/resource/4ykn-tg5h.json) and viewed it directly in the browser. The URL worked! And it was an excellent chance to stop and look at JSON and discuss its structure.
  • Then after looking at the code more carefully, we discussed URL parameters, the oddly-formatted name-value pairs after the question mark in a URL. This was another opportunity to look up explanations on Google. Google Image Search had a good diagram explaining the idea.
  • Based on the code, we tested the URL parameter principalZipCode, setting it to a specific Denver area zip code, and visiting the JSON URL directly. This also worked, filtering out records. Estimating the number of records was an opportunity to stop and realize that there was a lot of data here.
  • Finally we looked at the Chrome Debugger's Network trace panel, and examined the URLs produced by the submit-button in the sample code. Here we discovered that the principalZipCode created by the example code was malformed, including only four digits of the zip code instead of five.
  • At that point, the students quickly discovered that a function call "substring(1, 6)" was clipping out the wrong substring - and that it should have been "substring(0, 5)". Fixing the code, they all got the example to work.


For us, debugging was an excellent way to learn the important concepts behind the code sample.

Social Implications of Big Data

At this point, the students chatted about the sort of data that was used in Mark Lee's example: it was information on credit status of various Denver-area companies, including information about credit delinquencies.

It was a good opportunity to talk about the social ramifications of big data: as soon as you get a credit card, credit reporting agencies begin collecting a permanent file about you. Huge databases track every piece of commerce in the world. Big data could be a good or a bad thing, depending on how you look at it.

Do you want to be tracked in these databases? What will happen with your data when you miss a payment on a loan someday?

The students wanted to add an extra field to the output: the name of the investigating agent for each record - which was present in the database. I suppose it was interesting to add information to let you watch the watchers. And it was a great exercise in navigating a JSON schema by looking at sample records.

Working Independently: Talking About the Weather

The final exercise of the day was to write a new app to show the current weather (temperature or rainfall) in the city of your choice.

When the students said, "I have no idea how to do that!" I reminded them that they knew how to use Google to find data sources - just remember to include the right acronyms.

Searching for "Public Weather JSON API" lead to a ton of sources and examples.

When one of the students asked, "Should we use the same old example and change it, or write new code?" I suggested they could keep the old example if they wanted, but they might have to change it quite a bit to make it work....

But then they did: it took about 30 minutes, but they were all able to find a free JSON API for weather, and then modify the credit-checking example to show a the weather in a selected city around the world.

Here is one of the final projects: http://cipher.pencilcode.net/home/weather. Once in a while it will give an exception when the JSON data comes back with an empty array; but most of the time it works! Not bad for a quick hack in class!

Posted by David at October 3, 2014 12:54 PM

http://stefondiggs.wholesale-nfljerseys.us/ stefon diggs
http://sf49ers.nflshop-jerseys.us/ sf 49ers
http://klaythompson.nbajerseys-store.us/ klay thompson
http://coyoteshockey.nhljerseysshop.us/ coyotes hockey
http://rangers.mlbjerseys-shop.us/ rangers
http://clevelandbrowns.wholesale-nfljerseys.us/ cleveland browns
http://mnwild.nhl-shop.us/ mn wild
http://nyyankees.cheapmlbshop.us/ ny yankees
http://azcardinals.nflshop-jerseys.us/ az cardinals
http://henriklundqvist.nhljerseysshop.us/ henrik lundqvist
http://jalenramsey.wholesale-nfljerseys.us/ jalen ramsey
http://losangeleskings.nhljerseysshop.us/ los angeles kings
http://clevelandcavaliers.nbajerseys-store.us/ cleveland cavaliers
http://detroitpistons.nbajerseys-store.us/ detroit pistons
http://blueshockey.nhljerseysshop.us/ blues hockey
http://pistons.nbajerseysshop.us/ pistons
http://twins.cheapmlbshop.us/ twins
http://newyorkmets.mlbjerseys-shop.us/ new york mets
http://jaredgoff.wholesale-nfljerseys.us/ jared goff
http://memphisgrizzlies.nbajerseys-store.us/ memphis grizzlies
http://sidneycrosby.nhljerseysshop.us/ sidney crosby
http://tyreekhill.wholesale-nfljerseys.us/ tyreek hill
http://newenglandpatriots.wholesale-nfljerseys.us/ new england patriots
http://chicagoblackhawks.nhl-shop.us/ chicago blackhawks
http://lonzoball.nbajerseys-store.us/ lonzo ball
http://markingram.nflshop-jerseys.us/ mark ingram
http://evgenykuznetsov.nhl-shop.us/ evgeny kuznetsov
http://greenflypackers.wholesale-nfljerseys.us/ green bay packers
http://kcchiefs.wholesale-nfljerseys.us/ kc chiefs
http://dwaynewade.nbajerseysshop.us/ dwayne wade
http://miketrout.mlbjerseys-shop.us/ mike trout
http://jaysontatum.nbajerseysshop.us/ jayson tatum
http://cavaliers.nbajerseys-store.us/ cavaliers
http://ovechkin.nhljerseysshop.us/ ovechkin
http://rangersbaseball.cheapmlbshop.us/ rangers baseball
http://nymets.mlbjerseys-shop.us/ ny mets
http://oilers.nhl-shop.us/ oilers
http://brooklynnets.nbajerseysshop.us/ brooklyn nets
http://grandrapidsgriffins.nhljerseysshop.us/ grand rapids griffins
http://phillies.mlbjerseys-shop.us/ phillies
http://whitesox.mlbjerseys-shop.us/ white sox
http://canucks.nhljerseysshop.us/ canucks
http://deandrehopkins.wholesale-nfljerseys.us/ deandre hopkins
http://johnwall.nbajerseysshop.us/ john wall
http://davidwright.cheapmlbshop.us/ david wright
http://cardnials.cheapmlbshop.us/ cardnials
http://stlblues.nhljerseysshop.us/ stl blues
http://damianlillard.nbajerseys-store.us/ damian lillard
http://brandonmarshall.nflshop-jerseys.us/ brandon marshall
http://penguinshockey.nhljerseysshop.us/ penguins hockey
http://drewdoughty.nhljerseysshop.us/ drew doughty
http://robgronkowski.nflshop-jerseys.us/ rob gronkowski
http://kobebryantjersey.nbajerseysshop.us/ kobe bryant jersey
http://arizonadiamondbacks.mlbjerseys-shop.us/ arizona diamondbacks
http://minnesotawild.nhl-shop.us/ minnesota wild
http://newyorkjets.nflshop-jerseys.us/ new york jets
http://marlin.mlbjerseys-shop.us/ marlin
http://pirates.mlbjerseys-shop.us/ pirates baseball
http://odellbeckhamjr.nflshop-jerseys.us/ odell beckham jr
http://tombrady.wholesale-nfljerseys.us/ tom brady
http://mlbangels.cheapmlbshop.us/ mlb angels
http://cubsschedule.mlbjerseys-shop.us/ cubs schedule
http://torontomapleleafs.nhl-shop.us/ toronto maple leafs
http://russellwestbrook.nbajerseysshop.us/ russell westbrook
http://antoniobrown.nflshop-jerseys.us/ antonio brown
http://sacramentokings.nbajerseys-store.us/ sacramento kings
http://traviskelce.wholesale-nfljerseys.us/ travis kelce
http://nets.nbajerseysshop.us/ nets
http://floridamarlins.cheapmlbshop.us/ florida marlins
http://sanantoniospurs.nbajerseys-store.us/ san antonio spurs
http://warriors.nbajerseys-store.us/ warriors
http://deseanjackson.nflshop-jerseys.us/ desean jackson
http://carolinahurricanes.nhl-shop.us/ carolina hurricanes
http://elimanning.wholesale-nfljerseys.us/ eli manning
http://nuggets.nbajerseys-store.us/ nuggets
http://russellwilson.nflshop-jerseys.us/ russell wilson
http://redsoxjersey.cheapmlbshop.us/ red sox jersey
http://reubenfoster.wholesale-nfljerseys.us/ reuben foster
http://claudegiroux.nhljerseysshop.us/ claude giroux
http://lachargers.nflshop-jerseys.us/ la chargers
http://arizonacoyotes.nhljerseysshop.us/ arizona coyotes
http://montrezlharrell.nbajerseysshop.us/ montrezl harrell
http://jimmybutler.nbajerseysshop.us/ jimmy butler
http://mntwins.mlbjerseys-shop.us/ mn twins
http://floridapanthers.nhl-shop.us/ florida panthers
http://stlouisblues.nhl-shop.us/ st louis blues
http://alabamafootball.wholesale-nfljerseys.us/ alabama football
http://juliusrandle.nbajerseys-store.us/ julius randle
http://sjsharks.nhljerseysshop.us/ sj sharks
http://calripken.cheapmlbshop.us/ cal ripken
http://larams.nflshop-jerseys.us/ la rams
http://ericberry.wholesale-nfljerseys.us/ eric berry
http://julianedelman.nflshop-jerseys.us/ julian edelman
http://gordonhayward.nbajerseysshop.us/ gordon hayward
http://denvernuggets.nbajerseys-store.us/ denver nuggets
http://ravens.nflshop-jerseys.us/ ravens
http://deionsanders.nflshop-jerseys.us/ deion sanders
http://torontoraptors.nbajerseys-store.us/ toronto raptors
http://kobebryant.nbajerseys-store.us/ kobe bryant
http://bostonbruins.nhl-shop.us/ boston bruins
http://birminghambarons.cheapmlbshop.us/ birmingham barons
http://nickchubb.nflshop-jerseys.us/ nick chubb
http://indianapoliscolts.wholesale-nfljerseys.us/ indianapolis colts
http://shaquilleoneal.nbajerseys-store.us/ shaquille o neal
http://clintcapela.nbajerseysshop.us/ clint capela
http://marcusmariota.nflshop-jerseys.us/ marcus mariota
http://aaronrodgers.wholesale-nfljerseys.us/ aaron rodgers
http://connormcdavid.nhl-shop.us/ connor mcdavid
http://dylanlarkin.nhljerseysshop.us/ dylan larkin
http://milwaukeebucks.nbajerseys-store.us/ milwaukee bucks
http://washingtoncapitals.nhl-shop.us/ washington capitals
http://andrewluck.wholesale-nfljerseys.us/ andrew luck
http://coltmccoy.nflshop-jerseys.us/ colt mccoy
http://ryanfitzpatrick.nflshop-jerseys.us/ ryan fitzpatrick
http://minnesotavikings.wholesale-nfljerseys.us/ minnesota vikings
http://coloradoavalanche.nhl-shop.us/ colorado avalanche
http://minnesotatimberwolves.nbajerseys-store.us/ minnesota timberwolves
http://melvingordon.wholesale-nfljerseys.us/ melvin gordon
http://blakegriffin.nbajerseys-store.us/ blake griffin
http://jordynelson.wholesale-nfljerseys.us/ jordy nelson
http://carlhagelin.nhljerseysshop.us/ carl hagelin
http://taylorhall.nhljerseysshop.us/ taylor hall
http://bryceharper.mlbjerseys-shop.us/ bryce harper
http://miamidolphins.wholesale-nfljerseys.us/ miami dolphins
http://williecauleystein.nbajerseysshop.us/ willie cauley stein
http://losangeleschargers.nflshop-jerseys.us/ los angeles chargers
http://alexlen.nbajerseysshop.us/ alex len
http://bluejackets.nhl-shop.us/ blue jackets
http://markstone.nhljerseysshop.us/ mark stone
http://seattleseahawks.nflshop-jerseys.us/ seattle seahawks
http://miamimarlins.mlbjerseys-shop.us/ miami marlins
http://charlesbarkley.nbajerseys-store.us/ charles barkley
http://houstontexans.wholesale-nfljerseys.us/ houston texans
http://pittsburghsteelers.wholesale-nfljerseys.us/ pittsburgh steelers
http://joelembiid.nbajerseysshop.us/ joel embiid
http://nashvillepredators.nhl-shop.us/ nashville predators
http://tonyparker.nbajerseysshop.us/ tony parker
http://crosby.nhljerseysshop.us/ crosby
http://kliffkingsbury.nflshop-jerseys.us/ kliff kingsbury
http://bostonredsox.mlbjerseys-shop.us/ boston red sox
http://mlb.mlbjerseys-shop.us/ mlb
http://lebronjersey.nbajerseysshop.us/ lebron jersey
http://clintfrazier.cheapmlbshop.us/ clint frazier
http://suns.nbajerseys-store.us/ suns
http://raptors.nbajerseys-store.us/ raptors
http://capitals.nhl-shop.us/ capitals
http://bradmarchand.nhljerseysshop.us/ brad marchand
http://minnesotatwins.cheapmlbshop.us/ minnesota twins
http://camnewton.nflshop-jerseys.us/ cam newton
http://jeremylin.nbajerseysshop.us/ jeremy lin

Posted by: jordan shoes at May 29, 2019 08:32 AM
Post a comment

Remember personal info?