Mocha. The stubbing library

This example (shortened here):

class Order
  def shipping_cost
    total_weight * 5 + 10

require 'test/unit'
require 'rubygems'
require 'mocha'

class OrderTest < Test::Unit::TestCase
  # illustrates stubbing instance method
  def test_should_calculate_shipping_cost_based_on_total_weight
    order =
    assert_equal 60, order.shipping_cost

and this snippet (emphasis mine):

The more interesting discussion deals with whether to mock or stub your database-backed model. One upside is speed: This test case will not hit the database at all. Another is independence. I completely isolate the code under test to the controller layer.

convinced me that there just might be some treasure to be found beyond the Test::Unit. And I know that it's just the tip of the iceberg.

Debunking the stupidity myth

From Why can’t we concentrate? by Laura Miller:

IQ tests have to be regularly updated to make them harder; otherwise the average score would have climbed 3 percent per decade since the early 1930s. (The average score is supposed to remain at a constant 100 points.) And IQ measures problem-solving ability, rather than sheer data retained, which has grown even faster over the same interval.

And here I was thinking all these years that we, as a global population, are in fact getting more and more stupid. People getting lower and lower grades, coming out of the Universities knowing less and less – it was all just an illusion. Average IQ is climbing. Steadily. Decade after decade we are getting smarter. It’s only that there are too few measures noticing it. Are IQ tests the only ones measuring it?

(via Brutto)

Moore’s law, 40 years later, still in effect

From the informal version of the Moore’s Law:

Moore’s original statement that transistor counts had doubled every year can be found in his publication “Cramming more components onto integrated circuits”, Electronics Magazine 19 April 1965. Moore slightly altered the formulation of the law over time, bolstering the perceived accuracy of Moore’s Law in retrospect. Most notably, in 1975, Moore altered his projection to a doubling every two years. Despite popular misconception, he is adamant that he did not predict a doubling “every 18 months”. However, an Intel colleague had factored in the increasing performance of transistors to conclude that integrated circuits would double in performance every 18 months.

December 15th, 2007: Seagate Barracuda 7200.11 500GB – 427 PLN

May 11th, 2009: Seagate Barracuda 7200.12 1000GB (1TB) – 419 PLN

Same price, twice the capacity. Roughly 17 months and one financial crisis later and the price per GB is almost exactly two times lower. Incredible.

The case of Benjamin Button and 1080p

From an imdb review:

Pitt plays the character at almost every age, but it’s almost impossible to tell when the CGI is being used on him. You know it’s there, obviously, but you can’t tell it’s being used. When the transition is just smooth enough for the Visual Effects to be retired, but just rough enough to use makeup, it’s absolutely perfect. If you’ve ever wanted to see Brad Pitt look 20 again, look no further, as the effects that make our actors young again (the same goes for Blanchett) are just as stunning as those that make them older.

Thing is with screen big enough and a 1080p source – you can tell the difference between Brad Pitt and CGI. And you can do it quite easily. Both old and young Benjamin look very much CGI alike. And it’s not that the effects are bad, because they’re not, it’s just that at this level of details (and face close-ups) you need to have your effect to be close to perfect. Seems we’re not quite there yet. The skin, the wrinkles, small hair covering the face, freckles, moles, every face feature – those are things you see and appriciate the most when viewing good HD content. And they make the biggest impresion. I know they did on me. They say animating a face is the hardest thing to do. At HD it’s ten times harder.