HTTP wrappers with ease
httparty looks really cool. It’s a little library for making writing tiny REST clients easier. From the examples (edited for length):
class Twitter include HTTParty base_uri 'twitter.com' def initialize(user, pass) self.class.basic_auth user, pass end # which can be :friends, :user or :public # options[:query] can be things like since, since_id, count, etc. def timeline(which=:friends, options={}) self.class.get("/statuses/#{which}_timeline.xml", options)['statuses'].map { |s| s.to_struct } end end twitter = Twitter.new('bob@example.com', 'bobtime') twitter.timeline.each do |s| puts s.user.name, s.text, "#{s.created_at} #{s.id}", '' end
Great job, John!
Agility course made of people
Wow.
Community anti-patterns
You’ll have to pardon me for linking to Ted Leung twice in short order, but the man is good peoples. This time I’d like to draw your attention to his presentation from OSCON on Open Source Community Antipatterns.
Ted’s talk is full of great observations from his time at OSAF and his ongoing work with the Apache project. Keep in mind that the presentation is on anti-patterns, so most of the slides describe what you don’t want to do.
Not your father's IDE
IDE’s and Dynamic Languages. Ted Leung’s got some useful and insightful things to say about dynamic languages, history, IDEs and the people who use them. While I still think many of the features in a modern IDE are crutches, I hope that what Ted is alluding to becomes a reality.
Golf fail
My golf game is hurting these days. Since I’ve become so familiar with my shots drifting off to the right, I figured I’d finally figure out the correct term for these sorts of shots. Thusly, an illustration to teach myself:

