The Daily Parker

Politics, Weather, Photography, and the Dog

Small classes (geeky)

Andrew Binstock, editor of Dr. Dobb's, has a pair of editorials in praise of and instruction to create small classes:

High levels of complexity, generally measured with the suboptimal cyclomatic complexity measure (CCR), is what the agile folks correctly term a "code smell." Intricate code doesn't smell right. According to numerous studies, it generally contains a higher number of defects and it's hard — sometimes impossible — to maintain. ...

My question, though, is how to avoid creating complexity in the first place? This topic too has been richly mined by agile trainers, who offer the same basic advice: Follow the Open-Closed principle, obey the Hollywood principle, use the full panoply of design patterns, and so on. All of this is good advice; but ultimately, it doesn't cut it. ...

...[Y]ou need another measure, one which I've found to be extraordinarily effective in reducing initial complexity and greatly expanding testability: class size. Small classes are much easier to understand and to test.

In Part 2, in which Binstock responded to people who had written him about the first editorial:

Coding classes as diminutive as 60 lines struck other correspondents as simply too much of a constraint and not worth the effort.

But it's precisely the discipline that this number of lines imposes that creates the very clarity that's so desirable in the resulting code. The belief expressed in other letters that this discipline could not be consistently maintained suggests that the standard techniques for keeping classes small are not as widely known as I would have expected.

Both editorials make excellent points. Every developer should read them.

At the end of the day, these clichés suck

The UK Independent's Jon Rantoul won't be using clichés any time soon:

Normally, though, politicians are the worst offenders. It is not clear how much they themselves are to blame, or how much they are simply overwhelmed by the substandard drafting of civil servants and speech writers. Perhaps they lack the time to put a pen through it and rewrite it themselves. It is a national scandal that the Civil Service provides such ghastly drafting of official documents, full of turgid abstractions that are intended, perhaps unconsciously, to conceal the thinness of the content. As for speeches, what do politicians pay their speech writers for?

The Prime Minister's speech on NHS reform last week was a shocker for clichés: "pillar to post; in the driving seat; frontline; level playing field; cherry picking; one-size-fits-all; reinvent the wheel; let me be absolutely clear; no ifs or buts". If each of those were not on the List [of banned clichés] before, they are now.

The Daily Parker has adopted the list, effective immediately.

Have I got a photo to sell you

Actually, I'm blegging for information. Has anyone used online photo printing services like ZenFolio, SmugMug, or Shutterfly, either as a photographer selling images or as a customer? Maybe your wedding photographer used a third-party site?

As a corollary, do you or does anyone you know buy stock photos for publication?

No, I'm not quitting my job; but with a backlog of 30,000 photos—some of them already sold as stock, some of them more than once—the wheels in my brain have started to turn. (Maybe it's the MBA.)

How Microsoft finally got SSL right (long, computer-geeky post)

