Today at work in a unit-testing-brown-bag-lunch-session, I spouted off about private methods, claiming that they are stupid. I stand by my statement; private methods are definitely stupid. However, my true feelings are a bit more nuanced.
If we assume we are associating a specific chunk of functionality with every method we write, then there is an overarching hubris associated with declaring a method to be private. When we declare such a method to be private, we predict the future, saying “only I, the privileged creator of this spectacular class will ever need this functionality.”
But, wait, aren’t there legitimate reasons to declare a private method? What if a particular method leaves an object in an inconsistent state, debilitating all subsequent calls to “public” methods? Should this dangerous method be marked private? Perhaps. Leaving aside arguments about the necessity to create such a method, there are other ways around the problem. Convention, not language level constructs solve the issue nicely. Python, for example, uses a leading underscore for “private” methods, and Smalltalk programmers sometimes place these methods in the “private” protocol. And while I am not interested in metaphysical debates about what makes a system “object oriented” (I mean really, I think CLOS is perhaps the best OO system out there), with the examples of Smalltalk and Python, it is clear that private methods are not necessary for OO systems.
The argument that private methods are necessary to “protect” code is even sillier. If we’re afraid of how other programmers might use our classes, then we shouldn’t bother programming. Not only do these fears foster a sense of mistrust among programmers, but also, they are not easily eliminated. In the most straightforward cases, users of our classes with access to the code may go through and mark useful methods public (note that loosening protection introduces no bugs in non-reflective code), or worse, copy and paste this functionality into another method entirely. In more severe cases, the “nefarious” programmer will resort to introspection or disassemblers.
We programmers are tinkerers, and we should be willing to let ourselves tinker. Sleep easy, and declare your methods to be public!
Boingboing reports today on the staggering cost of the bailout(s) thus far. However, it’s easy to get lost in such huge numbers. What’s a million? billion? trillion?
Fortunately the google comes to the rescue and we can quickly figure that the cost is around $13,000 per person (4 trillion divided by 300 million).
What would happen if we just gave that amount of scratch away? What would everyone do with $13,000?
About a year ago I went to see the fine folks at the Loyola Health Center complaining of night time wheezing and shortness of breath when riding bicycles in sub 20 degree temperatures. After the standard pregnancy test, I summited Mt. Nerdom and was prescribed an albuterol inhaler. The ‘health care professional’ warned: “this does not necessarily mean you have asthma.”
In the interim I’ve used the inhaler an average of once a month. However, all usage stopped during my time in Bloomington and quickly picked up after returning to Chicago. Accompanying my most recent difficulty breathing is the standard allergy-based runny nose. I now suspect Alice the Cat (see above) is the source of these problems. In an attempt to alleviate my nasal symptoms I’ve tried the usual claritin but have also resorted to a netipot:
Do not be fooled by the pleasant music. This is the nasal equivalent of water boarding. And though the device does seem to work, the “see also: douche” in the wikipedia article on nasal irrigation is quite revealing.
I fear I must soon return to the doctor to find a more comprehensive solution. Sebastian will not allow me to turn Alice the Cat into Alice the Stirfry, and I am not excited about the prospect of washing her once a week to reduce dander output. With any luck, some pharmaceutical miracle can restore the cat-man balance while producing interesting side effects (I’m rooting for mood-swings and irritability).
Several months ago I explained how I was leaving Chicago to start my phd at Indiana University. That’s what I did. I packed up, headed south, and started with more school. For a variety of reasons, though, I decided to leave my program. I’m back in Chicago permanently and will be starting as a developer at Duo Consulting on November 3rd.
Some, upon hearing this news, treat me as though someone has died, and while this was a sudden decision, it was well thought out and the best for myself and those I love. The last few weeks have been hectic, but I’m really looking forward to my new job and life in Chicago.
I’ve got gears, panniers, a can opener, and, as of today, a hammock. Time to pack up, head out on the bike, and do some stealth camping. We’ll have to see how managing life, etc, goes, but I’d really like to do this soon…like this coming weekend.
(yes the hammock is not properly setup in this photo, but I was at a public park and people were staring at me like I was a crazy…and while I am a crazy, I started to become self conscious and packed up and left after a quick test of the hammock)
I’m enjoying morning courtesy of my friend Keith Folsom (also notice the witty mug my mother gave me). Keith roasted some beans in his popcorn-maker sized roaster and ground them up for me yesterday. The results are fantastic! Watch out Metropolis, the Folsom Coffee Company is coming!
It’s actually quite possible that this site has had more blogging/wiki/cms engines than readers. I’ve decided to move away from the blogger (it’s just…kind of sucky), and start using wordpress (the “track bike” of blogging according to Dan).
So, yeah, I’ve been feeling an unnatural urge to write lately, so hopefully the content will pick up a bit. And I promise to find a wordpress theme that doesn’t grate on the retinas (i.e. I won’t choose the colors).
September Fourth was the two month anniversary of my vegetarian experiment. I’m eating better, in better shape, and I’ve saved money by eating out less (not to mention the great new dishes I’ve learned to cook). All told, the vegetarian experiment has been a great time and very pro-veggie. I’ve really no desire to eat meat, but I am a bit worried about Thanksgiving and Christmas. I think I’ll stay vegetarian for the indefinite future.
I started out on Rockport which is bike heaven and hell. There are some tremendously steep hills, but most are quite short. The flipside is the descents are terrifying. However, the views cannot be beaten. This may be the road that shows up in Breaking Away. It sure seems like it, and it goes by quite a few quarries.
Riding through the country is great. There are many things to see that I’m not used to. First, I saw a bunch of silly cows standing (and some appeared to be squatting) in a muddy little pond. They had curious looks on their faces. Then I saw a huge rooster run across the road. I stopped a bit later to take a breather and noticed a sign that read “God Bless America and Homemade Pies.” mmm….pie.
At one point in the ride I was running short on water, so I stoped at a fire station and they let me fill up my bottles (I figured a fire station has water). The fireman were nice, but gave me strange look when they found out how far I was from home. At my next break, a couple on bikes passed me, and I caught up with them a few miles up the road looking at a map. I stopped to chat and make sure I was going the right direction (I need a map). They had also made a wrong turn, but seemed to a bit more seasoned than I. We parted ways and I stopped one last time at a gas station for some gatorade (I was pretty miserable at this point). A few miles later I was home, writing this incoherent posting. I need a nap.
Update: 2800 feet of elevation change! A bit more, and I’d be ready for the hilly hundred.