Thursday, November 20, 2014

"Sometimes you're the windshield", or, a rare moment when programming is not all pain

Something worked today. Hold your applause until the end.

I decided to build Whatnext (the nihilistic todo list) with something called Django, which is supposed to handle all of the common website stuff, like logins and tables and sorting.  It mostly does, but it's a very leaky abstraction.  Sometimes something that is supposed to be very simple turns out to two minutes of work, IF AND ONLY IF you already know Python data structures so well that you can instantly describe how each of the following differ:
for i in dir(context): print i
for d in context.dicts: print d.keys()
for i in context["field"].__dict__.items(): print i
If you don't know (I still don't), you'll spend a few hours on that two-minute task.

Well.  Just now I decided I wanted to bite the bullet and learn "messages", which is Django-speak for those nice little announcements that pop up after you do something on a website but don't bother you and go away in a few seconds. Slightly less than seven minutes later, I had this:

How nice is that?  It's about 8 out of 10 nice, I think; it needs to be yellow with drop shadow for 9 of 10 nice, beyond that maybe rounded corners and some spirit fingers?

I'm so relieved and startled to have something be as easy as it was supposed to be.  You're not always the bug; sometimes you're the windshield.

No comments :

Post a Comment