Handsome penance, isn’t it?
Failings of the expert's mind
Why Analytical Applications Fail. Ostensibly, this article is about analytics applications that expect users to know exactly what they want before they start. But to me, the underlying story is of developers who get caught up in their domain and build an application for themselves instead of for their users.
We’ve all fallen into this trap. Whenever a new person joins my team, I always try not to squander their beginner’s mind. Fresh team members can often point out places where the interaction design or domain model need to soften up for those who haven’t lived in the project for months. That said, it requires patience and humility on the part of the existing team.
Practical language kleptomania
Introducing Functor - another library for implementing multiple dispatch/pattern matching in Ruby. This is a great example of what I talked about at OSCON: stealing ideas and applying them to your daily work. I’m particularly impressed with how Dan has applied it to something that isn’t a recursive mathematical function - check out the example of using in a view class.
git.repo.revs.each(...)
Git Iterator - a neat little gizmo for running code against every revision in your Git repository. Yielded this chart showing the growth of the Rails code.
What Has Ruby Done For You Lately?
When I go to speak about Ruby at non-Ruby groups, my go-to schtick is only mildly subversive. Sure, I tell them that Ruby is a fantastic language that will make them a better programmer. But, I don’t expect them to switch to Ruby right away. Instead, I lead them down the path of borrowing ideas from Ruby and using them in their day-to-day coding, no matter what language they use.
This week at OSCON 2008, I applied the same tact, but I did it on Ruby programmers. See, there are tons of great ideas in languages like Haskell, Io and Erlang. Some translate really well to Ruby and some don’t. But they’ll all twist your brain around in interesting ways.
That’s the idea. Here are the goods: just the slides, the code and the slides. Enjoy!
More modules, please
Jay Fields' Thoughts: Ruby: Underuse of Modules. Modules are your best friend, ya’ll. Use ‘em.
Congestion and decongestion
Two really awesome maps: National Traffic Scorecard and undersea internet cables (via Coudal).
You say simple, I say simple
The Simplest Thing That Could Possibly Work:
At first the developer said "this is where we're going to disagree on the simplest thing that could possibly work." He argued that we were backing ourselves into a corner by not following the pattern; therefore, what I was suggesting couldn't possibly work. I took a few moments to consider his point of view. I concluded that he might be right, but deleting 60% of the code we were currently working with meant that the remaining 40% was so small that if we did need to rewrite in the future it would actually be easier than the amount of effort required to maintain the prematurely put in place architecture.
Jay Fields is Sage.
Three new rules on golf
Yesterday I decided to go off and play a little golf. Somehow, I had the most awesomest round of golf in my life. Luckily, Courtney came along and was there to document part of this now-legendary round of golf:
Really, I promise I’m not that guy who drags his wife to the golf course every weekend. But I might turn into that guy because today I played without her, like a mere mortal. Or maybe it was that I opted to walk 18 holes in the heat.
So now I have three new golf rules:
- No more walking 18 holes in June, July or August
- That’s no drainage ditch, its a sewage ditch
- Stop thinking
So there you go. My semi-annual post about golf!
Why is oil so damn expensive?
Great article in The Economist on oil prices and what’s causing their painful rise. Double, double, oil and trouble | Economist.com:
In the short run, neither demand for nor supply of oil is very elastic. It takes time for people to replace their old guzzlers with more fuel-efficient cars, or to switch to jobs with shorter commutes, or to move closer to public transport. By the same token, it can take ten years or more to develop an oilfield after its discovery—and that does not include the time firms need to bolster their exploration units.
In short, nothing related to oil consumption changes quickly. It takes a decade for consumers to fully adjust to prices and the same amount of time for producers to field new technology and start mining new discoveries.
In the mean time, this little scooter is looking better and better!
The Joy of Science
Put a Little Science in Your Life:
Science is a way of life. Science is a perspective. Science is the process that takes us from confusion to understanding in a manner that’s precise, predictive and reliable — a transformation, for those lucky enough to experience it, that is empowering and emotional. To be able to think through and grasp explanations…
Since my run in with Bachelor of Science-grade Physics, I’ve considered myself someone who sucks at science. However, I suppose by Brian Greene’s definition, I am a consummate scientist. I really enjoy diving into a deep subject (economics, linguistics, etc.) and trying to figure out what makes it tick. Its a fun way to go about life.
At the root of this pedagogical approach is a firm belief in the vertical nature of science: you must master A before moving on to B. When A happened a few hundred years ago, it’s a long climb to the modern era. Certainly, when it comes to teaching the technicalities — solving this equation, balancing that reaction, grasping the discrete parts of the cell — the verticality of science is unassailable.
A hearty "Amen!" here. So many topics seem intimidating to the neophyte. "You can’t do this until you’ve learned this, that and the other." Stacked knowledge as barrier to entry is a total bummer.
I think something immersive is more rewarding. They say the best way to learn a foreign language is to surround yourself in it. I think this is true of any endeavor that, at some level, rewires your brain.
Yurii Rashkovskii's Blog: Top 10 Reasons to Avoid Document Databases FUD
Yurii Rashkovskii’s Blog: Top 10 Reasons to Avoid Document Databases FUD:
And… you said “relational”? Facebook and others do a lot of denormalization, they don’t ever use JOIN, they’d rather do several consequent requests and build intermediate results on a webserver (when you have 20 times more webservers than DBs it’s obviously good to move some load there). They treat good old MySQL as object storage with very fast B+ tree indexes. Finally, the resulting database is not a relational one. One thousand of MySQLs is just a distributed object storage with simple fast indexes and a bunch of hand-written code in php/ruby/python/whatever around it.
I’ve come upon this sort of idea several time recently (and the above was written a couple months ago). I’m warming up to the idea. Without piles of cash and able systems-type folks, scaling databases out is a really nasty problem. Even then, my reading is there are definite bounds for how far you can go.
Assembling datasets on the more easily scaled app server is appealing. It sounds fun (hey, real programming!) and is interesting to think about. But I wonder if it leads to having to figure out consistency in your application. From where I sit, its the hardest part of ACID to reason with.
Microsoft's spin on memcached
Microsoft cargo cults memcached! , via Simon Willison.
Back when I worked in a semi-.NET shop, we needed to cache some pretty expensive operations somewhere. In memory would have been ideal, but we had no way to coordinate between application servers. It ended up going in the database, because that made everyone feel safe. In hindsight, it probably wasn’t the greatest idea.
Long story short, my internal clock that tells me how long it will take Microsoft to clone a forehead-slappingly-obvious-idea is well set.
Fake Rails environment
For testing some bits inside of ActiveRecord proper.
module Rails def self.env o = Class.new do def production? true end end o.new end end
Evil and fun. Uses Class.new
, my favorite Ruby method.
Muahahaha.