I’m in the middle of another round of “Source Code Style Guidelines”, with my co-workers. We know what this means, “Rule One: No Edged Weapons”.
Most of my education has been aimed at science and engineering. Nevertheless, I’ve come to the conclusion that most technically trained people, and especially math majors, are not cut out for programming. This does not mean that their programs don’t work, or aren’t elegant. The problem is more subtle, they simply haven’t the communications skills for it. Program source has few readers, but most programmers assume that their entire audience is the compiler, that piece of software able to parse a programming language, translating program files to machine instructions, a long series of numbers and data which can be executed directly by the computer. At a minimum, most computer programs have these audiences:
It’s easy and great fun to join in the religious source wars, arguing about angels and pinheads. It’s much harder to remember your readers and actually write for them. With so few reading your code, it is all the more important that every element of style should address these readers, no rule should exist which does not serve them.
The mechanics of programming, of writing source parsable by the compiler can be easily embraced by anyone with a logical mind. Writing for human audiences is a much tougher proposition. Writing for humans is so hard to do well that good writers are much rarer than good mathematicians.
Vigorous writing is concise. A sentence should contain no unnecessary words, a paragraph no unnecessary sentences, for the same reason that a drawing should have no unnecessary lines and a machine no unnecessary parts. This requires not that the writer make all sentences short or avoid all detail and treat subjects only in outline, but that every word tell.
Make the paragraph the unit of composition: one paragraph to each topic
As a rule, begin each paragraph with a topic sentence; end it in conformity with the beginning
Use the active voice
Put statements in positive form
Omit needless words
Avoid a succession of loose sentences
Express co-ordinate ideas in similar form
Keep related words together
In summaries, keep to one tense
Place the emphatic words of a sentence at the end
Oliver Strunk, The Elements of Style 1918
E.B White, adding to the 1935 edition of Strunk’s little book, appended these simple prescriptives:
1. Place yourself in the background.
2. Write in a way that comes naturally.
3. Work from a suitable design.
4. Write with nouns and verbs.
5. Revise and rewrite.
6. Do not overwrite.
7. Do not overstate.
8. Avoid the use of qualifiers.
9. Do not affect a breezy manner.
10. Use orthodox spelling.
11. Do not explain too much.
12. Do not construct awkward adverbs.
13. Make sure the reader knows who is speaking.
14. Avoid fancy words.
15. Do not use dialect unless your ear is good.
16. Be clear.
17. Do not inject opinion.
18. Use figures of speech sparingly.
19. Do not take shortcuts at the cost of clarity.
20. Avoid foreign languages.
21. Prefer the standard to the offbeat.
E.B White, The Elements of Style, 1935
It’s no coincidence that these edicts map almost perfectly to common coding guidelines, “The Elements of Style” has been heavily quoted, sometimes to the point of parody, by hundreds of books on programming. Published in 1974, Kernighan and Plauger’s The Elements of Programming Style might have been the first. While its examples were written in Fortran and PL/1, this seminal book laid out most of the precepts followed to this day. Here’s a few that might seem especially familiar:
“Make your programs read from top to bottom”
“Take care to branch the right way on equality”
“Test input for validity and plausibility”
“Don’t patch bad code – rewrite it”
“Don’t stop with your first draft”
“Modularize. Use subroutines.”
“Each module should do one thing well.”
“Make sure code and comments agree.”
“Don’t over-comment.”
Kernighan and Plauger, The Elements of Programming Style
Kernighan and Plauger did not spend a lot of time on minutia, they were far more concerned with clarity of intent than with placement of braces. Interestingly, in some camps, The Bell Labs C and Unix developers, Thompson, Ritchie, Kernighan and Plauger (Plauger didn’t actually work for Bell) and their many fans, have been accused of ”excessive literacy” It’s hard to say whether this is a swipe from the Mac/Windows point-and-poke crowd, or a swipe at the astonishing illiteracy of so many american engineers (Redmond leaps to mind here.)
For all that the Bell Labs crowd has been accused of excess purity, of being too ”academic”, of style over substance, it’s obvious in retrospect that this was a very pragmatic group of people. They developed solutions that were just good enough, ”The Jersey Approach”, in stark contrast to the ivory tower efforts at MIT, ”The Right Thing”, Which took so long to get right, and then deliver, that the computer science world had gone on without them.
The most important rule cannot be expressed as an element of style, it is “Write literature, write with passion, write to your audience, make your ideas come alive in their minds.” Sadly, this can barely be taught, hardly be learned, and is mostly lost in the rush to publish. And sometimes of course, it’s just hard to be passionate about folding in driver support for the Acme 2100 auto-binding color network printer/copier/scanner, with optional postage meter. Yet such is our lot, so we must gird our loins, and carry our flimsy weapons into battle against the ravening machine.
* * *
Another technology news article has surfaced at Forbes which turns out to be neither news nor technology. Brian Caulfield writes:
Deaf Leopard
...A true Apple fanatic will tell you that everything your Windows machine can do, Apple did first or does better. The worst part: The fanatic is often right….Microsoft is building speech recognition…Ford’s new Sync system, built with help from Microsoft, gives drivers the ability to control their electronics and even dictate text messages from the driver’s seat. It is part of an effort by Microsoft to extend its software far beyond the desktop…..So remember …[OS X]....looks great, and most reviewers are saying its home networking and backup capabilities are a step up from Vista. But have you driven a Mac, lately?
I recommend reading the whole piece over at Forbes, it’ll only take a few seconds…Back already? lotta news packed in that little story hmmm…
Time for a little deconstruction: The news in the story is that an american car builder is adding speech reco to some models.
The news that’s NOT in the story:
And who have these bright stars teamed up with?
So we’ve an article in Forbes that’s actually about a failing car builder trying to spruce up its image by buying embedded technology from a company with a long history of failure in the mobile and embedded marketplaces….
...Which somehow becomes, “Look, Apple is mostly better at everything, but Microsoft sold Ford this nice speech recognition that works...kinda…
Where does this stuff come from? How does this pass for journalism? Can the Forbes readers, supposed captains of industry, be so dim that they miss the actual story while chuckling over the dig at Apple?
* * *
Ashoney was healthy until late this week, when it became apparent that she was having coordination problems and a lot of pain. The pain meds the vet prescribed didn’t help her, she wasn’t eating or drinking, had only partial use of her back legs, and had barely strength to deliver her signature cry. This morning Nae and I, weeping and blubbering, agreed we couldn’t subject her to any more misery, said goodbye, and gave the vet the nod. Her final rest is with a few old friends under our avocado tree.
We’ll miss her, a lot, she was a fine feline friend to us for almost 20 years.
P.S. Ashoney means smoke in Hebrew.
* * *
The Fake Steve Jobs blog (FSJ) has been getting some attention lately, from mac, PC, and linux fanbois, the press, and especially from Forbes magazine, which gleefully quotes it.
And the blog is pretty funny, though sometimes I think I’m seeing it exactly backwards from its intent. I mostly think it’s an effort to lampoon Jobs, Apple, and their fans, but it seems to miss that mark pretty regularly. Or maybe the writer is really poking at the whole industry. In this story his target certainly isn’t Jobs. This may be a wonderful example of that strange way bias shapes perception
When the Apple detractors read it, they see Jobs, the pompous arrogant SOB, who should die and be hauled under Microsoft’s keel, for having the audacity to compete with Windows and the Zune and for strong-arming the poor abused music industry. The guy just blabs on about how smart he is, stupid others are, how nobody appreciates him, but f—k ‘em anyway…
But when Apple fans read it, they see Jobs, the pompous arrogant SOB, who’s vision seems to drill right to the core of consumer desire and design integrity, who sets incredibly high standards for himself and those around him, who sheds great ideas the way Gates sheds dandruff, who has no patience for fools….
Especially funny in the first post linked above, is the apparent assumption that readers might have sympathy for Doug Morris. As the head of Universal Music, he’s a bully famous for rabid abuse of mothers, and an ardent RIAA and DMCA supporter. Depicting him as a victim to Job’s arrogant manipulation of the music industry is laugh-out-loud funny.
The more you poke at this blog the weirder it gets, FSJ is Daniel Lyons, a Forbes columnist, and infamous corporate shill. He’s known for bilious rants against Linux and the GPL, for laughable fact (non) checking, and for inventing news and trends. Reading his Forbes columns alongside the FSJ blog you have to wonder if he has any actual opinions, if he’s on the Microsoft payroll, or the Apple payroll, or if his masters at Forbes have a clue that one of their lapdogs is losing his mind and trashing their advertisers. And yet, even when he’s writing lies and propaganda he’s funny, and manages to slip in a little truth. There’s interesting background on Lyons here, and here.
* * *
One of the most hotly contested sections of the “Digital Millennium Copyright Act (DMCA)” is the criminalization of any circumvention of Digital Rights Management (DRM) features, even when there is no infringement of copyright itself. So even if you’ve not violated copyright, any act that might interfere with some hokey copy protection scheme, e.g. Sony’s rootkit, would constitute a crime.
I’m currently involved in the design and implementation of system software (e.g. device drivers) for Vista and Longhorn. (Needless to say I’ve not had time for awhile (a long while) to write about furniture and interiors.) Hardware and system software vendors have to go through a tedious and annoying process of ‘signing’ their drivers, essentially getting M’soft approval for their stuff. Microsoft would have you believe that these signed drivers exist to protect users from viruses and trojan horses. Nothing could be further from the truth, almost all the new security features in Vista exist to enforce draconian censorship of any content that might (emphasize MIGHT) be pirated. Vista contains a great deal of code whose only purpose in life is to evaluate the possibility that you’re doing something evil with your computer and attempt to circumvent you. (Evil is defined as anything Microsoft, the MPAA, or the RIAA don’t care for, and includes doing things like playing your newly purchased HD movie on your hi-res computer display.)
Many aftermarket software products deliver applications and digital content from servers running Longhorn and Win2003. In order to do this, the developers must write ‘virtual drivers’ to span the connections between computers. In other words, they must hook the MS-windows ‘media chain’, adding the capability to re-vector content to a remote computer. Guess what? The DMCA probably makes doing this illegal. Once again, honest people trying to do perfectly acceptable “fair use” viewing of their own content will be seen as criminals, and probably denied access to the content they’ve purchased.
* * *
I’m too tired to chase down the quotations tonight. But it’s interesting that most would agree that O’Reilly was at best condescending, while Edwards ‘spoke truth’ with best intentions, even if he exaggerated.
The important thing to remember is that when looking at prisons, death rates, and disenfranchised populations, economic disparity is a better indicator than race.
Try this soundbite instead: “Lyndon Johnson’s ‘War on Poverty’, after 40 years, is finally getting some traction. We’ve got 10% of the poor incarcerated and more prisons are opening every day.”
* * *
Reading propaganda like this might lead us to believe that the disparity is not so huge. But what you should read between the lines is the horrifying fact that 80 or 90% of americans are in serious financial straits. From their own ‘corrected’ figures, the Heritage Foundation reports that 80% of american households have incomes below $80,000. That seems like a fortune to most americans, but it’s barely enough to pay rent and buy groceries in New York City or San Francisco. In my ‘middle class’ town, the mortgage, our health, home, and car insurance, and property tax slurps up about $52,000 a year, and I’m cheap to the bone. Most of my neighbors are in for $60,000 or more, before they step out the door for groceries.
From David Cay of the NY Times, we learn that the minimum income for the top 1%, about 3,000,000 americans, is only $348,000. This means the bottom 19% of the top 20%, about one fifth of america’s population, makes somewhere between $80,000 and $348,000. That’s a range between ‘mostly comfortable’ and ‘almost wealthy’, but it’s chump change for the jet set. (And it’s not what investment bankers make either, their average income is $435,000. But that’s another story.)
Carefully overlooked by the Heritage Foundation’s logic is the astonishing fact that about 3,000,000 americans, the top 1% of earners, have a combined income equal to the bottom 50% of earners, about 150,000,000 citizens.
Let’s say that again, 1% of americans, rake in about 1.5 trillion dollars, which is as much money as half the population, 150 million people, make combined. These very round numbers are right from the Heritage Foundation calculations and 2005 income statistics.
Those numbers are so incredible, I have to take one more poke at them. 1.5 trillion is 1.5 times 10 to the 12th, that is, $1,500,000,000,000. So, In the US, 3,000,000 people earn about 5 million each. At the other end, 150,000,000 Americans, half the population, earn about $10,000 each. Their combined totals are equal.
Since Health and Human Services sets the 2006 poverty threshold at $10,210 for an individual, does that mean that a quarter of our citizens are on or below the threshold of poverty? Not quite, since a household of two has a poverty threshold of only $13,690. For example, a two earner household, with each earning $7,000, would be above that poverty line.
2007-10-18: Since I wrote this I’ve realized that looking at the richest 30,000 people (0.01%) in the country better illustrates the issue. Paul Krugman, in 2006 wrote
...More broadly, right-wing commentators would like you to believe that the economy’s winners are a large group, like college graduates or people with agreeable personalities. But the winners’ circle is actually very small. Even households at the 95th percentile — that is, households richer than 19 out of 20 Americans — have seen their real income rise less than 1 percent a year since the late 1970’s. But the income of the richest 1 percent has roughly doubled, and the income of the top 0.01 percent — people with incomes of more than $5 million in 2004 — has risen by a factor of 5.
* * *
A few weeks ago, before the systematic failure of rescue and recovery efforts became evident, I was puzzling over human foolishness in the face of the incredible forces of nature. Shortly thereafter, the Katrina story became one of racism, cronyism, corruption, classism, and incredible bungling at every level of government. The media became part of the problems, even as they were exposing other problems. Innuendo, unsubstantiated rumors, and outright lies were reported and repeated, without witnesses, without facts, without confirmation. Invariably these lies and rumors depicted the poor and desperate of Louisiana and Mississippi as violent degenerates. For days, the media accepted the party line of the administration, until even the most jaded reporters were choking with outrage over the constant bungling, denial and spin, needless deaths and misery, and blatant racism and classism.
Another horrifying aspect of this was the classism evident in so much of America’s surly response to the misery of Katrina’s victims. It’s become wildly obvious that most americans only have sympathy for the impoverished of other countries. The poor lived in New Orleans because there was at least some work there, even if it was mostly feeding and entertaining the tourists who came for that genuine gumbo. Louisiana and Mississippi have a level of systemic poverty which has nothing to do with welfare mothers or lazy bums. There’s little work, lousy wages, lousy schools, corrupt government and law enforcement, bad health care, toxic waste, and rampant racism to blame. How easy it has been for our bigots to forget that the poor lived in the lowest parts of New Orleans because the wealthy lived in the highest parts. The least among us, those without cars to drive to safety, or cash to buy food and fuel, or credit cards to buy bus rides out of town, those turned back by armed men as they sought refuge on the high ground of white suburbs, are seen as scum by so many in this country. How shameful that every black carrying a burden was a ‘looter’, while whites were ‘scavengers’, in media representations.
Having seen the bile spewing from my countrymen about self-sufficiency and individual responsibility, I want to make it clear that I am not in that camp of bigots. My question, “Is there blame?”, pointed to the “enabling behavior” of governments that issue building permits in swamps, that strip the funding allocated for levee and pump maintenance, that recommend evacuations without considering those unable to escape unless transported, that steal the funds allocated for emergency measures, that strip FEMA, then pack it with incompetent cronies. I thought of insurance companies that use the premiums of those who live in sturdy little homes far from the storm surge to pay the claims of the McMansion owners whose multimillion dollar beach homes should never have been built. I thought about the corruption and cronyism that sent millions of dollars of FEMA money to heavily republican Dade county after Frances came through florida, passing three counties to the north, more than 100 miles. The communities hit hardest by several hurricanes that year, democratic St Lucie and Indian River counties, where billions of dollars in damage was done, each received less FEMA assistance than Dade county, which didn’t even experience tropical storm forces.
I spoke then of the wisdom of building on barrier islands, hardly knowing that an object lesson was waiting in the wings. We can only hope that the folks crawling north on the roads from Galveston will not be trapped in their cars as Rita floods the land around them or flings their gas starved SUVs off the roads.
Will Rita teach the lesson that we didn’t learn from Katrina, to plan our settlements a little better? Will the citizens say “no more” to subsidizing wealthy fools who build on shifting sands? Most of all, will these disasters finally show us how hollow the promises of “Homeland Security” are?
* * *
I live in South Florida, on high(ish) ground. Katrina came past and gave my neighborhood a little slap, on her way out to the warm gulf waters, where she organized into a cat 5 hurricane. Now 1.5 million people are homeless, jobless, and in shock, just from New Orleans alone. There’s no guessing how many will be dead when all is accounted for.
Entrepreneurs and businesses have always gone where the resources are. Regular folks follow behind because that’s where the jobs are. Government comes along and surrounds a swamp with levees, and calls it a city.
And of course the Army Corps of Engineers comes along and turns 2000 miles of winding bottomland river into a 1000 mile ditch, contained (theoretically) by 14 meter levees. Homes, factories, and farms fill the bottomland right up to the levies.
In a free society, you can’t prevent people from trying to turn a swamp into a suburb, unless you buy the land and turn it into park or preserve. Ever since agriculture started on the Nile, we’ve known that flood plains are great places to grow crops, so you don’t really want to take them out of production. Of course if you dam off the river, the plain is no longer renewed, topsoil leaches away, and the land starts to sink even lower. Then there are lots of places in this country where the ONLY justification for building homes is gorgeous location, like Miami Beach and all the other sandbars on our Atlantic coast, or the muddy, fire prone hills above Los Angeles.
People have to find work, they have to live where they work. New Orleans grew where it did because it was a handy place for a port that served the Mississippi, there was rich fishing in the gulf, it was marginally drier than much of the wetland around it.
But, like Venice, it’s been sinking since it was built, and just like the proverbial frog in a slowly heating kettle, few have ever decided it was time to get out.
But you can’t expect to live below sea level next to a sea, or on a flood plain, or a sand bar, or a muddy hillside, or a dry pine forest, and be safe. Should governments issue building permits in swamps? Should insurance companies write fire policies on wooden houses in pine forests? Flood policies on swamps and flood plains? Should governments try to control mighty rivers from headwaters to delta, destroying wetlands and the buffering swamp? Should governments dredge millions of tons of sand back onto the beaches of Miami every time a hurricane scours them out? Do citizens have a right to settle in the path of disaster? Does government have an obligation to make extraordinary efforts to prevent that disaster?
Whether we ever get New Orleans dry again, or not, perhaps it should be condemned as unfit for human habitation. Made partly into a memorial (To stubborn denial in the face of the obvious?) and the rest back to wetland. We certainly need the wetlands, and I’d bet that if the Mississippi was allowed to set her own course, in only a decade or two the entire bowl of New Orleans would become fine breeding grounds, once again filling the gulf with life.
I’m not sure I even know my own position on all this, but I’ve lived in the path of hurricanes for many years. I can’t help but stroll the beaches of our barrier islands, looking at houses and condos, built on SAND BARS, and ask, “Are these people nuts? How can they live here and expect sympathy and support when a storm sweeps the land right out from under them? What lunatic zoning board said it was alright to sell condos on sand bars?” The buildings do sit on pilings driven a dozen meters or more into our very soft bedrock, but that only means they might not wash away immediately, instead perching on stilts in the Atlantic ocean, when the storm moves the barrier island out from under them. And it will, sooner or later.
* * *
This week, Apple announced that it would start using CPUs provided by Intel for some Macs to be shipped within a year or two. And the Mac community has launched into a religous war, up in arms that Steve Jobs would sleep with the enemy.
I can’t believe the level of horror and consternation over an obvious financial and political maneuver. Who cares what’s in our Macs, we bought them because Apple delivers the best Integrated hardware/software platform.
What makes Macs better?
Industrial strength, twenty year old bulletproof BSD unix core.
Attractive, usable GUI
Incredibly capable integration of OS and GUI
Great industrial design
Great APIs and developer’s tools
None of this will change when Apple switches CPU vendors.
Furthermore, we don’t have to ride the “newer/faster/better, gotta have it” train. Lots of us ride the “ain’t broken, don’t fix it”, bus, using ancient tools, just ‘cause they work. In lots of ways, all the *nix, crowd, including lots of us using OSX, are part of that, We use *nix because it’s been the best OS for small computers for 25 years.
How convenient that Apple delivers a complete, robust unix, with enhanced, GUI, good documentation, great drivers, and access to much of the source code, in gorgeous, cheap hardware.
I’ve often cursed IBM, Microsoft and Intel, for accidentally locking an entire industry into the laughable constraints of the 8086, with its awful instruction set, infuriating segmented addressing and (later) power hungry designs. But Intel has been both perpetrator and victim in the PC’s success, forced to support an architecture that was seen as quaint even in 1981, when the first PC was shipped with an 8088.
But Intel has shown themselves to be consummate chip designers, and obviously, Jobs saw enough in their future plans to make a feint, or perhaps even a real commitment, toward their hardware.
Bear in mind that the PC silicon marketplace is so fragmented, with Intel, AMD, and TransMeta selling, and hundreds of box and board makers buying, that Apple will be a big fish in that pond, becoming one of Intel’s biggest customers almost overnight.
Strangely enough, the PowerPC has been so successful in embedded and industrial applications that Apple only accounts for 2% of IBM’s PowerPC sales. IBM doesn’t seem to care about Apple’s business. And Motorola seems doomed to abuse their customers and destroy their markets, apparently incapable of delivering the superior engineering that always seems to get lost in the chaos of their internal squabbling. I can’t fault Jobs for getting fed up with Motorola and IBM, they’ve both been crappy business partners.
I have some fear that this will backfire in all our faces, both PC and Mac users, ruining competition in the CPU marketplace. I’m hoping that Apple’s feint towards Intel will put more thorns under AMD, TransMeta, and the PowerPC vendors, that they’ll get serious about cranking out some competitive silicon.
It’s gonna be exciting…
* * *