Dr. Dobb's is part of the Informa Tech Division of Informa PLC

This site is operated by a business or businesses owned by Informa PLC and all copyright resides with them. Informa PLC's registered office is 5 Howick Place, London SW1P 1WG. Registered in England and Wales. Number 8860726.


Channels ▼
RSS

Design

Graphs Versus Objects


John is a Division Scientist at BBN Technologies and Matt a Principal Systems Engineer at Progeny Systems. They can be contacted at [email protected] and [email protected], respectively.


Software objects are the de facto programming paradigm for engineering intelligence into modern computer systems. Objects' labyrinth of inheritance, polymorphism, and encapsulated data, intermeshed with ifs, whiles, and for loops, are the basis for flying airplanes, producing health diagnoses, and surfing the Web. Sometimes we escape this rigid paradigm and place the program intelligence elsewhere, such as databases and files. In most cases, knowledge solutions are a hybrid of approaches. Each method has its advantages and disadvantages. An alternative approach—graphs—offers a contrast to these traditional holders of programming intelligence. Graphs have improved significantly with the coming of the Semantic Web, where graphs are a key tenet. In this article, we introduce graphs through a comparison with objects. This approach illustrates some key advantages while stirring up a little controversy. Some would say we should start with comparing graphs to databases and other similar approaches, but this would constrain graphs to a more traditional role. Graphs, as you will see, can help in all areas of knowledge management, including Web 2.0 and beyond.

What do we mean by "programming intelligence" and what are its key attributes? Programming intelligence is not of the sentient, human kind. We mean the intelligence that represents sequences, relationships, algorithms, and the like. As the developer, you must constantly choose between the trade-offs of the various methods, such as programming steps themselves, databases, and files. Here are some key concepts to consider:

  • Expressiveness. Represent the degree of complexity captured by the chosen method. Complexity includes types of facts such as numbers and strings, relationships such as inheritance, containership, aggregation, peer, and constraints such as less than 10.
  • Integration. This drives the useful expansion of knowledge. Impedance mismatches caused by a different syntax and/or different semantics force you to create cumbersome translation routines or just not integrate at all.
  • Resource Use. Programming complex knowledge runs within hardware and hardware has real-world constraints. Resources consist of network bandwidth, processor cycles, memory locations, and/or disk locations. The approach must balance the knowledge requirements with the available resources.
  • Scalability. The approach must be able to expand and contract in several dimensions such as size, complexity, and performance.
  • Interrogation. The ability to ask the right question and receive the right answer significantly increases the value of the programming intelligence. This extends to answering ad-hoc questions not originally planned.
  • Flexibility. Escaping the speciousness of the waterfall process, modern development processes, especially complex, intelligence-based systems, must absorb change throughout many incremental, interactive deployments.
  • Integrity. The intelligence must maintain its consistency and correctness. This is especially important as an application moves data around. If there is minimal integrity, many programming steps are repeated to ensure that a float remains a float, a string remains a string, a specific integer never exceeds 100, and so on.

How does Web 2.0 impact these attributes? Web 2.0 represents three significant trends: scale, change, and integration. Web 2.0 has evolved the emphasis on systems—they must scale rapidly, quickly adapt to new possibilities, and easily integrate with others. Thus to be Web 2.0 enabled, you must carefully consider how your development choices incorporate these Web 2.0 trends. Additionally, the intelligence of your program becomes even more of a key asset—you no longer must do everything from moving data bits to a fancy GUI. If you can incorporate the trends into your solution, many Web 2.0 possibilities are already there for your integration. You can then focus on what you do best—your smarts.

Now let's examine some code examples that highlight the differences between objects and graphs. The complete code example is available online at SemWebCentral (www.SemWebCentral.org) and from DDJ; see www.ddj.com/code/. We selected a well-understood and completely original programming application—the digital marketplace. We also introduce changes as we build out the application. Two complete solutions are presented: object based and graph based. We start with the object based.

The code highlights five major aspects, such as how to:

  • Represent knowledge
  • Create instances of knowledge
  • Integrate knowledge
  • Interrogate knowledge
  • Change the representation

The better the representation, the better the semantics, but it must be able to work efficiently within the real-world constraints.


Related Reading


More Insights






Currently we allow the following HTML tags in comments:

Single tags

These tags can be used alone and don't need an ending tag.

<br> Defines a single line break

<hr> Defines a horizontal line

Matching tags

These require an ending tag - e.g. <i>italic text</i>

<a> Defines an anchor

<b> Defines bold text

<big> Defines big text

<blockquote> Defines a long quotation

<caption> Defines a table caption

<cite> Defines a citation

<code> Defines computer code text

<em> Defines emphasized text

<fieldset> Defines a border around elements in a form

<h1> This is heading 1

<h2> This is heading 2

<h3> This is heading 3

<h4> This is heading 4

<h5> This is heading 5

<h6> This is heading 6

<i> Defines italic text

<p> Defines a paragraph

<pre> Defines preformatted text

<q> Defines a short quotation

<samp> Defines sample computer code text

<small> Defines small text

<span> Defines a section in a document

<s> Defines strikethrough text

<strike> Defines strikethrough text

<strong> Defines strong text

<sub> Defines subscripted text

<sup> Defines superscripted text

<u> Defines underlined text

Dr. Dobb's encourages readers to engage in spirited, healthy debate, including taking us to task. However, Dr. Dobb's moderates all comments posted to our site, and reserves the right to modify or remove any content that it determines to be derogatory, offensive, inflammatory, vulgar, irrelevant/off-topic, racist or obvious marketing or spam. Dr. Dobb's further reserves the right to disable the profile of any commenter participating in said activities.

 
Disqus Tips To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.