Black-box composition of mismatched software components
Black-box composition of mismatched software components
Black-box composition of mismatched software components
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
140 5.6. Migration between support libraries: ephy–webkit<br />
5.6 Migrationbetweensupportlibraries: ephy–webkit<br />
Another area <strong>of</strong> continuing evolution in contemporary codebases is that <strong>of</strong> web browsers<br />
and associated s<strong>of</strong>tware. The Epiphany web browser 6 migrated during 2007–08 from a<br />
singleMozilla-basedHTMLdisplaywidgettoamoreflexiblecodebasesupportingboththe<br />
Mozilla renderer and a Webkit-based one. We compare Epiphany’s internal WebKitEmbed<br />
adaptation layer with a Cake implementation.<br />
The developers <strong>of</strong> Epiphany chose to strip out the adaptation layer after Webkit migration<br />
was completed, around July 2008, and target Webkit APIs directly. We therefore<br />
used Subversion revision 8300 (28 June 2008) as the reference codebase for Cake reimplementation.<br />
Although there is no relevant discussion <strong>of</strong> the decision to remove the<br />
abstraction layer, either in the changelogs or mailing list archives, clearly the developers<br />
anticipated no future need to change the target API. Performance could be a plausible<br />
motivation, but the interface in question is not particularly performance-sensitive. More<br />
likely, the change was intended to simplify the codebase, in the assumption (arguably<br />
optimistic) that there would be no future need to support alternative renderers. (This<br />
highlights the anticipation difficulties surrounding abstraction layers, as we remarked in<br />
§1.2.2.)<br />
The adaptation logic we reimplemented is effectively circumscribed by the definition<br />
<strong>of</strong> class WebKitEmbed. For simplicity, we left as is some additional adaptation code handling<br />
cookie management, password management and certain other functionality, since<br />
this contained only no-op implementations in our chosen revision. Similarly, we retained<br />
the utility classes WebKitEmbedPrefs and WebKitEmbedHistoryItem for use by our adaptation<br />
logic; these could be implemented in Cake, but owing to their small size, their C<br />
code is dominated by boilerplate, so would not give useful measurements. A particular<br />
complication with this boilerplate is that it is derived from the GObject library on which<br />
Epiphany is based, and is generated by heavy use <strong>of</strong> C preprocessing; we discuss this in<br />
the next subsection.<br />
5.6.1 Objects, associations and their construction<br />
Epiphany uses subclassing (using the GObject library [Krause 2007]) to connect an Embed<br />
object with a Webkit instance: the subclass’s fields point to Webkit resources. In<br />
Cake we use an association: the Embed object is associated with the relevant Webkit objects.<br />
Recall that this is implemented using an aggregate umbrella object, as described in<br />
§2.3.4. In the Cake implementation <strong>of</strong> the adapter, the umbrella object’s additional fields<br />
accommodate the state which was added by subclassing in the original implementation.<br />
Contrast the Cake fragment <strong>of</strong> Fig. 5.15 with the C fragment <strong>of</strong> Fig. 5.16.<br />
In the C case, a WebKitEmbed object is a EphyBaseEmbed and has a WebKitWebView,<br />
an EphyHistory and some other state. In the Cake version we factor this slightly differently:<br />
a given EphyBaseEmbed and EphyHistory are associated with a WebKitWebView. “Is<br />
associated with” is effectively the same as a has-a relationship, as conventionally encoded<br />
by a stored pointer. However, in our Cake code this is encoded not by directly embedding<br />
6 http://www.gnome.org/projects/epiphany/