Thursday, December 6, 2007

No Good Deed Goes Unpunished

I'm a firm believer in the old adage that "No good deed goes unpunished." Why is that you might ask? Well, it's because a good deed is clearly done with good intent and of course we all know that the road to hell is paved with good intentions. So it follows that a good deed is often the first step on the way to hell. Of course most roads in the Eclipse community are paved with good intentions, so I certainly don't think they're all leading straight to hell, but one misstep and you could be well on your way. Goodness knows there are enough people watching for a misstep. In any case, I'd like to think that if hell froze over, it would look like this:


One always hopes that others will recognize good intentions for what they are and that when the actual results of well intended efforts do not match precisely the intent, that the intent is not forgotten.

I've often been told that I color my language with too much emotion and I'm sure that's true. It's a common failing of those with passion to misdirect that passion when sensibilities are violated. One might call that irresponsible, but that's using emotional language. It's always a good idea to focus on criticizing the ideas rather than criticizing people directly. Its also important to keep in mind that none of us really like personal criticism, or any kind of criticism for that matter. As such, even constructive criticism is not always well received despite the good intentions of those dishing it out. This basic failing in human nature makes it extremely difficult to influence change without giving others cause for taking offense.

I write this blog to help remind myself and others to think carefully when dishing out criticism. It's best to state all criticism in the form of a positive suggestions for improvements. Always make it clear your intentions are good. You're still likely to end up on the road to hell, but ask yourself this: What are the roads that lead away from hell paved with?


I'll climb down off of my high horse now---or is that my soap box? it's so hard to tell--- before someone knocks me off....

Tuesday, December 4, 2007

Winter's Icy Grip

Sunday night we had freezing rain north of Toronto. We never had such things in Vancouver where I grew up, just lots of normal rain. Predictions of freezing rain always make me worried about the garden, but there was little damage and much beauty. Diversity of weather certainly has its points of interest. This shot of a berry locked away in ice was my favorite for the day.


Monday was also the day that the Friends of Eclipse program was launched. As a committer representative on the board, I received advanced notice on Sunday. This is a program the committer representatives asked the foundation to look into setting up, so naturally I was thrilled with Ian's results and at the opportunity to be one of the first to demonstrate my friendship with my wallet, not just with my words. I even outbid Mike, but then the stakes quickly became to high for me! (I must say, Jeff is such a competitive guy!) Have a look at how quickly the donor list is growing! There's even a kind remark about modeling. How nice is that?

I'm proud to display a Friends of Eclipse logo on my blog home page. Thanks to Nathan, it's not just a one size fits all logo either, but rather is available in small, medium, and large. I suppose pride is a sin, so I should say I'm honored to display it. Eclipse has been my friend for a long time, so it's nice to know that now I'm Eclipse's friend...

Today the sun came out again. The combination of sun and ice is quite a thing!


I love a sunny day with fresh snow. You can see from all the ice on my blue spruce offset so nicely by the blue sky why I might worry about damage. It's a lot of extra weight to bear!


Even the girls think the snow is kind of cool, but I have to clear a bit of the backyard for them since they tend to disappear in a foot of snow.


