Friday, February 27, 2009

Idea: defining functions within functions

Are there any programming languages where you can define functions within other functions? I think it'd be useful - in situations like this:

function X is used, and only used, within function A. X is really just a part of A that has been broken away to better structure the code.

function A()
function X()
blah blah

blah blah
blah blah
If you defined X within A -- like at the start or end of it -- this would make the structure of the code more explicit. When you came across X you'd know straight away, and for certain, that A was the only place it was used.

The motivation for this is pretty similar to that of defining functions within objects or within modules.

Wednesday, February 25, 2009

On having lots of choices

A post on Signal vs Noise quotes Eknath Easwaran's Take Your Time—Finding Balance in a Hurried World (chapter 5):

People are subject to trifling likes and dislikes every day. There seems to be no end to the division and subdivision of taste. In India, in those days, if I wanted ice cream after a meal, I simply ordered ice cream. At most there might have been two or three flavors; often there was only one. Today I have one hundred and forty-seven varieties to choose from, and it’s not enough to want chocolate; I have to decide between possibilities like Dutch, Bittersweet, Super Fudge Wonder, and Chewy White Chocolate Macadamia. (Often I just tell the clerk, “Give me the one you like best.”) And for coffee I have to specify French Roast, Colombian, Kona, or one of a dozen other varieties. I know people whose whole day is affected when they can’t get the coffee they like, made just the way they like it. As our preferences get fractioned finer and finer like this, the range of what we can tolerate narrows to a slit—in everything, because this is a habit of the mind.
To which I added a comment
I think that’s a bit muddled.

It makes the reasonable point that you don’t always want to be presented with a bazillion choices, especially where there’s only small differences between them.

But it comes across a complaint about choice, as if it was all bad. Lots of choices is, itself, not a problem. It’s when you’re forced to deal with them at once.

Would you prefer to live in a city where there’s only three different meals you can ever have for dinner, or would you prefer to live in a city where there’s a large variety of different ethnic cuisines available?

The quote also suggests that having fine-grained preferences - wanting White Chocolate Macadamia - means inflexibility: only being satisfied by that. “As our preferences get fractioned finer and finer like this, the range of what we can tolerate narrows to a slit”.

But that’s not necessarily so. At particular times, at particular places, in particular moods, I might feel like that flavor, and at other times and places, I might want something else. We get bored and want to try new things.

And if you’ve only got a few options available, isn’t it easy to develop prejudices? We probably all know people who grew up eating one type of food and won’t dare touch food of an unfamiliar cuisine.

If you’re beyond a certain age, you’ve probably gone from growing up in a world with fewer choices to a world with many more choices. Perhaps this means we didn’t develop very good skills for handling choice. Perhaps the kids of today will manage much better? I don’t know, but this possibility seems to get overlooked.

Sunday, February 08, 2009

The Immobolised Pefectionist and the Persistent Perfectionist

Perfectionists are often portrayed as overly finicky people who can't produce anything if it isn't perfect, who thus can't get started and never get anywhere. We can call these people immobilised perfectionists.

But I think there's another meaning for 'perfectionist' that tends to get overlooked. This is the persistent perfectionist, who has really high standards - and is persistent in trying to meet them.

They appreciate that perfection is not immediate and that they won't be particularly good initially. They appreciate that it'll take a lot of practise to get really good. Because they're persistent, they won't stop trying trying to improve until they’ve met their really high standards.

Here's an example of an (otherwise good) post that treats 'perfectionism' as if it could only mean immobilised perfectionism.

Saturday, February 07, 2009

Another e.g. of seeing software only in functional terms: the claim that choice of impl language doesn't matter

I've written that IT people have a tendency to look at software only in functional terms: 1, 2 and 3.

Recently I came across a post about this (but not described in these terms) The "Any Competent Programmer" BS

In it, the author comments on the claim that "A professional team can develop quality software whatever the chosen implementation language and toolset."

He says

The claim, though, begs the question of how much it costs, in time and money, to develop that quality software using a chosen language and toolset. And whether a different choice could lead to quality software being developed faster and more cheaply, thereby encouraging the creation of even more quality software.
And he also points out that that claim is analogous to the "Any competent programmer can write good code in any language" trope.