March 19, 2012 at 9:21 PM by Dr. Drang
The other day, I followed a link from Pinboard’s popular page to this video. It’s a recording of a talk by Jack Diederich at PyCon US 2012, entitled “Stop Writing Classes.” The gist of the talk is something I’ve noticed when reading other people’s code: there’s an awful lot of object-oriented programming being done when there’s no need, and it’s diminishing the code’s readability and usability.
Before seeing the video, I thought this was a generational thing. My formal programming education came before object-oriented programming existed—structured programming was the hot phrase back then—and I figured I was just being a crotchety old man, too set in his ways to see the value of objects everywhere.
But no! Here’s this young guy—a Python core developer, no less—making fun of excessive class-building. Watching it made me feel hip and handsome and smart.
Later, I found this video, which didn’t just make me feel good, it helped me understand something I’ve always had trouble with: encoding and decoding Unicode strings. The talk is called “Pragmatic Unicode, or How do I stop the pain?” The speaker, Ned Batchelder, is wonderfully clear and succinct.
At about 3:45, while discussing the common situation of a program that suddenly stops working when faced with non-ASCII input, he says
Back when your program was broken, and you were dropping in
decodes at random to try to make the problem go away…
and gets laughs of recognition from the audience. Me, too. I’ve done exactly that way too often. Despite reading various articles about how Python deals with Unicode, I’ve never really understood it the way I did while watching Ned’s talk.
Of course, the proof is in the coding. We’ll see if my new programs handle non-ASCII input better.