I've not been busy just taking pictures either! I've been working on something that's kind of cool and also relatively simple. Have you ever heard of a substitution group? I see I've piqued your curiosity. (Just ask her where the ducky is and she'll give you this same look!)



A substitution group is an XML Schema thing and is what I call syntactic sugar because it's primary purpose is to make your XML serialization look pretty by allowing the instance to avoid the use of xsi:type. Though goodness knows it's beyond me why anyone cares that something as ugly as XML should be made slightly less ugly when it's barely human readable in the first place, but hey, there are an awful lot of people who are quite obsessed with the prettiness of their XML.

So here's the basic idea. Suppose I defined a type Resource with two subtypes, Folder and File, where a Folder has a list of members of type Resource. To round it out, we might define a FileSystem as having a list of folders. We could define that in XML Schema like this:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
xmlns:resource="http://www.example.com/resource"
targetNamespace="http://www.example.com/resource">

<xsd:element name="fileSystem"
type="resource:FileSystem"/>
<xsd:complexType name="FileSystem">
<xsd:sequence>
<xsd:element name="folder"
ecore:name="folders" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>

<xsd:element name="member"
ecore:name="members" type="resource:Resource"/>
<xsd:complexType name="Resource" abstract="true">
<xsd:attribute name="name" type="xsd:string"/>
</xsd:complexType>

<xsd:complexType name="Folder">
<xsd:complexContent>
<xsd:extension base="resource:Resource">
<xsd:sequence>
<xsd:element ref="resource:member"
ecore:name="members" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="File">
<xsd:complexContent>
<xsd:extension base="resource:Resource">
<xsd:sequence>
</xsd:sequence>
</xsd:extension>
</xsd:complexContent>
</xsd:complexType>

</xsd:schema>
Generating the EMF code for the above, we could use the generated API to create an instance like this:
Resource resource =
resourceSet.createResource
(URI.createURI("http:///My.resource"));
DocumentRoot documentRoot =
ResourceFactory.eINSTANCE.createDocumentRoot();
FileSystem fileSystem =
ResourceFactory.eINSTANCE.createFileSystem();
documentRoot.setFileSystem(fileSystem);
Folder folder1 =
ResourceFactory.eINSTANCE.createFolder();
fileSystem.getFolders().add(folder1);
folder1.setName("folder1");
File file1 = ResourceFactory.eINSTANCE.createFile();
file1.setName("file1");
folder1.getMembers().add(file1);
resource.getContents().add(documentRoot);
resource.save(System.out, null);
ByteArrayOutputStream out = new ByteArrayOutputStream();
resource.save(out, null);
Resource resource2 =
resourceSet.createResource
(URI.createURI("http:///My2.resource"));
resource2.load
(new ByteArrayInputStream(out.toByteArray()), null);
DocumentRoot loadedDocumentRoot =
(DocumentRoot)resource2.getContents().get(0);
The resulting serialization looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<resource:fileSystem
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:resource="http://www.example.com/resource">
<folder xsi:type="resource:Folder" name="folder1">
<resource:member xsi:type="resource:File" name="file1"/>
</folder>
</resource:fileSystem>
To our horror, it's full of xsi:types! Clearly it's metadata and it offends our sensibilities to see such metadata mixed in our data. Of course the element and attribute names are metadata too, and xsi:type is something that any conforming XML processor must handle, but let's not cloud an emotional issue with facts.

You might wonder why these xsi:types are even needed? If you think about it, when you seen an element named member, you won't know if it's a folder or a file, so you won't know what elements and attributes to expect in addition to those you would expect for a Resource. For EMF such information is important too because we need to create the right type of object.

To deal with this type of issue, XML Schema defines the notion of a substitution group. Here's the idea. We define new elements named folder and file and declare that they are in the substitution group for the member element.
<xsd:element name="folder"
substitutionGroup="resource:member"
type="resource:Folder"/>
<xsd:element name="file"
substitutionGroup="resource:member"
type="resource:File"/>
Now, where ever a member element may appear, a folder or file element can be substituted. And of course, once we see that element, we'll know the type of that element and hence won't need an xsi:type. If we are feeling particularly clever, we might even declare the member element abstract because Resource is abstract and hence we'd never expect to see a member element.
<xsd:element name="member"
ecore:name="members"
type="resource:Resource"
abstract="true"/>
So now we can go back, generate our API again, and try to rerun our previous example, which ends up failing with the incredibly helpful runtime exception that says
Invalid entry feature 'Folder.members'
Naturally we scurry off to the EMF newsgroup where it's explained to us that the members feature is read only because the members element is abstract. We must specify a "document root" feature in some horrible feature map that we didn't notice was generated in the Folder interface and that we don't know how to use.
FeatureMap getMembersGroup();
Finally we come to realize, based on the helpful advice, that we must change our example like this:
// folder1.getMembers().add(file1);
folder1.getMembersGroup().add
(ResourcePackage.Literals.DOCUMENT_ROOT__FILE, file1);
Woo hoo. Finally we have it producing what we want.
<?xml version="1.0" encoding="UTF-8"?>
<resource:fileSystem
xmlns:resource="http://www.example.com/resource">
<resource:folder name="folder1">
<resource:file name="file1"/>
</resource:folder>
</resource:fileSystem>
But it's kind of a bitter sweet victory because clearly our syntactic sugar has turned into semantic rat poison. So many folks won't quite be satisfied and some I know have even gone through great lengths to suppress the rat poison from the API and to write clever code that figures if you add a File to the getMembers() list, you really must mean you want to use the document root's file feature since that's the only choice available. It's clear that this kind of cleverness could be handled by the serializer itself, so I've added support for XMLResource.OPTION_ELEMENT_HANDLER along with an XML Schema annotation to eliminate the semantic rat poison:
<xsd:schema
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
ecore:ignoreSubstitutionGroups="true"
If we reload the schema and regenerate the API, it goes back to like we had it before. Then we can change the code to how we had it and we can add the new option to the regenerated resource factory's createResource method:
result.getDefaultSaveOptions().put
(XMLResource.OPTION_ELEMENT_HANDLER,
new ElementHandlerImpl(false));
The result is that we get the same sugary sweet serialization without the rotten decay in the API.

While I was at it, I thought I might as well look at eliminating the need to use a document root, since that rubs some people the wrong way. Often folks don't understand why it even exists and it's effectively just another example of semantic rat poison. As modelers, we're quite used to the concept of having an object that is an instance of some type, and that corresponds directly to having an instance of some type in XML schema. But the root of an XML document doesn't specify a type name, it specifies an element name. Hence a DocumentRoot is like an invisible root object that has features to contain the real root object; the name of that containing feature determines the root element's name. So clearly if we can deduce a substitution group element during serialization based on the type of object being serialized, we can also deduce a correct root element name in a very similar way. The new element handler option supports that as well, so all that remains is to be able to suppress the document root during load and then we can pretend that document roots don't exist at all.

The new option XMLResource.OPTION_SUPPRESS_DOCUMENT_ROOT can be used to suppress loading of a document root. We just need to add it to your generate createResource method.
result.getDefaultLoadOptions().put
(XMLResource.OPTION_SUPPRESS_DOCUMENT_ROOT,
Boolean.TRUE);
Then we can rewrite our example to omit the document root.
Resource resource =
resourceSet.createResource
(URI.createURI("http:///My.resource"));
FileSystem fileSystem =
ResourceFactory.eINSTANCE.createFileSystem();
Folder folder1 = ResourceFactory.eINSTANCE.createFolder();
fileSystem.getFolders().add(folder1);
folder1.setName("folder1");
File file1 = ResourceFactory.eINSTANCE.createFile();
file1.setName("file1");
folder1.getMembers().add(file1);
resource.getContents().add(fileSystem);
resource.save(System.out, null);
ByteArrayOutputStream out = new ByteArrayOutputStream();
resource.save(out, null);
Resource resource2 =
resourceSet.createResource
(URI.createURI("http:///My2.resource"));
resource2.load
(new ByteArrayInputStream(out.toByteArray()), null);
FileSystem loadedFileSystem =
(FileSystem)resource2.getContents().get(0);
It's thing of beauty. Sugar without decay.

Here's a final image to capture your imagination. It's like a Rorschach inkblot test. What do you see in this picture?

Tuesday, November 13, 2007

Reflections on Power

I wanted to share with folks a few of my personal reflections on the nature of power. To start with, it's important to understand what specifically I mean by the word power. Of course Wikipedia is our best friend when it comes questions like that. If you look there to help understand what power is, you'll see that it says "Power has many meanings, most of which imply (a capacity for) control or force." At the time of this writing, there was also a very powerful message at the top of the page, "You can help Wikimedia change the world!" Indeed! It is on this sociological aspect of power that I'd like to focus because it has interesting implications for open communities as well for the individuals in them. Of course power is definitely about control and force; even in the sociological sense, power is both something that constrains (i.e., controls the results of an action) as well as something that enables (i.e., forces the results of an action in particular direction). In the exercise of power there is a balance between coercion and influence, with the ultimate purpose being to bring about change (or perhaps to prevent it).

A particularly powerful analogy for me is to think of power as flame that is fed by the force of living things. As introspective conscious entities, we're in a unique position to contemplate power in this pure form. I visualize power as a flame into which I feed my thoughts and from that a manifest entity with a life of its own takes shape. That entity can and does exist independently of me, but I feed it and without anyone like me, it would vanish in the blink of an eye, just as would a flame without its fuel, the oxygen to consume that fuel, and the conditions in which to renew and drive the process. And just as a flame has power over its environment, so too, power has power over us. It's an extremely important principle to keep in mind that the extent to which one tries to coerce power, it will take control.


So I see power as a flame that should be held forth with a gently cupped hand both as something to carefully nurture and protect and as something with a life of its own to be kept separate and at a distance lest it consume more than one might intend. It's is not something to be clutched with a greedy fist and held close, for surely it will consume the holder and then it will escape entirely or cease to exist. Like the old saying "If you love something, set it free; if it comes back it's yours; if it doesn't it never was." When you share your power freely with other like minded people, the power grows in unexpected ways. Beware of those who will clutch and grab for power, and be most wary of that person being yourself. Greed is a basic human failing, don't ever assume you are above it. As the saying goes, power corrupts and absolute power corrupts absolutely.

I believe the Eclipse community specifically, the open source movement in general, and the internet as a whole, are incredibly powerful forces that will do more to change our global society than perhaps any political force ever has. The internet has brought down barriers to the flow of information and to the spread of ideas. It's ignited a new type of flame, the open community, that we all feed. We cannot help but influence it and we should be particularly wary of those who will coerce it for the gains of a small few. Rest assured that those who are too enamored by power will be consumed by it. A global force manifested in the internet is sweeping the planet and it empowers us all. The flow of information is no longer controlled by the editor of a journal , the publisher of a book, or the CEO of a corporation. We all have direct control over the information that flows around the globe, often within milliseconds of when we produce it. Others can rapidly build on these ideas and of course in the end, the whole is far greater than the sum of its parts.

So nurture power, exercise it transparently, and share it wisely. Individuals control the world.

Saturday, November 10, 2007

Fall Musings

The EclipseCon submissions are picking up their pace though no doubt there are quite a few people waiting until the last minutes to sneak in their submissions. Speaking of sneaking, look who was sneaking around my pond this lovely sunny fall morning.


I took these pictures out of my bedroom window. There were actually two of them, but I didn't get them both on camera.


Darin mentioned that foxes might help take care of my diversity problem, i.e., the mink that was eating all my frogs. Ironically, that problem took care of itself: she electrocuted herself under that rock shortly after last week's photo was taken. I wonder if there is anyone else I could convince to crawl under that rock, but clearly I digress...

With regard to EclipseCon, I highly encourage folks to think about giving short talks. I know you don't get free attendance for those, but they are very little work to prepare, they will given you a chance to talk about the cool things you are doing, and of course, most importantly, they will give everyone else a chance to find out more about you and your cool work. This is likely to help you establish contacts with like minded folks and meeting people is half the fun at EclipseCon. There are a great many short talk slots and not so many submissions for them, so the opportunity is ripe and I highly recommend folks planning to attend give a little more thought not just to attending but also to participating. Don't be shy. Help make this the most diverse conference ever. Show us your colors.


I'm looking forward to the runtime summit too. Like the Eclipse platform, EMF is well recognized as a basis for implementing tools, but it's not so well recognized as providing a very flexible and powerful runtime. EMF's core runtime even works stand alone with no dependencies on any other Eclipse runtime jars and the 2.2 runtime works with Foundation 1.1, so it can even be used on small devices. I think it's important that Eclipse's technologies be recognized as a powerful basis for runtimes as well as for tools, and this summit can help with that. It's one of the fallacies of our industry that there are tools and there are runtimes, and never the twain shall meet. Think of how much more productive developers could be if they can use common technology as the basis of both.

I'm also excited because Tom, Boris, and I are investigating supporting the core EMF runtime and the EMF edit framework that works with GWT. Tom is making very good progress. He's one of my favorite people at Eclipse because he's so incredibly helpful. I think he sets a really high bar as one of Eclipse's outstanding citizens. Check out his offer to help provide and maintain a 3.3 language pack. He's like a ray of sunshine on a frosty morning.


I've also been keeping in eye on the DTP newsgroup. I'm actually I'm a closet newsgroup junkie. Oops, I guess it's best to not say that out loud. In any case, I watched with interest the thread by Jeff Ramsdale about his offer to develop an EMF Open Data Access component. I think this will help feed EMF data into BIRT, so I'll bet a great many people will derive value from that.

Closer to home, the new Mint component is being provisioned now and there is yet another new proposal for a Temporality component. I'm very pleased that the modeling community is growing so incredibly fast. It seems to me that diversity breeds more diversity as I watch more and more people wanting to get involved in the rapidly growing set of components. I also had a few private conversations with companies looking to join the party, so I expect the pace of growth the pick up further. Eclipse is a great place to be!

Tuesday, November 6, 2007

Kudos to Eclipse's IP Team

David Sciamma submitted Contribution Questionaire 1862 today for the contributed code base of the new EMFT component that will provide support for graphical Ecore editing. I'm really very excited about it!

Imagine my pleasant surprise when it was approved via the parallel IP process in less than 1 hour. Incredible! Cheers to the IP team!


Don't over do it though!



For personal reasons, I won't be able to got to OSSummit Asia after all. So Crusty (guess which one is Crusty) won't get to meet MLP until another trip.

Friday, November 2, 2007

Coping with Diversity

Like the modeling community, orchids are extremely diverse. They represent the largest family of flowering plants, which might surprise you since they seem so exotic and rare. It surprises me that the modeling community has yielded no EclipseCon 2008 submissions yet! But I'm hopeful the community will soon produce some blossoms because, as if by good omen, my Cattleya just went into bloom the other day. Not only does it look lovely, it smells wonderful too!


There was a heavy frost last night, so that pretty much does in the last of the late bloomers. Come on modelers, don't be late bloomers like my Delphiniums.


You'll be frosted if you miss the November 19th deadline that's rapidly approaching!


And then, not unlike my Euonymus, you're likely to turn scarlet from embarrassment for being left out in the cold.


So be first and propose lots. It's a predatory world out there.


I was shocked to find a mink at my pond just a few hours ago! This sure explains a lot though. The missing koi, the dwindling frogs (note what's hanging out of her mouth), and the sparsity of this year's tadpole population. See the rock behind her? She just dove into the water and has her burrow in there!


Oh my goodness. I can't just send the dogs to chase her away like the heron either. I'm not sure what to do about her. At least she hasn't chewed a hole in the liner like that darned muskrat did a few years back.

Ah, diversity, it's a double edged sword...

Wednesday, October 31, 2007

A Bug and Some Spooks

As I threatened in my previous blog, here is the result of this year's pumpkin carving extravaganza.


Frightening creations aren't they?! This bug is a distant relative of our much less scary bugzilla mascot. I expect these creations, along with the smoke machine and the moans and groans sound effects, will scare all the little kiddies away so that we'll have lots of candies left over for ourselves. Fortunately we had specialized pumpkin carving tools that are very dull so we didn't need to make any claims against our accidental death and dismemberment insurance. I do wonder though what a thumb would be worth. After all, the space bar is very big so you can hit it with either thumb...

I managed to get the changes for 207671 committed. This generalizes the support for attribute access and even allows attributes to be updated. I could imagine that this might be used to support locking and unlocking resources. I hope it's all in good shape in time for next week's M3 build...

We're also starting a discussion about creating a modeling package for all the avid modelers of the world.

I found the article "Empowering the Masses with 'Oslo'" interesting. I thought Eclipse already empowered the masses. Maybe they'll use EMF4NET and make it all EPL? But then again, I ate that yummy looking shiny red apple the nice old lady brought to the door earlier and it seems to be making me a little woozy...