What he never says is that nothing in the range from early
API sketches to the final Java API Specification is a blueprint of what
to make. My apologies for making free with selections of your
quote, but I think these portions keep getting missed. The API isn't a
blueprint; it doesn't tell you how to build what's behind it - it's exactly the
opposite! You have an API so you don't need to know the code under it! Say
for example there is an API for the Queen Mary II. One of the methods in this
API is for current displacement:
public float
currentDisplacement(){ code; }
Now, it's possible that this code reads pressure sensors on the bottom of
the hull to calculate depth, and then converts through a numeric integration to
figure out volume of water displaced to get the hull that far down in the water.
Maybe there's a laser on the bridge wing which determines the distance to the
water line. Maybe the function totals all the changes in inventory and manifests
- cargo, fuel, passengers, supplies - and comes up with a displacement that way.
Or perhaps the mass of the vessel is inferred from the engine force applied
compared to the acceleration observed. The point is - the API user doesn't
know, and the API specification doesn't (necessarily) say how it's
done. There may well be a hint ("Relies on ship motion! Unreliable while
docked!" or "Only run after shipManifest.update() has completed") but "hint" and
"blueprint" aren't the same thing. [ Reply to This | Parent | # ]
|