Problem: I have multiple websites on a Windows 2008 server (using IIS7), and I need to enable SSL (i.e., https:// connections) on more than one of them.

Generally, secure websites get their security certificates from trusted providers. Most modern browsers verify that the third-party certificate came from the purported vendor and are attached to the purported website, and give you a nice warm feeling when your address bar turns green. (I have used Comodo most of the time, though because of some experiences helping a local small business renew their certificate recently, I might switch.)

The way SSL works, however, you don't actually need third-party verification to keep the conversation secure. Many servers issue their own SSL certificates, which secure the traffic between the browser and the server regardless of which server or who issued the certificate. In other words, a self-signed SSL certificate will keep the conversation private without guaranteeing that you are talking to the person you think you're talking to. If you can confirm the identity of the server through other means, and then trust the certificate, then you're golden.

Because only I or my subcontractors will ever need to visit these administrative sites within Inner Drive Technology's Worldwide Data Center that I want to secure, self-signed certificates are perfectly appropriate. Under previous versions of IIS, not only did this cause enormous headaches, but also IIS would only support one and only one secure site per server instance. That really sucks if you have, as Inner Drive does, about 30 sites on the same server.

IIS 7 makes this so simple I almost cried with joy.

Step one: Issue a self-signed certificate

In IIS7, go to your server node, and open up the Server Certificates feature:

In the Actions list, click on "Create Self-Signed Certificate..." to bring up the dialog box. Enter a starred domain name for the certificate:

Once you click OK, you've got a self-signed certificate that IIS can find.

Step two: Open the right dialog box

Expand the list of sites in the Connections (left) pane, and click on the site you want to assign. In the Actions (right) pane, click on "Bindings..." This brings up the Bindings dialog box. Now click Add, to bring up the Add Binding dialog box:

Step three: Click OK

Drop the Type box down to "https." Enter the specific host name for the site, and choose your starred certificate:

That's it. Seriously. And anyone who's ever dealt with this configuration crap before will understand my teary-eyed joy.

Possibly inappropriate medium

Generally, I prefer to learn new things by reading first, then doing. I mentioned Wednesday that I've grown dissatisfied with my photography skills, so naturally, I'll go first to Amazon. You know: read about a technique, try it out, post the results online, rinse and repeat.

So it seems somewhat odd to me that most of Amazon's top-rated books on photography—like this one on Photoshop—have Kindle editions that cost almost as much. Because nothing will help someone understand how to do advanced photo editing than 10 cm, 18 dpi halftones, right? Even stranger: the example I just cited has a companion DVD, which I assume does not come with the Kindle version. That, to me, puts the F in WTF.

Great music in Evanston

Girlyman played Evanston SPACE last night:

Coyote Grace is touring with Girlyman this year; I'll be looking for them again. Also, surprise musical guest The Shadowboxers, who graduated from college Wednesday, led the show with a 4-song set. Again, another band I need to follow.

I'll have more photos next week. Tomorrow I'm off to Duke for our graduation ceremony. The school awarded our degrees in January (retroactive to December 30th), but I still want to walk—and see my classmates. Only, with work, a 7am flight to RDU, and everything going on this weekend, I don't expect to have time to organize last night's photos for a few days.

I will say this: even with the 7D's amazing low-light abilities, shooting a concert is hard. I experimented with a dozen or so combinations of ISO, aperture, and shutter, and I quickly put away my 18-55mm zoom in favor of a 50mm f/1.8 prime lens. The shot above was ISO-3200, 1/125 at f/1.8. I tried slower shutters with tighter apertures but the band were so energetic that led to lots of subject movement. Lower ISOs gave me less grainy photos, but again, required slower shutter speeds, so they weren't quite up to my standards. And black & white, which ordinarily covers many sins in variable-light environments, didn't look right, because the lighting makes up part of a live performance's appeal.

I also shot about 18 minutes of video (which looks OK, actually), making my total haul for the evening a whopping 12 GB. I don't think I can post any video, though. (Pesky copyright laws.) If I find out from the band it's all right to do so, I'll put some up.

Senior Software...Gardener?

Apparently "gardener" makes more sense than "engineer:"

So why do so many gardens fail, yet so many skyscrapers succeed? With a few exceptions, the technique for building a skyscraper is similar whether you are in Europe or you are in Singapore. Gardens do not work that way. Every garden is different because the environment it is in is different. Even gardens that are within throwing distance of each other can have wildly different soil. That is why the lowest bidder can probably build the same bridge as the highest bidder, but your company can’t grow the calibre of gardens that Google can grow.

Remember that time when someone in your company unsuccessfully used an Agile gardening methodology, and then went around saying that it was horse shit that doesn’t work? Well horse shit does grow gardens, it just wasn’t enough to save your garden. Your garden was probably dead before it started – a victim of the climate of your organisation. Were you trying to grow a rainforest in the desert? You can’t just plant the same plants as Facebook, Flickr or Twitter and expect them to take root regardless of the quality of your gardeners or the climate of your organisation.

(Hat tip MVT.)

Don't know nothin' about me

Via one of my cow-orkers, a company that can tell you all about yourself at a hitherto-impossible level of detail. All you have to do is spit:

23andMe is a retail DNA testing service providing information and tools for consumers to learn about and explore their DNA. We utilize the Illumina OmniExpress Plus Research Use Only Chip which has been customized for use in all of our products and services by 23andMe. All of the laboratory testing for 23andMe is done in a CLIA-certified laboratory.

How does 23andMe genotype my DNA?

Once the lab receives your sample, DNA is extracted from cheek cells in your saliva. Your DNA is then copied many times so that there is enough DNA to use for the genotyping step. Next, the DNA is cut into smaller, more manageable pieces. These DNA pieces are then applied to a DNA "chip." The DNA chip is a small glass slide with millions of microscopic beads on its surface. Attached to each bead are "probes"—bits of DNA complementary to sites in your genome where SNPs are located. There is a pair of probes for each SNP, corresponding to the two versions of each SNP. Because two complementary pieces of DNA stick together, your DNA sticks to whichever probes match your versions of a SNP.

The service claims to do the following:

  • Identify health risks based on genetic propensity (and quantify how much of the risk is genetic);
  • Tell you where your family came from, and when they got there, going back several thousand years;
  • Find your long-lost cousins; and
  • Send you updates as new research comes in.

My colleague paired this suggested site with this TED talk about the future of human evolution.

Remember when Gattaca was just an interesting fiction? Let's hope not all of Andrew Niccol's predictions come true...