The Scoop

  • Home
  • Projects
  • About The Scoop
  • Fixing Journalism
  • Medill Links
  • Departments
    • API
    • Apple
    • Asides
    • Broadcast
    • Campaign Finance
    • Car Tools
    • Data
    • DIY
    • django
    • Fed Data
    • FOIA
    • General
    • IRE
    • Journalism
    • Local Data
    • Mapping
    • Miscellany
    • NonGov Data
    • Online
    • Paper Trail
    • Presentations
    • Public Records
    • Python
    • Rails
    • SLA
    • Social Network Analysis
    • Sports
    • State Data
    • Teaching
    • Work
    • XML
  • Subscribe via RSS

Keeping It Simple(r)

November 25th, 2009  |  Published in Python, django  |  3 Comments

I haven’t mentioned Fumblerooski in awhile, but rest assured that work continues, especially during college football season. I’ve added more coaching information (still a long ways to go on that, though) and will be unveiling player rankings soon. But the biggest thing I’ve done lately has nothing to do with new features. Instead, as I’ve become a better coder in general, I’ve seen how bloat can really hinder a project. So I spent time last week reorganizing the Fumblerooski code to take advantage of some of Django‘s strengths.

This all started back at the NICAR conference in Indianapolis where several of us led a mini-bootcamp on using Django. At one point, as we talked about how projects are organized, I showed off the models for Fumblerooski. They went on forever. Looking back, it wasn’t the message that I wanted to get across – I think several people gasped.

Fumblerooski still is far more tightly coupled together than I’d like – the scrapers can’t really be separated out as an independent app, which would be the right thing to do. But it’s getting closer. Same for the rankings app. Coaches could be the next one, or maybe players. The scrapers, even though they don’t constitute an actual app, are better organized. The point is that now the code is probably easier for someone else to follow, but it’s also easier for me to locate specific functions. I spend less time hunting and more time actually doing things.

How does this actually work? Python’s ability to import libraries into others means that Django apps can share common code (and, if you’re working in the same database, data) inside a single project just by typing an import statement:

from fumblerooski.rankings.models import RushingSummary

And I get access to the rushing rankings wherever I need to use them. Because this is so trivial, it sometimes led me to think that where I put things didn’t matter. But it does, it really does, for your sake and the sake of anyone who attempts to look at your code.

Responses

Feed Trackback Address
  1. Ben says:

    November 25th, 2009 at 11:30 pm (#)

    I totally agree with this outlook, and everything I know about it I learned from James Bennett. Here’s an excellent speech he gave at DjangoCon 2008.

    http://www.youtube.com/watch?v=A-S0tqpPga4

    That, and his book Practical Django Projects, basically taught me how not to suck.

  2. Aron Pilhofer says:

    November 26th, 2009 at 1:41 pm (#)

    That’s cool. But is that unique to Python? Seems like pretty standard OOP. What am I missing?

  3. Derek says:

    November 26th, 2009 at 4:22 pm (#)

    No, definitely not unique to Python. But I think what Python does well is to nudge you (maybe not so subtly at times) into this direction. And I definitely needed the nudging.

Leave a Response

Recent Comments

  • Dave Stanton on A GitHub for Data?
  • Jessica Baumgart on How APIs Help the Newsroom
  • Bookmarks van juli 7th tot juli 14th | .: zerocontent - Blog :. on How APIs Help the Newsroom
  • Reporting with Data: How the New York Times Uses APIs on How APIs Help the Newsroom
  • Brad B on Six Reasons To Look Past Caspio

Recent Posts

  • A GitHub for Data?
  • How APIs Help the Newsroom
  • Big Numbers, Low Impact
  • Using the NYT Congress API with … Excel?
  • An Even Better CAR Conference?

Linking Out

  • Prop 19 Campaign Contributions - Los Angeles Times
  • Introducing the Open State Project API - Sunlight Labs: Blog
  • Teaching Geo-Spatial Thinking in High School Social Studies
  • NYC's Worst Landlords Watchlist | NYC Public Advocate
  • Chicago Tribune 2009 Illinois School Report Cards
  • 5,800 dead in Ohio still on voter rolls | The Columbus Dispatch
  • Nebraska Cornhuskers football rosters database - Omaha.com
  • offensive politics llc - House Data project
  • Cannibalize Business Development by Popularizing your API - Shaival Shah's Blog
  • Using the DocumentCloud API
  • Centralized logging for fun and profit! | Revolution Systems
  • AP IMPACT: Katrina a tale of SBA failure - Yahoo! News
  • RaceTracker is Up-To-Date for Today's Primaries - Blog - OpenCongress
  • Campaign cash: what interest groups are spending on 2010 midterm elections (washingtonpost.com)
  • Using Freebase Gridworks to Create Linked Data | Jeni's Musings


©2010 The Scoop
Powered by WordPress using the Gridline Lite theme by Graph Paper Press.