Wednesday, June 25, 2014

A Couple of Words about Swift

It seems everyone has something to say about Swift, the new language for developing on Apple’s Mac and iOS platforms.

Things like: “Do we really need another programming language?” Or, “Clearly, Swift borrowed feature X from language Y.” Or, “Boy, not including feature Z really cripples Swift.”

Am I any more qualified than the rest of the rabble to comment? No. But I won’t let that stop me.

Swift is an Amazing Achievement

Consider Objective-C, the language in which the Cocoa frameworks are written.  At birth, Objective-C most closely resembled Smalltalk-80 glued to a C compiler.  The syntax for message sends was clearly borrowed from Smalltalk, and the extreme late-binding dynamic behavior was, too.  Over time, Objective-C acquired a little bit of static typing, but it was mostly hints, not guarantees that a compiler could (or should) rely on.  At bottom, every message send went through dynamic dispatch (objc_msgSend).

Objective-C, some joked, combined the type-safety of C with the performance of Smalltalk.

Objective-C was the big loser in the battle for a mainstream language that extended C with object-oriented capabilities.  (C++ won that battle, but it ultimately lost the war to Java.)  Developers knew that Objective-C was an Apple-only ghetto.  But they also knew that the language was not as important as the frameworks.  Remember, all of NextStep Cocoa was written in Objective-C.  So, they put up with the limitations of Objective-C, but something was happening in the world.

After a (Java-induced?) lull, people started paying more attention to programming language alternatives.  C++ templates and Java generics made strict compile-time typing the norm, and programmers began to get used to the idea of having the compiler eliminate a large class of errors.  Compile-time type guarantees also eliminate most run-time checks, yielding performance improvements.  Type inferencing started making inroads into mainstream languages, so that typing declarations didn't require so much typing on the keyboard.  Lambda expressions, first-class functions, and closures also started to make their way into the mainstream from the functional programming community (one area where Objective-C’s blocks were slightly ahead of the game).

The end result of this was, I think, a renewed interest in languages that combine expressiveness with static type safety.  And Apple was at risk of having developers feel a pull away from the Cocoa platform because the Objective-C language was starting to seem behind the times.  Objective-C was not as easy or as fun to use as the newer alternatives.

A New Language, or a New Language?

Apple’s challenge, then, was to introduce a new language that could be used with the existing Cocoa frameworks.  And that, I claim, is exactly why no existing language—no matter how wonderful—could fill the need.

Watch the WWDC 2014 presentations on Integrating Swift with Objective-C and Swift Interoperability in Depth.  Now ask yourself, for every existing candidate language, could it have been adapted to interoperate with Objective-C the way that Swift does?  No.  Could any of them have been tweaked a bit?  Maybe, but at what cost?  Don't forget that many of these languages are relying on an underlying virtual machine with a very specific memory model, and once that is changed, much of the existing implementation cannot be reused.

The constraints of the environment make a new language a better choice, a choice with fewer compromises.

So, yeah, Swift borrows liberally from “Rust, Haskell, Ruby, Python, C#, CLU, and far too many others to list.”  But it couldn't be any of those, for the most basic of reasons, that requirement of interoperability.

The Good, the Bad, and the Ugly

Are you ready for a subjective laundry list?  Let’s do it!

The Good

  • Interactive REPL
  • Semicolons?  We don't need no semicolons!
  • Unicode
  • Immutable and mutable bindings (let and var)
  • Type inferencing (can handle recursion in some cases that Scala can’t, it would seem)
  • String interpolation
  • Array and dictionary literals
  • Pattern-matching!
  • Closures and first-class functions
  • Tuples
  • Explicit override
  • Optional
  • Generics with type constraints
  • Protocols
  • Extensions
  • Arithmetic overflow detection
  • Mandatory named parameters (sometimes, you don’t want people to have the option of screwing up)
  • Trailing closures, I think. I’m not entirely certain whether this is the right approach; but it does seem useable.

