Today, October 7th, is Ada Lovelace Day. Today is a day for recognizing the inspirational example of women working in science, engineering, technology, or mathematics.
As you probably know, based on her pioneering work on algorithms for the Difference Engine, Ada Lovelace is generally recognized as the world's first computer programmer. The Ada programming language was named in her honor. And you can actually read the first computer programmer ever written - In 1842, Ada translated and annotated the report of a presentation on the Difference Engine. John Walker, founder of Autodesk, located this seminal document and put it online. Ada's notes are at the end, labeled "a" through "g". Note g contains the code to compute a sequence of Bernoulli numbers with the engine. That is the world's first computer program, and it was written by Ada Lovelace - it is astonishing that we can look over the shoulder of the world's first programmer.
Ada Lovelace is a most interesting historical figure - she was the daughter of the poet Byron (famously and accurately described by a former lover as "mad, bad, and dangerous to know"). Byron was certainly uninhibited - he clashed with his college at Cambridge University, over a rule forbidding pet dogs. When the college declined to make an exception for Byron's beloved Newfoundland dog, he acquired a pet bear, and kept that at the college instead. (my take on it: a gorilla would have made the point more effectively, and been a lot more fun to take on walks, but Byron chose a bear. "They have made their rules, now bear the consequences, fools," Byron did not reportedly quip in rhyme, but he should have).
Ada never knew her eccentric poet father. He separated from Ada's mother a few weeks after Ada was born, and exiled himself to Greece, where he died young, at the age of 36. When the literati talk about "Byronic heroes", they mean someone who is brash, moody, passionate, energetic, handsome, artistic, charismatic and ultimately flawed. Ada's mother made sure that Byron had no influence on their daughter, and Mrs Byron also arranged early math tuition partly as a distraction for Ada.
They didn't have IDEs in Victorian times, so Ada Lovelace had to do her programming work the time-honored way, by chewing a pencil, while reflecting on the next lines to code. I like to think if she had used an IDE, she would have chosen MOTODEV Studio, and used its code snippets feature. The code snippet feature lists several dozen code idioms, and lets you paste them directly into your code, just by clicking. It is an awesome feature! Here's the code snippet for a GPS reading, that I just clicked into place
LocationManager locationManager =
(LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(
LocationManager.GPS_PROVIDER, 0, 0, new LocationListener() {
public void onStatusChanged(String provider, int status, Bundle b) { }
public void onProviderEnabled(String provider) { }
public void onProviderDisabled(String provider) { }
public void onLocationChanged(Location location) {
double latitute = location.getLatitude();
double longitude = location.getLongitude();
// do whatever you want with the coordinates
}
});
The code needs an AndroidManifest.xml permission:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCAT
and Studio conveniently offers to put this in the manifest for you.
The Lovelace family seat is in Ockham, Surrey. On a recent trip to England, I made a side trip to visit that stately pile, because of its association with Ada and programming. Here it is.
The Lovelace Family Seat, Ockham Park, England
It's an enormous country house, one wing of which burned down decades ago. The house is located right behind the village church, although changing demographics mean there really isn't an Ockham village any more, just a string of a few tiny cottages. I like to think of Ada Lovelace sitting in that vanished wing of that grand country house, chewing a pencil, and musing over "shift right and then 2's complement? Or take the complement and then do an unsigned shift?"
You can see a working replica of the Difference Engine that Ada Lovelace programmed, in the Computer History museum on Shoreline Ave in Mountain View, California. I suggested to a curator that they could raise money by selling trig tables that had been printed by the engine. He pooh-poohed the idea, claiming that they didn't want to get the engine all inky.
The engine was never realized in Ada's lifetime - I guess the hardware project slipped, the way they sometimes do. The replica construction was funded by a Microsoft millionaire, and built by Doron Swade of the British Science museum. Swade wrote a fascinating book on the topic, and unlike many hardware designs, this one worked perfectly after correcting a single error in the blueprints (some have speculated that it's not an error, but a copyright trap). It's Ada Lovelace Day all day long, so please celebrate and support it.
Peter van der Linden
Android Technology Evangelist
Notes
1. The "method of differences," which gave the Difference Engine its name, is explained here (poorly). Here's a better explanation.
© Copyright 1994-2012 Motorola Mobility, Inc. All rights reserved.
Portions of this page are modifications based on work created and shared by Google and used according to terms described in the Creative Commons 3.0 Attribution License.
Android, Android Market and YouTube are trademarks of Google, Inc.
DROID is a trademark of Lucasfilm Ltd. and its related companies. Used under license.
Source code displayed on this page may be licensed under Apache License, Version 2
Copyright © 2010, Android Open Source Project. All rights reserved unless otherwise explicitly indicated.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.