The Bad

  • Immutable arrays aren’t.  This is documented behavior, but it may be changed.  (Update: It was changed.)
  • Documentation is vague on when/whether dictionary keys are immutable.
  • Optional is baked in as a special case.  Don’t expect to use the same syntax for anything you might conjure up yourself.
  • Mutable structs that are always passed by value.  How can this be a good idea?
  • It seems that genericity and protocols don’t play well together.  I am not sure how well I understand the issue, to be honest, since I have not actually written any Swift code.
  • The two-dot/three-dot half-open/closed range syntax is a horrible mistake. (Update: This has been changed, to use ..< and ..., which takes it out of Bad but maybe still leaves it in Ugly.
  • Mutable strings
  • Generic type constraints are limited, with …
  • No explicit covariance/contravariance for generic type parameters
  • Not really functional, although the author of that piece is not criticizing, just observing 

The Ugly

  • The test-optional-and-bind syntax (if let) is pretty ugly to my eye.  For that matter, so is the pattern matching bind (case let).  My brain does not want to see that let in the middle of a statement.
  • I just don’t think switch is the best name for the pattern matching statement.  Pattern matching is so different from what a C switch does.  (Perhaps a case of trying too hard to appear familiar.)
  • External names for parameters.  I don’t object strongly to the idea, but the syntax leaves something to be desired.
  • String mutability is determined by the kind of binding?  That is weird and confusing.
  • C-style for loops are probably unnecessary and may encourage bad style.
  • Labeled statements and directed break/continue.  Bleah.
  • var parameters.  Why bother?
  • inout parameters probably exist only for compatibility with existing code.  A necessary evil, I suppose.
  • The keyword in for separating closure header from body grates on me.
  • Using static/class modifiers instead of having a single keyword for both cases.

Will It Fly? (sorry)

Contributions on Apple’s developer forums from the Swift team make it clear that Swift is a work in progress.  The Swift creators are interested in feedback and they want to improve the language.

Swift could well achieve one of its open secret goals: to become a teaching language.  (The benefit for Apple is obvious.)  The playground feature is pretty nifty, and I can easily imagine wanting to use it if I were introducing some basic programming concepts.

Would Swift spread beyond the Cocoa domain if the implementation were opened up?  That’s hard to say.  As a language, it does not seem compelling compared to my current favorite, Scala.  The native code compilation has some appeal, but the JVM has a pretty good JIT these days.  The reference counting storage management could be a big deal in certain applications, but the developer overhead in manually managing cycles is hard to justify outside of narrow domains.

For its intended use, however, I would say Swift is a pretty good bet to be successful, and probably make a lot of Cocoa programmers more productive.

Wednesday, January 29, 2014

Scala: What’s not to like?

What if you like object-oriented programming and you like functional programming and you like having an interactive interface and you like the Java ecosystem and you like static typing (but you wish the compiler wouldn’t make you be explicit all the time about type declarations)?

Scala lives at the intersection of all those things and, after spending some time with it, I have to say it’s pretty good.

Maybe I’m just weird, but my initial reaction to Scala was that it felt enough like Python to make me happy.  I like Python, but I’ve never tried to use it for anything big—it doesn't feel like I would be comfortable trying to move around in a lot of Python code.  Scala mostly succeeds at feeling simple enough to start diving in scripting-style while having the muscle to build anything you might want a “systems language” for.

Things I Like

A type system that works

I still recall when I first learned that Java's type system made arrays covariant, so that a program could pass the static type checker, not do any explicit dynamic type casting, and still generate run-time type exceptions.  Yay (ironic).  It took years for Java to add generics (parameterized types), and by that time the compatibility concerns meant that it was too late to do things right.  So, Java has static types with generics, but they're not as flexible, powerful, or reliable as you might like.

The type inferencer is good enough that most declarations are for humans, not the compiler.  (There are exceptions, of course.  The most common is that the compiler needs an explicit return type for a recursive function.)

The truth is that the time is long past when I could read a paper about F-bounded polymorphism and imagine that I understood it.  But the Scala type system seems to work in the real world.  Yes, sometimes the error messages are not as helpful as I'd like.  But I'll take that in exchange for what I get in return.

Interactive read-eval-print

Is this really that important?  I think so.  All programming is exploratory to some degree, and all exploration is interactive.  Being able to type in a few lines and see if they produce the result you expect is invaluable.

Value classes

You want zero-overhead wrappers for primitives like integers and doubles?  You want to add behavior to integers by subclassing without any overhead?  You can do that with the combination of value classes and implicits.  This can be surprisingly handy.

Java interoperability

So, Java is not my favorite programming language, but it has an enormous ecosystem.  Scala can plug into that by virtue of its JVM implementation and Java interoperability.  

The interactivity comes into play here as well: Whenever you use someone else’s library, you have to able to do some exploration.  I’ve used both Rhino and Jython as ways to experiment with Java APIs, but they don't feel like an especially good fit, maybe because of the dynamic typing.  Scala works well for this.

Decent IDEs

Well, I've only used IntelliJ IDEA, but people seem to think Eclipse is also fine for Scala.  This isn't so much a good thing about the language as a necessity.

Call by name

This is something that really got done right.  I suppose it’s just syntactic sugar for automatically generating no-argument lambda expressions, but it adds the right kind of control structure extensibility without being, well, weird.

A better Java?

I've seen people say that Scala is to Java as C++ is to C.  Sometimes they mean that as a negative, and sometimes as a positive.  I agree that C++ adds a lot of complexity to C, but I also think it makes a more expressive language that, used with care, makes for efficient, maintainable code.  And that's pretty much how I view Scala.

Things I Don’t Like

There's more than one way to do it

This is, I guess, an unavoidable result of a multi-paradigm language.  Somehow it seems worse in Scala than it does in Python.  Part of that is the syntactic sugar aspect, where there really isn't more than one way to do it, but there's more than one way to express what you're doing.  But another part is that Scala really lives in two worlds: the Java world of mutable data structures and the functional world of immutable data structures and higher-order functions.  You can write code in either style and still be idiomatic, although people are likely to steer you more toward the functional style.

The existence of both traits and abstract classes is another side of this.  Even the language's creator has trouble explaining exactly when to use which.

Strings

The idea of a programming language that doesn’t actually have a native definition of strings is just bizarre (“Scala’s String class is usually derived from the standard String class of the underlying host system (and may be identified with it).”).  Scala strings are Java strings, and if some behavior of Java strings is just not quite Scala-like, that’s too bad.  Yuck.

AC adapter not included

Here's where I think the Python comparison makes Scala look bad.  The Python slogan “batteries included” refers to the standard library, which is full of useful stuff.  Scala native libraries are mostly collections and utilities.  Scala has direct access to all of the Java standard library, but there are no standard wrappers to make it easy to use those Java classes from Scala, and the Java standard libraries lack a lot of useful things that can be found in the Python library.

JVM crap

Thanks to the way Java handles generics, Scala has to live with the JVM's type erasure.  That's a nuisance, and it makes some code clumsier than it ought to be.

Scala has to live with Java's exception and class/interface models, too.  The former isn't hopeless, although interoperability means dealing with checked exceptions.  The class/interface model means that the mapping between Scala types and Java types can be surprising.

That Darn @!

There really are only two things that @ is used for (I think), annotations and pattern matching, but somehow the many different ways this can manifest just makes me worry every time I see an @.  Annotations on classes, methods and variables are simple enough, but annotations on types and expressions get a little confusing.  The annotation is not always where you might expect it to be, and it's easy to lose track of what's going on.  The cognitive load for distinguishing an annotation from a patten match type constraint and figuring out what exactly the annotation applies to is higher than I would like.

Things I’m Just Not Sure About

Implicit magic

Scala's mechanisms for implicit parameters can do amazing things.  Implicit parameters are the way that generic methods on collections can return new collections of the right type, for example.  And the “pimp my type” pattern (using implicits) makes it easy to add behavior to an existing implementation.

Implicits are pretty carefully controlled: the compiler will complain about ambiguity, so the risk of surprises is fairly low (but not zero).  But implicits are also a temptation to hide parameters that could be explicit—just to reduce the number of characters that have to be typed (silly) or read (maybe good, maybe bad).  My bias is with Python: “Explicit is better than implicit.”

Syntax follies

Scala will let you define your own special-character sequences as names.  This can and does lead to people doing things that, in the guise of “domain specific languages,” are really just silly.  But if I ever need to, I can define the UFO operator as <-^->.

I think the rules for infix syntax are the same for both special-character names and ordinary names (+ or plus).  But the rules for when parentheses are mandatory are not easily internalized, especially for parameters that are functions.  It is not always clear why sometimes parentheses are necessary, sometimes braces are sufficient, and (maybe?) sometimes you need both.

XML baked in

There seems to be consensus that this was probably not the best idea.

Churn

Scala is very much a living language, and the rate of change is kind of high.  I'm not sure whether I think that is bad or not.  It will certainly depend on your use case.

Random Stuff

The Scala meaning of yield is quite different from the Python meaning of yield, since Scala doesn’t have generators and Python has different for-comprehension syntax.  That threw me at first.

I guess functional programming gurus have no problem with it, but I always have to translate flatMap into the equivalent nested for comprehension, which makes code using flatMap a little harder to read.

Companion objects are pretty handy, but it’s easy to confuse the companion object’s apply method with a constructor.  (The classic example is the difference between Array(0) and new Array(0).)

Also, nothing actually guarantees that the unapply method used in pattern matching is consistent with the apply method (or case class constructor).  That’s an opportunity for confusion.

Summary (or “TL;DR” if you prefer)

Scala is actually pretty cool.  It has its warts, like any programming language, but there is a lot there that feels right.  It’s too bad it doesn’t have more traction.

Saturday, August 24, 2013

Ashland Summer 2013

Herein a few notes on the summer plays we saw at the Oregon Shakespeare Festival.

The Tenth Muse

This commissioned work started out, we were told, to be an adaptation of one of the few surviving plays by Sor Juana Inés de la Cruz, a 17th century Mexican nun.  It evolved into a story set in a fictionalized version of the convent at San Jeronimo twenty years after her death.  Sor Juana was an intellectual and a feminist, and her writing attracted disapproval from the church hierarchy.  The play has three young women discovering a cache of her works that were supposed to have been destroyed, and focuses on how they respond to the work and to the influence of one of the sisters who emulates Sor Juana.

The play is as much about race and class as it is about feminism: the three central characters are Spaniard, mestizo, and native.  These ethnicities dictate their options and those options conflict with their capabilities and desires.

My biggest complaint about this work is that it seemed like we had not gotten very far in plot or character development before intermission.  The second half was entirely satisfying, so I can't complain too much, but it would be better, I think, if a little more development moved earlier.

The story takes a particular liberty with Sor Juana's death in a way that serves drama and, perhaps, Truth.  And the tone of the ending is a bit ambiguous; presumably this was the intention.

The Liquid Plain

I liked everything about this production of a play that deals with the slave trade in the northern states.  The sets, the costumes, the performances were all excellent.  My problem is with the play itself.

I feel like I missed some essential point.  The play hinges around a climactic scene where a character does something surprising.  Later we learn that the character has an important secret.  But that revelation does not explain the character's behavior—especially when we're told that another character also knew the secret.

The characterizations and dialogue were otherwise fine, but I can't get past this problem.

The Heart of Robin Hood

This play spins a version of Robin Hood where the merry men are still on step 1 of “Steal from the rich, give to the poor” (their reputation is preceding them?) when Marion tries to join them.  They also have a strict rule against women in the camp, so Marion has to go Shakespearean and dress up as a boy to teach them a thing or two.

Michael Elich gets to have far too much fun playing evil Prince John pursuing Marion and threatening small children.  I'm not sure the two children added enough to the story to justify them; the play feels just a bit over-stuffed.  But it was plenty of fun, and felt at home amid the Shakespeare.

The Unfortunates

I don't know what to call this.  I wouldn't call it a musical—maybe a musical theatrical experience?  Let's just say that it was well-performed but the story and the visuals were kind of hallucinatory.  Not much plot to speak of, and the bare framing didn't really make sense.

A Midsummer Night’s Dream

I quite liked this production.  Set in 1964 at a Catholic school (more or less), the framing of Theseus and Hippolyta as a priest and nun who are renouncing their vows to marry actually worked for me.  (A nun, like an Amazon, lives in a society of women.)  Having the “rustics” be the school's drama teacher, gym teacher, science teacher, lunch lady, and janitor was great, and Brent Hinckley was wonderful as Nick Bottom (but really, they were all good).

The lecture we heard drew attention to a peculiar conundrum of the young lovers that is often ignored: at the end of the play, one of them is still under the influence of a magic spell to “correct” his affection toward the proper target.  It’s an interesting point, although Demetrius is supposed to have loved Helena before he switched his affections to Hermia, so maybe the magic is really setting things to the way they were supposed to be.

While I love her in other productions, I don't think Gina Daniels’s voice was a good match for the role of Puck this time around.

A Streetcar Named Desire

Okay, I have never seen the classic film adaptation with Marlon Brando, nor any other production, so this was my first Streetcar.  I understand that some people have remarked on Stella being a stronger character than they are used to.  I have no basis for comparison, but there’s no question that, in this show, Stella knows exactly what she wants, what she has, and the price she is paying for it.

Jeffrey King’s performance as Mitch was amazing.  I really felt that he inhabited the character.  Danforth Comins, who was outstanding as the tortured Brick in Cat on a Hot Tin Roof, brought a certain element of self-awareness to Stanley that I think was not right for the character.  It didn't ruin things, but I think the play would have been better with a slightly more elemental Stanley.

Cymbeline

One of Shakespeare's later and lesser known plays, Cymbeline is classed as a “romance” along with The Tempest, A Winter's Tale, and Pericles.  It’s full of familiar themes: a parent-child reunion after many years, forgiveness, a token of love that becomes false proof of infidelity, a woman dressed as a man, a daughter being forced to marry against her will, parental ghosts, a power-hungry scheming spouse … you get the idea.  The preface speaker joked that it was like “Shakespeare's Greatest Hits.”

I gather that this production cut a fair bit from the play to make it manageable.  Cymbeline has, we are told, the longest final act of any of Shakespeare’s plays, as all the plot threads have to be pulled together and tied up.  There are a lot of those threads.

I think they did a good job.  I found the play quite satisfying.  I don’t even mind too much the director’s decision to play up the “fairy tale” aspects explicitly (the evil queen is dressed like Disney’s, and her poison is delivered in a shiny apple-shaped box; there are elfin ears aplenty and even a slightly ogre-ish jailer).  I have to suppose that this production was unusually good, or the play would be more popular.

Tuesday, May 01, 2012

Software Design Values

A recent conversation made me think explicitly about my software design values.  I believe that good software is as correct as is practical, is maintainable, and has adequate performance.

Correctness

Code that is “practically correct” is code that has been tested.  Only the most trivial of programs is “obviously correct,” and formal verification is not yet practical for non-trivial programs.  Testing is the only practical tool available for evaluating correctness.  Code review (including pair programming) is also valuable, but it is not a substitute for testing the executable code against expected results.

Maintainability

Maintainable code is readable and testable.  Without readability, code cannot easily be modified because it is hard to determine what the code is actually doing in the first place.  Without testability, code cannot be modified because it is impossible to determine whether changes have the intended consequences.

Readability

Readable code is divided into chunks that are small enough to be easily described, because the human brain has a limited capacity for complexity and detail.  “The competent programmer is fully aware of the strictly limited size of his own skull … .” [Dijkstra 1972]

Readable code must also be transparent: it says what it does and does what it says.  The essential character of readable code is that it reduces the cognitive load on the reader, so the reader can easily see what the code is doing—without being faced with unnecessary detail.  Code described as “clever” or “tricky” is rarely transparent; code that can be described as “elegant,” however, does not suffer that problem.

Another characteristic of readable code is good locality: all the code that manipulates some state is gathered together (conceptually, if not physically).  This allows the reader to see what state transitions are possible and to confirm invariants.

Readability and Testability

Separation of concerns is vital for code to be readable and testable.  Code that is concerned with one aspect of a problem should not be entangled with code that is concerned with another aspect of the problem.  Such entanglement impairs both readability and testability: readability is impaired because the reader must think about two separate problems at the same time, and testability is impaired because the test harness has to deal with two sets of behaviors.

Testability

For code to be testable, it should be structured to allow testing in isolation (unit testing).  Unit testing allows explicit, executable specification of behavior.  Unit testing also allows small changes to be tested, and small changes are much easier to make correctly because they minimize the cognitive burden on the maintainer.

Performance

I mention performance last not because it is less important, but because it is notoriously seductive.  “Premature optimization is the root of all evil.” [Knuth 1974]  Measured performance and intuition often disagree, and time spent on optimization before the code is correct is almost always time better spent on getting an adequate solution sooner.

And …

Finally, good programming is hard, and any strategy that makes it easier is valuable.  One such strategy is to use existing software instead of creating new, when there is adequate confidence in the existing software’s suitability.

I’ve avoided using “object-oriented” or even “abstraction” in the above.  That is because I am trying to identify the first principles of my design values, and these terms describe approaches that derive from those principles.

Saturday, September 03, 2011

Discover Card Doesn’t Get It

The folks at Discover Card just announced that they are ending their Secure Online Account Number program. It was a fraud prevention system that allowed a cardholder to generate a different credit card number for each merchant. The card number was bound to the merchant with whom it was first used—any attempt to use the same number elsewhere would be rejected. It was different from some other virtual credit card systems in that it did not let you specify a dollar limit or an explicit expiration date. Despite those limitations, it gave me a fair bit of peace of mind.

In explaining their decision, Discover says

Since Secure Online Account Numbers launched over a decade ago, we’ve continued to add layers of fraud detection and prevention, authentication and ID verification to protect your account information.
and
Discover provides you $0 Fraud Liability Guarantee to protect your account from unauthorized charges.
The problem with that $0 guarantee is that it ignores a fundamental truth of the modern world: time is money. Because what happens if Discover discovers that someone who shouldn’t has hold of your account number is they cancel the card and issue a new account number. No problem, right?

Some years ago, I was traveling for work when my wife’s purse was stolen. The only credit card I had with me was also in the stolen purse, so the card had to be canceled. This created an unexpected problem when the hotel I was staying at demanded an alternate form of payment immediately: they would not wait for a new card to be delivered to me, which might not even arrive before my departure. I had to get a colleague to guarantee my room payment.

I’ve learned that lesson, and my wife and I each carry a card that the other doesn’t. But canceling a credit card can still have a substantial impact. The last time Discover decided to change my account number, I got a notice from the local public radio station that my monthly pledge was rejected. Various online accounts had to be updated. It took a while to track everything down and get everything sorted.

That’s why I have been a regular user of the virtual account feature: not to limit my financial risk, but to limit my non-financial risk. And that is what Discover Card does not seem to understand.

Update (2011-10-17): Discover just announced that they have changed their minds:

We recently announced the decision to discontinue the Secure Online Account Number feature.

Since then, we've heard customers like you tell us how much they love the added control of using Secure Online Account Numbers for their online purchases.

Based on the feedback we've decided to reinstate this feature. Beginning today you will once again be able to generate secure online account numbers for online purchases.

Somebody actually listened.

Thursday, April 28, 2011

Front Page Lies (er, Misrepresentations)

Dear Mr Wolverton,

Look, if you want to write an article with the basic premise that Apple’s statement about the iPhone location database is false, you should really have the guts to lead with that assertion. Instead, you seem to have grossly misrepresented the Apple statement, giving your readers the impression that Apple “acknowledged” that the file is part of a system that reports the phone location to Apple. I read the Apple statement, and it said no such thing.

I found this statement especially egregious: “And the vast amounts of data being collected by application developers and mobile advertisers will continue, regardless of Apple's fix for the tracking file.” How can you reconcile that with Apple’s statement that “Location is not shared with any third party or ad unless the user explicitly approves giving the current location to the current ad (for example, to request the ad locate the Target store nearest them)?” Again, unless you claim Apple is lying, you have given your readers the false impression that advertisers are getting location data without users’ permission.

In fairness, you’ve carefully avoided making any statement that is actually false. But your repeated use of the phrase “tracking file” and the word “acknowledge” amounts to saying “Apple acknowledged this tracking file is not used for tracking.”

Maybe you should be writing about the president’s birth certificate instead.

Sincerely,

Update [2011-05-01]: A second article by Wolverton and Mike Swift arguably crosses the line from misleading to false in its opening:

The disclosure of a hidden file on iPhones late last month drew an outcry because it seemed to record users’ every move. But that isn’t the only way mobile phone users’ movements are being tracked.
While the first sentence weasels with “seemed to,” the second sentence has a clear, unambiguous meaning in context. It replaces the uncertainty of seeming with the certitude of fact. That lie spoils what would otherwise have been a worthwhile piece on what happens with actual tracking data.

Wednesday, January 26, 2011

The Inmates Are Running the Asylum

By reading this blog, you agree to be bound by all the terms and conditions contained in this agreement. Too late—you are already committed. You can terminate this agreement at any time by not coming back to this blog, but that won't release you from the agreement you have just made. Also, you agree that you will not violate this agreement (whatever that means).

Oh, and if you decide to come back to my blog, you had better re-read this posting every single time, because the terms and conditions may change at any time without notice. But you will still be bound by them.

I can't name the company whose website prompted this posting, because that might be a violation of my (involuntary) agreement not to use any of the information on their website in a defamatory way. Oh, wait! I have an out for that:

You agree to defend, indemnify, and hold harmless me, my agents, partners, and content providers, and their affiliates and their respective agents and assigns from and against all claims and expenses, including attorneys' fees, arising out of your use of this site.
There. If the lawyers who wrote that crap want to sue me for this posting, they'll have to prove that they never read it.

I'm probably in no position to sneer, since my employer has its own phalanx of lawyers. But I feel sorry for the folks I know who work at redacted.

Thursday, December 23, 2010

Google's ngrams: for entertainment only?

I admit it: I like to look for the problems, the bugs, the anomalies. So I couldn't resist using Google's new ngrams toy, with its nifty view of usage over time, to look for some anachronisms. Part of what prompted that: recently I was looking up a technical term in Google Books and it showed up in a book that was at least a decade too early. But it turned out that the book was not as described, in the most literal sense: the catalog information described one book, but the scanned content was of another book entirely.

The occasional mixup is not surprising in an effort of the scale of Google Books. But looking for anachronisms turned up a disturbing catalog error: periodicals misclassified as books. The problem is, whichever volume of the Memoirs and proceedings of the Manchester Literary & Philosophical Society it might be that discusses computer programming languages, it definitely is not one from 1888. But it seems they all get that publication date because the publication is (according to Google’s catalog data) a book.

Some other misleading finds:

  • Annual Report of the National Academy of Sciences, 1888
  • IEEE Science Abstracts, 1898
  • ACS Chemical Abstracts, 1907
  • American Association of Schools and Departments of Journalism Journalism quarterly, 1928
I could go on. The point is, if you’re looking for trends, you are probably just fine. If you are looking for when terms first appeared, ngrams and Google Books must be used with caution.

Tuesday, January 26, 2010

Epic Journalism Fail

I get the print edition of the San José Mercury News. Sunday's edition left me completely flabbergasted.

The city of Palo Alto was the unfortunate site of a string of teen suicides last year, all by the same gruesome means. The city government, school officials, parents and other community members struggled to deal with the emotional impact of these events and discussed ways to prevent future incidents. One of the common themes repeated by the many psychologists interviewed by the local media was the role of the media themselves in this effort. The media, we were told, must be careful not to glorify or romanticize suicide in any way. Pictures of graves or memorials were mentioned in particular as something to avoid.

So, allow me to describe the front page of the Mercury News for January 24. Half the page is taken up by a feature article about a woman who committed suicide three years after the death of her (adult) son. The article features a lovely, romantic picture of her headstone, which features the same epitaph emblazoned above the article itself: "She died of a broken heart." (You can see the article, without the graphics, at the Mercury News website).

Perhaps it's just me, but describing a self-inflicted gunshot as dying of a broken heart seems like it might be glorifying or romanticizing suicide. In fact, it seems to me like pretty much the height of journalistic irresponsibility. Oh, did I mention the woman lived in Palo Alto?

Now for the part that defies description. I actually hadn't heard the news when I saw that front page, but apparently the editors of the Mercury News had, because they had this story on the first page of the local section of the same edition of the paper.

That's right. They ran a story romanticizing suicide on the same day that they ran a story about another teen suicide.

Sunday, January 11, 2009

MacWorld 2009 Trip Report

Last. MacWorld. Ever. Okay, not technically, since the show is scheduled for 2010. But without Apple, will it really be MacWorld? Hard to say. Anyway, here are my random impressions of the 2009 show.

Theme

Sometimes it seems that MacWorld has an unofficial theme, like translucent plastic (original iMac) or iPodWorld. To my mind, if there was a theme here, it was iPhone integration: Mac-based applications that have an iPhone (or iPod Touch) app associated with them. Apple's Keynote presenter app is one, of course, but there were enough others to catch my notice. Of course, there was a substantial amount of space devoted to cases and skins for pods and phones. As the last person on my block without an iPhone (and the last on the planet without an iPod), I didn't give them a great deal of attention, but leather continues to be popular.

Interesting Products

Not too many things caught my eye, I have to say. There didn't seem to be a lot of new software products on the floor. It may be my imagination, but I kind of thought there was a slightly higher ratio of enterprise/business apps to creative apps than in days past. Of course, the absence of Adobe was pretty significant there. Russell Brown declared the presentation theater to be "the virtual Adobe booth" at the start of his Photoshop presentation, but that's a far cry from the usual Adobe presence. On the hardware front, NEC had an ultrawide curved monitor that was actually a rear-projection screen with several LED-illuminated DLP projectors built in. But the one on display was definitely not seamless, so either it was a poor sample or the technology isn't quite ready yet. A tiny portable video projector was interesting, but it was not very bright, so I'm not sure how useful it would be. I liked a solar-powered visor-mounted Bluetooth hands-free kit; Michelle needs a hands-free system for her car and one that doesn't have to to be charged would be handy.

Shenanigans

I have long suspected that the exhibitors have some kind of informal contest to see what is the silliest thing that they can get people to wear while walking around the show floor in hopes of winning a prize. If there is such a contest, Peachpit Press won it hands down for managing to get huge numbers of people to walk around with fuzzy rabbit ears on their heads. And then there were the Delicious Librarians. Yes, it's an homage to the days of “booth babes” and a cute idea, but it just left me feeling uncomfortable for the women who dressed up. Even if they came up with the idea themselves, it still seems a little icky. But I'll let one of the librarians have the last word on that.

Reunions

I usually run into a couple of familiar faces just wandering around. This year was surprisingly light in that area; maybe I just picked the wrong day (Thursday).

Monday, November 03, 2008

"Let's go shopping!"

Having just used the line "Streaming video is hard; let's go shopping!" I rather felt like I should track down the truth about it. It turns out that Teen Talk Barbie never actually uttered the now-famous phrase about math and shopping. At least, not as a single saying. Here are some details.

Wednesday, September 17, 2008

“Good job with the healing!”

That's the enthusiastic—if slightly puzzling—pronouncement of Dr. Chou after six and a half months. The parts in between are not very exciting. A few highlights:
  • If the alternative is really icky, you will figure out how to use the toilet in your small, cramped bathroom that doesn't really have room for a walker.
  • Never underestimate the importance of a tray on a walker. A person on crutches has three legs and no hands.
  • If you must break a leg, break the left one and drive an automatic.
  • If you go into an appointment preparing to complain about how you still have frequent but tolerable pain when walking, and the first thing the nurse says is, “You're getting around without crutches! That's great!” … you may decide to change your plan.
  • Unlike some folks, I am not a candidate to have the hardware in my leg removed. The phrase “major excavation” was used.
Stanford billed my insurance company for about $140,000 and the insurance paid a negotiated rate of about $65,000. All sorts of interesting questions come to mind about people without insurance and who pays retail. I may never be completely comfortable lying on my left side, because of said hardware. And I have a slight limp that seems to persist even when I have no pain (and, yes, I still have some pain, although the level is low and the frequency is decreasing). But I have a lot my strength back and I've gotten back in the saddle. It will be a while before my riding muscles and reflexes are back to where they were, but it's a start.

Sunday, February 10, 2008

Femur, Interrupted

So, here's what happened. On Friday evening (Feb. 1) I was in a group lesson on James. My recollection is that he was a little squirrelly about steering as we cantered right, maybe because he didn't like the puddles. Anyway, I didn't see what, if anything, set him to bucking. I don't think I had much of a chance: he launched me pretty effectively, and I came down on my left side, basically landing on my thigh. Right away I knew I wasn't going to just get up. The muscles in my left leg simply weren't working. It was pretty clear that the rest of me was okay (my head never even came close to the ground, my right leg seemed to be fine, and my left arm wasn't involved in breaking my fall). The thing is that any attempt to move my left leg at all resulted in excruciating pain. But I could wiggle my left angle and move my left toes, so I was still thinking this was just a really bad injury to the muscles. Big thank-yous to Carrie, Dee Dee, Carol, and everyone else who helped with keeping me comfortable and helping to get the paramedics out to me. The paramedics put me onto a board to move me, and there was some pain involved. Once we got into their truck, they started to cut off most of my clothing and gave me something for pain. I recall explaining very clearly that they did not have to cut off my boot, they just had to make sure the zipper was all the way down. They engaged in a discussion about whether I was a candidate for a field traction device known as a "Sager". It wasn't until this point that I realized they were quite certain the leg was broken. Anyway, they said the Sager could reduce the damage done by the bone ends and would also help reduce the pain, and I told them to go for it, so they went ahead and hooked it up. Then we headed off to the Stanford ER.

A Scale of 1 to 10

Before we even headed for the ER I had to start answering the question that would be the question of the week: how is your pain on a scale of 1 to 10, where 1 is none at all and 10 is the worst pain ... wait! Is it the worst pain you've ever had? The worst pain you can imagine? The worst pain you can imagine staying conscious through? If you find out for sure, let me know. I learned eventually that my answer had to be adjusted to meet expectations, so I didn't really answer based on my 1 to 10, I answered based on "this hurts pretty bad and I could use something for the pain," which seemed to be 3-4, or "this really hurts and I need something for the pain now," which seemed to be more like 4-5. Knowing that clinical studies of pain medication also use this kind of unscaled self-reported pain as data doesn't do anything for my faith in pain medication research. Somewhere along the line here, one of the paramedics was running down a summary of my status, and he said that I came off a horse and wasn't wearing a helmet. I got very indignant (at least, that's the way I remember it), saying, "Of course I was wearing a helmet. We took it off before you got here! Do I look like an idiot?" Okay, I can't swear that I actually said that last part, but I was thinking it.

Wet Behind The Ears

At the ER, the doctor looked awfully young. He looked at radiographs (yes, I will post them when I get copies) and said I had a spiral fracture of the femur. He explained that they needed to apply traction to my leg, so he'd be drilling a hole through my tibia just below the knee and putting a pin through it. Apparently this is better than doing it from the outside (with an ankle cuff?). After a nice big shot of lidocaine, he proceeded to drill a hole through my leg, which was interesting because it was like being at the dentist and feeling him drilling into your teeth. There wasn't any pain, but I could clearly feel that he was drilling through my bone. I didn't get to see any of this part, which is just as well. But I felt them attach the weights to me. I would be in that position until 8:00 am the next morning, when they actually performed surgery. (The thing I remember about that night is that I would drift off to sleep and wake up whenever my leg muscles decided to spasm. Not the best night's sleep ever.) Speaking of young doctors, the ones I interacted with during prep for surgery definitely were wet behind the ears. One thing I noticed is that having previously told them I'd never had any major medical problems, when I told them I had spent my fair share of time in hospital rooms, they looked confused. Clearly, they were too young to be dealing with parents' health problems yet. One of the joys of being at a university hospital: When I told the doctor that my major anxiety was not about the surgery itself but about general anesthesia, he assured me that things are much better than they used to be. In fact, he said, if a young healthy adult like me were to die, it would be so unusual that they would write a paper about it. Good to know my death would be publishable. So I went into surgery around 8:00 am Saturday and the next time I was aware of a clock it was 1:00 pm in the recovery area. The doctor said the surgery went well, and before long I was ensconced in the (private!) room that would be mine for the next five days, along with a PCA (patient-controlled administration) drug system giving me hydromorphone ("Dilaudid"). My primary task was to push the green button when I wanted more drugs and periodically wiggle my toes, flex my ankles, and confirm that I could feel when my toes, instep, and sole were touched. (And when I say "before long" that is almost before Michelle even knew that I was out of surgery.)

Percocet and Me

I think it must have been Sunday morning that I was switched from the IV pain drugs to Percocet (oxycodone and acetaminophen). Percocet did not like me. Thankfully, none of the pain drugs I used caused me nausea, which is all too common for the whole narcotic family in some people. But Percocet just made me feel crummy: I felt like I had a fever even though I didn't, it destroyed what appetite I had, and it made me wish I could just sleep through the next few hours instead of experiencing them. I put up with it because I didn't really understand that there were alternatives I could try, and it turns out that Lortab (hydrocodone and acetaminophen, aka Vicodin) likes me much better. Oh, well. I'll know next time.

Out Go The Lights (part 1)

On Sunday, the cheery team from occupational and physical therapy showed and assured me I'd be skipping down the halls (without putting any weight on my left leg, of course) in no time. I was dubious, but they said I'd have a lot movement back within a week. Following their directions, I skooched over to the side of the bed using my arms to propel me and lifting my butt off the bed. We got to the edge of the bed with my legs over the side and I was basically sitting up. All was good. I just needed to grab the walker with my left hand, brace my right hand against the bed, and push with my right hand and leg to get upright. It went really well. Then I fainted. I only lost consciousness for a few seconds. They assured me that fainting on the first time getting vertical like this wasn't out of the ordinary, but it did put a damper on the proceedings. My blood pressure was fine after I fainted, but my pulse rate had been on the high side ever since I came in to the hospital. Later that evening there was an incident where my pulse rate decided to go sky high for no particular reason. It hit 150, and they slapped an EKG on me, but my heart rhythm waveforms were apparently perfectly normal -- just really fast. They gave me metoprolol, a beta blocker that slows the heart rate (my Dad was on this for his congestive heart failure). They also gave me a unit of blood, because of the fainting and a low hematocrit test result.

Out Go The Lights (part 2)

On Monday we repeated this procedure with very similar results. They actually monitored my blood pressure during the process, and it was pretty good right up until I tried to stand up, and right after I sat down again. (I didn't actually lose consciousness this time, but it was close.) Later we successfully got me standing long enough to transfer into a chair, but it was not so great being upright in the chair: I felt dizzy a couple of times. That night I got two more units of blood, and I felt a lot better the next day. (My mother-in-law the nurse said I should feel able to leap over roof-tops after 3 units of blood.) I was able to make it all around the bed and as far as the door.

Where Do We Go From Here?

By now, Stanford was itching to get me out of there. They wanted to send me home with some in-home PT and good luck. Michelle was seriously freaked about the idea and by that time I was, too. The alternative was to discharge to a rehab center (a skilled nursing facility) where I could have 3 days to a week of more intensive therapy in an in-patient setting. We decided that was the most sensible choice, because at that point I couldn't even get in and out of bed without help.

I'm In Rehab, Where's Lindsay?

Stanford looked at places they've had good experience with and places that contract with my insurance, and recommended Los Altos Sub-Acute Rehab. Thursday (Feb. 7) I got sent off with a lick and a promise (well, not really, but I definitely got the sense that Stanford was less interested in me when we decided not to go straight home). So, the average age at a skilled nursing facility is typically going to be on the high side. Most people don't wind up in in-patient rehab unless they're very badly injured or elderly. I was extremely lucky, and got a single room because there were no male semi-private beds available when I arrived. (Lucky because my insurance wouldn't cover the difference.) The one drawback to the room is that it is right next to the nurses station. That means there's a lot of activity and a very obnoxious buzzing display panel that is supposed to ensure that patient call buttons are responded to quickly. (Something is wrong with this design, however, because staffing levels are naturally adjusted to avoid waste, which means no call is ever answered immediately, which means that the damn panel buzzes pretty much continually -- that is, it buzzes once every ten seconds, pretty much all the time except in the middle of the night). My PT (Pat) and OT (May) have been great. They say that my overall good health and strength will make things a lot easier, and that seems to be true. Still ... toe-touch weight bearing means basically standing on one leg when standing up (left leg is only good for balance), and that uses a lot more energy that one might imagine. And two arms are not as strong as one leg, so walking with the walker or crutches tires out my arms pretty fast. But I seem to be able to manage all the important stuff at this point.

Homeward Bound

So, they're springing me from this joint on Valentine's Day, and after that I'll be doing home-visit PT for a while, then eventually outpatient PT. I have a followup visit with the Stanford orthopædic surgeon in a week, and hopefully I'll find out then what to expect in terms of progress.

Monday, August 20, 2007

How advanced is your technology?

The world doesn't need another corollary to Clarke's Third Law, to be sure. And yet …
Any insufficiently advanced technology is indistinguishable from a spell that backfires.

Monday, March 19, 2007

Impressions of Manila

Humid Hot Security
  • cars are stopped approaching the hotel
  • bags are inspected at the hotel and office building
  • many bomb-sniffing dogs (black labs who look hot and tired)
  • Airport security has X-ray screening at the entrance, then again at the gate area, and finally flights to the US have a third hand inspection and X-ray of shoes. Hand inspection includes flipping through the pages of a paperback to see if there's anything concealed there.
English everywhere McDonald's McRice burger Pedestrian underpasses
  • escalators up-only
The Thrilla in Manila is the taxi ride to the airport during rush hour

Monday, January 29, 2007

Sunday, December 17, 2006

The Little Green Car

The smart key system on the Prius at first seemed like just a convenience: I wouldn't have to fumble in my pocket for the clicker. But it turns out that the system operates on a very emotional level. Here's what happens: I walk up to the car, and the transmitter in the door pings the transponder on the key. Satisfied with the key's identity, it arms the unlock system and lights the interior. When I grasp the door handle, the car unlocks (with two beeps) and I can open the door. There's no perceptible delay in unlocking the door. Here's what it feels like: I walk up to the car, and it recognizes me. (It literally lights up in recognition.) As I open the door, it yelps excitedly. It's been waiting for me, anticipating my entry, so it unlocked the door as soon as it knew I wanted to come in. I know that it's just a well-designed electro-mechanical system, but I can't deny the emotional reaction I have to it. It feels as though the car is pleased to see me, perhaps because it seems to behave a lot like a dog would. The Little Green Car likes me.

Thursday, September 21, 2006

Quite the run-on sentence

Actual TV blurb:
A model child who became a killer: tonight only on Eleven @ 11:00, Scott Dyleski's mother on why she burned his belongings and what her son said after the murder and where to find the best bargains on bay area homes.
What could I possibly add?

Wednesday, August 30, 2006

Surprising Candor

I opened the paper this morning and read that Donald Rumsfeld says we need to "confront the rising threat of a new type of fascism." I didn't expect him to attack the administration like that.

Sunday, August 06, 2006

Ashland

Although many of our friends and acquaintances are regular goers to the Oregon Shakespeare Festival in Ashland, this was our first visit to the festival. I expected to enjoy it, but it turned out to be even more fun than I thought it would be. I had a great time, which Michelle points out may not be clear from the dry report that follows. So, just so you know, every single event was absolutely delightful. Since we didn't want to drive for long stretches or take the extra time for a more leisurely trip with stops along the way, we flew. Our plane from SFO to Medford ("Rogue Valley International Airport") was one of those cute little Embrauer turbo-props. I confess I like them. In case you're wondering, Medford's international airport has three "gates" and a single waiting area that must seat a good seventy people. (A word of warning: once you pass through security, your dining option consists of a vending machine with potato chips and granola bars.) Having waited too late to get reservations at a hotel or bed and breakfast close to the festival, we stayed in a perfectly serviceable Holiday Inn Express. It was only fifteen or twenty minutes from the festival, and my fears about parking proved overblown. On-street parking in the morning wasn't difficult. In the afternoon, we didn't have trouble parking in the free city lot a couple blocks away. There's also a paid city lot near the festival that's quite reasonable. We got in Wednesday evening, rented our car and checked in at the hotel. Thursday morning we drove into town and found the festival with no difficulty. The Visitor Center was staffed with helpful people who told us about the free noon-time "park talks," so we went to see actor Chris DuVal do a short introduction and a lively question and answer talk. Chris plays a couple of comic roles in the productions, but he did seem to react (albeit mildly) to being characterized by one questioner as a "comic actor." He also planted the seed that we might want to see Cyrano de Bergerac, which was not part of our original plan (nor our collection of tickets, of course). Our first play was The Winter's Tale. I wasn't very familiar with it, but the production was very accessible. The stage was quite bare, befitting the wintry theme. There were excellent performances by William Langan (Leontes) and Mark Murphey (Antigonus), and outstanding ones by Josiah Phillips (Old Shepherd) and Greta Oglesby (Paulina). This play has the famous stage direction, "Exit pursued by a bear," but no bear appeared on-stage. There is an animal on-stage in The Two Gentlemen of Verona. We attended a preface talk Thursday evening before we saw it, which gave some insight into the way the theme was interpreted in the design. Crab was played by a local dog named Terwilliger. The program reveals that more than a dozen local canines auditioned for the part. Terwilliger got along famously with David Kelly (Launce), and there was some fun at intermission with chasing a ball. Eileen DeSandre (Speed) was hilarious, and Juan Rivera LeBron (Valentine) did a wonderful job. On Friday we went to a noon-time lecture on The Merry Wives, language, and "citizen comedy" by a guest lecturer from Winchester (I need to look up his name). (Update: it's Geoff Ridden) Friday afternoon we saw King John in the New Theatre, a very intimate performance space. King John is not one of the more frequently produced histories, so it isn't full of familiar lines. (It is the source of the mangled metaphor about gilding the lily, which is originally painting the lily, or gilding refined gold.) Robynn Rodrigues (Constance) delivered a stunning performance of Constance's monologue on grief and madness. I don't think I had ever heard this speech before, but it's richly human and her delivery was quite breathtaking. If I could nominate only one performance we saw for an award, this would be it. Friday evening was The Merry Wives of Windsor. The scenery and costumes were brightly colored cartoons, described by our backstage tour-guide as "Doctor Seuss on coffee." Jonathan Haugen really stood out in his performance as Master Ford. Both of the wives, Tyler Layton (Mistress Ford) and Shona Tucker (Mistress Page) were also excellent. Saturday morning we showed up bright and early at the box office in hopes of getting tickets to Cyrano de Bergerac, but the few tickets available went to the few people ahead of us in line. After that was our backstage tour. We were guided by stage manager Kimberly Jean Barry, who truly amazed us with the amount of work that goes on before, between, and during the productions that we don't see from the audience. She likened it to the tip of the iceberg 90% under water, and I was quite convinced. Saturday afternoon was The Importance of Being Earnest. I would have to say that while all of the performances were excellent, no one stood out above the others, with the possible exception of Dee Maaske (Miss Prism). At five o'clock we returned to the box office area hoping against hope that someone would be selling tickets for Cyrano or that the box office would have unclaimed seats. As luck would have it, at six o'clock, when unclaimed tickets were released, there were only two people in front of us, and we actually got the last two seats for that night's performance. Cyrano de Bergerac was wonderful. The lead was being played by the understudy, Richard Howard. This was only his second performance in the role, and it would have been a fantastic performance even without considering the circumstance. Our only complaint was directed at the playwright: maybe Cyrano didn't have to stretch out his death scene with quite so much dialogue. Sunday noon we heard Greta Oglesby talk, which was delightful. She was well into a career in accounting, of all things, before she discovered that performing was her true calling. We finished up Sunday afternoon with David Edgar's adaptation of Dr. Jekyll and Mr. Hyde. We were left with some questions about the playwright's intentions in some aspects of the plot, but the production was stunning. The set design was very creative (which we heard a bit about during the backstage tour), and James Newcombe (Jekyll/Hyde) did an amazing job of transformation (even if his accent was a little inconstant). Now the only problem is that we're sitting in the aforementioned waiting area, grounded by the weather (at least there's free Wi-Fi). But we're definitely looking forward to a return trip next year.