Tuesday, May 30, 2006

The Greyness of Gold

Steve McMcConnell's Software Project Survival Guide mentions gold plating a project, specifically: "Implement only what is required. Developers, managers, and customers often think of small, easy changes that seem to make the software better. These changes often have much more far-reaching impacts than anticipated by the specific developer who will implement the change. Do not let additional complexity creep into the project through gold-plating."

This may fly in the face of ideas like refactoring (although refactoring is generally an attempt to remove complexity not add it). To put this into context, though, the team that he's talking about is well above the quality curve: "...the average MIS shop would need about 14 calendar months and 110 staff-months to deliver a 100,000 line-of-code MIS system, and it would typically contain about 850 defects when delivered. The NASA SEL [the team in question] would deliver a system of that size with about the same amount of time and effort, but it would contain only about 50 defects."

So when you have a manager talking about not wanting to have a gold plated solution check to see if your project is delivering on the 50 defects/100,000 lines of code first.

Of course, the original point is true too - you can continually seek the perfect solution to a business problem, probably forever, and in doing so add complexity to a system. Business processes aren't always rational so there may not be a good solution to the problem. So continually swapping ways of solving a problem can be an untenable situation.

I know that some people want to refactor code forever and others are happy just to write code and see if it works somehow. There's obviously a balance.

To me saying, "I don't want a gold plated solution" is asking not try to achieve a certain level of quality and certainly most IT shops should be trying to do more not less.

Battle Between Two Towers Continues

"Position Paper: A Comparison of Two Modelling Paradigms in the Semantic Web" which continues some of the themes from "Semantic Web Architecture: Stack or Two Towers?".

"One paradigm is based on notions from standard logics, such as propositional logic, first-order logic, and Description Logics...the Classical paradigm...The other paradigm is based on notions from object-oriented databases... and rule languages...the Datalog paradigm."

"The Semantic Web is a very hostile environment for the unique name assumption. There are many and varied sources of information in the Semantic Web, even in the same area, and these sources are free to coin their own identifiers (IRIs) for anything they choose. For example, there are many providers of FOAF information, each of which may choose to use different identifiers to identify to the same individuals."

"FOAF mailboxes form a unique identifier for members of Person (i.e., mbox is an inverse functional property in FOAF). So, if one information source includes:
mbox(Bill Jones, "mailto:Bill Jones@ex.com") and another includes
mbox(William Jones, "mailto:Bill Jones@ex.com"), then it can be inferred from the two sources that Bill Jones and William Jones identify the same individual. This is not possible in the Datalog paradigm..."

"...mary and john could be the same, and due to the cardinality restriction it is inferred that they are, indeed, the same...here is an easy solution—simply state that these two individuals are different...it is also a good idea in general to explicate
inequalities (and disjointness) where they are known."

"Another way in which to apply a local closed world and/or unique name assumption would be to augment the Classical paradigm with constructs that could provide a Datalog-like flavour for portions of the Semantic Web. For example, there is no conceptual problem in providing constructs that state that certain information sources abide by the unique name assumption or are complete in some way."

"A promising direction for the future is to add epistemic constructs to OWL. An epistemic Description Logic provides a formalism that is mostly open, but that can close certain areas of information as desired."

I wonder if applying ideas like Date's SUMMARIZE operator whether things like COUNT, SUM, etc. could be applied to the Classical model.

Shiny Languages

Reasons Why Your Startup Should Use Ruby On Rails (RoR) "When tempted to adopt the newest “silver bullet” technology that promises immense gains in programmer productivity (which RoR does), understand what the tradeoffs are. To get even keener insight, study a little bit of history and find out what has come before. It’s possible that in your situation RoR is indeed the best choice, but likely not for the reasons above. If you find yourself agreeing with one of the eight reasons above, we really need to talk."

Another related article, "Why Ruby is an acceptable LISP".

And, "SQL On Rails".

Via Javalobby.

Organising Test Cases

One of my recent delvings into test driven code is how to ensure that all classes that implement an interface follow a given contract with the minimal amount of rework per class. In "Organising design-by-contract test code" it suggests creating "...abstract test cases for each of your (work) interfaces. These abstract test cases are specifically geared at testing the contract promoted by the (work) interfaces, and not things like setup, initialization or destruction code...Create concrete subclasses for these abstract test cases, which feed the superclass an instance of an implementation of the (work) interface that is being tested. These concrete classes are responsible for creating mock objects of the dependencies, doing any neccessary initialization, etc."

This is something I have used in the past, in something like JRDF there's abstract test cases that keep the creation of various objects hidden from the tests themselves.

My preference now is a little different - instead of using inheritance I use composition and I think that better reflects the flexibility of interfaces. Another advantage I've found is that ability to cross cut certain behaviours between these composed objects such as exception handling.

Monday, May 29, 2006

Ruby on Rails Development

"At the end of the day you sit there and realise that you spent the entire day writing 100 lines of code and then deleting 90 of them. :)"

And the perverse thing is, I couldn't think of anything more satisfying than going through that process.

The Rails Development Pattern.

Sunday, May 28, 2006

Google TechTalks

Practical Common Lisp and Knowledge Representation and the Semantic Web.

Via Google Techtalks.

Another Spring 2.0 Update

What's new in Spring 2.0? " Previous versions of Spring had IoC container level support for exactly two distinct bean scopes (singleton and prototype). Spring 2.0 improves on this by not only providing a number of additional scopes depending on the environment in which Spring is being deployed (for example, request and session scoped beans in a web environment), but also by providing 'hooks' (for want of a better word) so that Spring users can integrate their own scopes with (hopefully) a minimum of effort.

It should be noted that although the underlying (and internal) implementation for singleton- and prototype-scoped beans has been changed, said change is totally transparent to the end user... no existing configuration needs to change, and no existing configuration will break."

No more Spring Session Components Workarounds. Although, custom bean scopes shouldn't be worked on until RC1.

Ben Hale's Atlanta DevCon 2006 via Atlanta DevCon 2006.

Annotations All Around

Looking around at the talk on JPA, Java Persistence API Overview "Part of JSR-220, it began as a simplification of entity beans and evolved into POJO persistence. Scope expanded from EE environments to include Java SE. The reference implementation is available as part of GlassFish (the implementation donated by Oracle). The query language was expanded. You can use annotations and/or xml configuration, finally, the persistence runtime provider is pluggable.

Entity what's new:

* Created with new operator
* no required interfaces
* Have persistent identity
* May have both persistent and non-persistent state
* If they are Serializable, you can pass between around without the need for DTO's"

Also, lists the named and dynamic queries, object loading, table relationships and transaction handling.

Pretty much every example with JPA (EJB 3.0) consists of annotations, Annotations and the Object Model "Another approach, similar to the way we've used XDoclet or XDocclet 2, is to have the model and its annotations all in one class, which looks a lot like the class above." and another example, Extending EJB 3.0 with Interceptors "EJB 3.0 formalizes interceptors, already available in proprietary products, you can also intercept EJB life cycle events."

Netbeans seems to have taken the lead on some of this stuff including, See some NetBeans 5.5 (beta) features and screenshots.

Friday, May 26, 2006

Dereferencing

More Simpson's references, Lisa's Rival:
"Homer: [sleepy] Must...protect...sugar. Thieves everywhere. The strong
must protect the sweet...the sweet...[snores]
Marge: [walking out] Homer?
Homer: [with a Spanish accent] In America, first you get the sugar, then
you get the power, then you get the women...[snores]"

"Marge: Homer, when are you going to give up this crazy sugar scheme?
Homer: Never, Marge! Never. I can't live the button-down life like
you. I want it all: the terrifying lows, the dizzying highs, the
creamy middles. Sure, I might offend a few of the bluenoses with
my cocky stride and musky odors -- oh, I'll never be the darling
of the so-called "City Fathers" who cluck their tongues, stroke
their beards, and talk about "What's to be done with this Homer
Simpson?""

Logo in Ruby

If It's Not Nailed Down, Steal It "Pattern Matching, S-Expressions, and Domain Specific Languages in Ruby...Pattern matching is a relatively rare language feature found in Standard ML, OCaml0, Haskell, Common Lisp (CLOS), and a handful of others. It’s a form of multiple dispatch, so pattern matching functions run different code when called with different arguments. Pattern Matching lets you do this dispatch based on type, value, and even internal structure of the function’s arguments...Ruby gives us everything we need to represent S-expressions. Ruby list literals are written in enclosing brackets ([...]) and use commas as separators. Symbols are written as barewords proceeded by a colon (:)...Okay, enough talk, let’s implement a simple version of the Logo programming language in Ruby. Remember Logo3? That language with the silly turtle that draws? "

Thursday, May 25, 2006

Why have millions of triples? When you can have billions.

Big news, literally, with BigOWLIM. "BigOWLIM is a high-performance semantic repository, implemented in Java and packaged as a Storage and Inference Layer (SAIL) for the Sesame RDF database. BigOWLIM uses the TRREE engine to perform RDFS, OWL DLP, and OWL Horst reasoning, based on forward-chaining of entailment rules. The most expressive language supported is a combination of limited OWL Lite and unconstrained RDFS. BigOWLIM can manage billions of explicit statements on server hardware. A principle limitation of BigOWLIM is the relatively slow delete operation. The upload, reasoning, and the query evaluation proceed fast even against huge ontologies and datasets."

"BigOWLIM successfully passed the threshold of 1 billion (10^9) statements of OWL/RDF – it loaded an 8000-university dataset of the LUBM benchmark and answered the evaluation queries correctly. Evaluation setup and statistics:

BigOWLIM successfully passed the threshold of 1 billion (10^9) statements of OWL/RDF –
it loaded an 8000-university dataset of the LUBM benchmark and answered the evaluation queries correctly. Evaluation setup and statistics:

  • Hardware: 2 x Opteron 270, 16GB of RAM, RAID 10; assembly cost < 5000 EURO
  • OS: Suse 10.0 Linux, x86_64, Kernel 2.6.13-15-smp; 64-bit JDK 1.5 -Xmx12000m
  • Loading, inference, and storage took 69 hours and 51 min
  • LUBM(8000,0) contains 1.06 billions of explicit statements

    • The "inferred closure" contains about 786M statements
    • BigOWLIM had to manage over 1.85 billions of statements in total
    • These figures indicate that, if used as a plain-RDF repository, BigOWLIM can easily handle around 2 billion statements on the same hardware setup

  • 92GB RDF/XML files; 95 GB binary storage files
  • Average Speed: 4 538 statements/sec."


While not available for download, a scaled down version, OWLIM is.

Hot on the heals of recent postings, Scalability of the Semantic Web and performance, triplestores, and going round in circles...

Tuesday, May 23, 2006

Keep it on the Green

Recently, Martin Fowler updated his Continuous Integration paper, "For most projects, however, the XP guideline of a ten minute build is perfectly within reason. Most of our modern projects achieve this. It's worth putting in concentrated effort to make it happen, because every minute you reduce off the build time is a minute saved for each developer every time they commit. Since CI demands frequent commits, this adds up to a lot of time."

"The commit build is the one that has to be done quickly, as a result it will take a number of shortcuts that will reduce the ability to detect bugs. The trick is to balance the needs of bug finding and speed so that a good commit build is stable enough for other people to work on."

"A simple example of this is a two stage build. The first stage would do the compilation and run tests that are more localized unit tests with the database completely stubbed out. Such tests can run very fast, keeping within the ten minute guideline. However any bugs that involve larger scale interactions, particularly those involving the real database, won't be found. The second stage build runs a different suite of tests that do hit the real database and involve more end-to-end behavior. This suite might take a couple of hours to run."

Breakage patterns for a build is listed in, "Avoiding Continuous Integration Build Breakage Patterns" it includes: "Five O'clock Check-In", "Spoiled Fruit" and "It Is a Small Change".

The overall effect of having a slower build is that tested user visible functionality becomes more difficult over time. Each new high level test increases the build time and understanding what has broken takes longer. Often time is not taken to ensure that your faster atomic/unit/integration tests cover what was missing. So the importance of maintaining a green build when you have worse feedback becomes more important but the cost of maintaining it becomes more expensive.

Some of the discussion that I've had is on this thread on the boost mailing list.

Monday, May 22, 2006

World Wide VB

Two interesting talking points at the moment between Google's AJAX Framework and Continutations. Starting with, Continuations and GUIs, "...Web UIs are drastically constrained, offer a paucity of controls, and enforce a brutally linear control flow; and these are good things. I remember, in the early days, people saying “Once you know how to use one Windows app, you know how to use them all”. Ha ha ha. But you know what? Once you know how to use a browser, you are well on the way to being able to use most Web apps. The best AJAX apps are still very Web-like (as in, the Back button always works); but they’re faster and more responsive and nicer to look at. The worst AJAX apps are like bad Nineties VB."

This linked to: Continuations, cont’d "...there’s no need to drive a continuation bulldozer through your webapp, when a little REST garden spade will work quite nicely (and won’t tear up your lawn in the process). Don suggests that there may be other, more legitimate use cases for continuations outside of web applications, and I have no reason to disagree, but I would like to look at them pretty carefully."

The seed of the continued continuations conversation was, "Will Continuations continue?".

The Google Web Toolkit gets a reasonable overview, "GWT: Googles plain Java AJAX tools". This seems to be a similar approach taken by DWR 2.0 (out since late April) - using Java to write Javascript. DWR 2.0 also supports Jetty's AJAX continuations.

Update: So GWT is not like DWR. With DWR you still create your HTML and Javascript pages directly. With GWT you use widgets and lay them out like Swing - there's no direct access to the Javascript or layout. There is some criticism that this approach is at the wrong level of abstraction. One of the potential advantages is the ability to test drive the Java code and then deploy the Javascript - and hope that there are no bugs in only the Javascript version.

Wednesday, May 17, 2006

More Gore

A few years ago I tried to imagine what would have happened if Al Gore hadn't won the 2000 election. Well now that we're half way through his second term you can only wonder what kind of problems would've occurred if he hadn't turned solving global warming into the Apollo project of the 21st century. Although his critiques have labeled it a quagmire I guess it's better than half the world becoming so.

Update: In the comments Paul pointed to an introduction to Saturday Night Live introduction by president Gore (the direct link didn't work but this one did).

Update 2: Lawrence Lessig links to two adverts that are surely directed by Paul Verhoeven (from Robocop or Starship Troopers).

Tuesday, May 16, 2006

New Style, Old Style

In keeping with the new theme I'll continue to make outlandish claims (like the impending global acceptance of the Semantic Web?) and I was going to go with Google Adwords but instead to the 20 odd people who read this they will receive :Cuecats in the mail.

At the moment the list of blogs consists of the people who have linked to me.

Monday, May 15, 2006

Ten Times

What's the Secret Sauce in Ruby on Rails? links to Crossing borders: What's the secret sauce in Ruby on Rails? "Debates about Rails in the Java community have been intense and show no sign of dying down any time soon. Rails proponents boast of incredible productivity, with some claims of 10 to 1 over Java development. As a Java programmer, your knee-jerk response is to dismiss any wild productivity claims because you've likely heard them before and been disappointed. Java advocates increasingly insist that Ruby on Rails is a toy that can't scale, produces bad code, and won't work beyond the simplest applications. But as Rails praise keeps popping up -- often from credible sources -- a more prudent course might be to understand what Rails does well and to bring those ideas back to the Java platform. In this article, I'll explore the core features -- the secret sauce -- that are the essence of Rails's great productivity."

If Ruby is up to 10 times more productive that makes it about as productive as Python, Tcl and Perl, see "An Empirical Comparison of Seven Programming Languages".

Saturday, May 13, 2006

Free the Worker

Open letter to CEOs, COOs, CIOs and CFOs across the corporate world "No amount of posters, incentive programs, PowerPoint presentations or slogans on websites will affect the hearts and minds of your employees...many of your managers act betrayed when their employees tell them they want to leave the company. This is an absolute double standard and should be stopped immediately...Explain how your business works and why it is so exciting for you to run. Make them into better businesspeople so that they can grow their opportunities and net worth. And for God's sake share the profits...Don't ask for your employees' input if you are not going to listen to it...I have witnessed people playing video games at their desk until their manager leaves "just so they won't think that I am slacker." Huh? It is not a badge of honor to work 18 hours a day."

Also, Open letter to employees across the corporate world "If you want your life to grow in a positive direction, surround yourself with people who are eager to learn, problem-solve and support each other. I don't mean you can never complain - just don't get stuck whining all the time...Don't think of your job as a paycheck, think of it as a learning opportunity...You choose to be in your current situation, otherwise you would have changed it. So don't give away your power. If you are miserable, follow the advice above and move yourself to a better place."

From, Links for 2006-05-11 [del.icio.us].

Simpsons Ruby Mixin

Homerpalooza "I used to be with it, but then they changed what "it" was. Now, what I'm with isn't it, and what's "it" seems weird and scary to me."

Why Aren't My Assertions Counted? "The problem typically comes when you put assertions in your library modules. This isn't hard. All you have to do is put include Test::Unit::Assertions in your module or helper class and then you can include calls to assert, assert_equal and all the other assert methods. It works, except that your assertions aren't counted.

The reason why is that the method add_assertion does the counting. This is automatically called by all the assert methods. When they call the add_assertion method of TestCase, the count shows up in your test results no problem. But the add_assertion method of the Assertions module is just a no op. This is why they don't affect the assertion count. The solution is to add a functional add_assertion method back to your helper module/class that ties back to your test case."

When the language has the []= operator and it can be overloaded is somewhat scary. But when you fix what seems like a bug by changing the behaviour of the underlying class it seems crazy. I'd like to be able to say with certainty that the lack of interfaces is a mistake (or not) just like people seem to consider checked exceptions. Or that the ability to abitrarily add behaviour to existing objects is going to destroy open source and make code unmaintainable.

Why do you need new languages? Everyone knows programming languages attained perfection in 1995. It's a scientific fact.

Thursday, May 11, 2006

RDF2GO

RDF2GO is an abstraction over triple (and quad) stores. It allows developers to program against rdf2go interfaces and choose or change the implementation later easily.

A common API for Jena and YARS. Includes a comparison with JRDF.

Wednesday, May 10, 2006

RDFHibernate

Re: How will the semantic web emerge - OO languages:

"> For certain ontologies, java beans are a reasonable model. For
> others, though, with extremely flexible type systems, involving
> type relations outside those that map directly onto the java type
> system, its not so clear. Say it were possible for some instance to
> be a foaf:Person from one ontology and a deo:God from another
> ontology and a comic:Superhero from yet another, and there were no
> subclass relationships among these. Heck, perhaps deo:God and
> comic:Superhero both subclass from et:Nonhuman . While this isn't
> absurd by any means, it does make denoting the instance's type in a
> java bean complicated at best (I anticipate lots of interfaces ;-) ).

yes. My RDFHibernate library [1] works with interfaces that map onto
an RDF database using dynamic proxies."


It's listed under Java Distributed Data Acquisition and Control but does not seem available - except for the Subversion repository.

Henry Story just announced a new project which also has Hibernate overtones, Sommer "Sommer is a very simple library for mapping Plain Old Java Objects (POJOs) to RDF graphs and back. Sommer stands for Semantic Object (Metadata) Mapper. In German it also means "summer", the season opposite to winter, when animals no longer hibernate. In French a "somme" is both the sum of things as well as a little rest."

Tuesday, May 09, 2006

Mustang for Intel Macs

Bit behind the times. Available Now: Java SE 6.0 Release 1 Developer Preview 1 (Intel) "We have just released Java SE 6.0 Release 1 Developer Preview 1 and it is currently only available for Intel-based Macintosh computers. We will be releasing a DP in the near future for PPC also. We just wanted to get 1.6 out as fast as possible. It is available at the usual location of http://connect.apple.com. Please give us you feedback."

Via, Mac Java Community.

You couldn't possibly be

Research May 2006: Which Emerging Technologies Make Sense For Your Company? "And we're still a decade away from the Semantic Web, according to Charles Abrams, a research director at Gartner. So how can 8 percent say they've adopted it? Abrams suggests that they may be using some XML-based specifications that involve semantics. Or maybe, says Parkinson, "They don't know what they are talking about.""

The graph shows 8% deployed, 10% testing and 25% evaluating/tracking. This makes it about as popular as Linux on the desktop and Grid Computing.

Relations in my Language

A good interview with Ted Neward (from chapter 8) about the differences and benefits of LINQ and why it's not SQL in your language.

The New OO

So now that Ruby is officially the next new thing it's time for the next level of books. Bruce Tate's From Java to Ruby or From Java To Ruby "Java to Ruby is packed with interviews of Ruby customers and developers, so you can see what types of projects are likely to succeed, and which ones are likely to fail. Ruby and Rails may be the answer, but first, you need to be sure you're asking the right question. By addressing risk and fitness of purpose, Java to Ruby makes sure you're asking the right questions first."

Monday, May 08, 2006

Continuations in JVM/CLR

Can the CLR "go dynamic"? Absolutely... and arguably, already is "Continuations are not impossible to support, however they are currently more or less impossible to support given the current lack of access to the underlying stack frames in the managed environment--you'd need some support from the runtimes (either the JVM or the CLR) to make it work. Such runtime support would not be too difficult to add, however, as both environments already have rich and powerful stack-walking mechanisms (because both environments use the thread stack as bookkeeping tools, among other things, and need to be able to crawl through those stack markers for a variety of reasons, such as security checks), and it would not be hard to create a runtime-level mechanism that allowed code to "take a snapshot" of the stack--and its related object graph--from a certain point to a certain point, and save off that state to some arbitrary location. In many respects, it would be similar to serializing an object, I believe."

A list of new features from include: invokedynamic, hotswapping, tail calls and continuations.

Saturday, May 06, 2006

Leading the Way

Semantic Breakthrough "McDonald Bradley's Parmelee agrees, saying that defining terms in an ontology is not very different from what developers do in the database world. "The same logic that goes into an ER [entity relationship] diagram or a multidimensional database allows you to distinguish between objects and relationships in an ontology," she says. "We are conducting lab experiments associated with a large data integration project in which we use the Oracle Spatial RDF capabilities of Oracle Database 10g for storing data in RDF format. This format preserves the true graph-based representation of the ontology model, rather than trying to fit a graph-based structure into a standard relational mold.""

""Oracle is leading the marketplace by embedding Semantic Web capabilities into its database, enabling computers to aggregate data and make inferences about data relationships," he says. "Oracle is in a great position here since the companies that benefit the most from the Semantic Web are large, distributed, global operations, where Oracle is already the database vendor of choice.""

Better searching, Web Services, grid computing, and enterprise integration are all mentioned as applications.

Via, Semantic Mainstream.

Wednesday, May 03, 2006

Protected is Evil

I thought I'd blogged about this before but apparently not.

So I'm a fan of both Alan Holub's articles about "Getters and Setters being Evil" and "Why extends is evil". These articles reminded me of an early book by Peter Coad called, "Java Design: Building Better Apps and Applets" which introduced this idea of composition over inheritance. Certainly a predecessor to the whole IoC bandwagon.

In fact, re-reading Holub's article it's interesting in the summary he writes: "As much as 80 percent of your code should be written entirely in terms of interfaces, not concrete base classes. The Gang of Four Design Patterns book, in fact, is largely about how to replace implementation inheritance with interface inheritance."

Likewise, Arthur Riel's, "Object-Oriented Design Heuristics" doesn't ban inheritance but offers the few cases where it is should be used.

Tony Morris (a fellow mouse) has written, "Why extends is not evil". Where he talks about interface inheritance and makes a pretty good point: "The only keyword that is exclusively associated with concrete inheritance is the protected keyword. The use of this keyword should be avoided indiscriminately."

Tuesday, May 02, 2006

Order Dependent SPARQL

Here is an example of what I consider something that can be improved in SPARQL. Using something like FOAF, you have one person that has a nick name and another that has 2 nick names and an email address.

Performing the following query:

SELECT ?name ?alias
WHERE { ?x foaf:name ?name .
OPTIONAL { ?x foaf:nick ?alias }
OPTIONAL { ?x foaf:mbox ?alias }
}

It returns 3 results - Person 1's nick name and Person 2's two nick names.

However if you did this:

SELECT ?name ?alias
WHERE { ?x foaf:name ?name .
OPTIONAL { ?x foaf:mbox ?alias }
OPTIONAL { ?x foaf:nick ?alias }
}

You get a different result - 2 results. Person 1's nick name and Person 2's email address.

Now if you use an operation that is both associative and commutative (like minimum union or disjunction even) you always get 4 results (Person 1's nick name, Person 2's 2 nick names and email address).

This is just a practical example derived from, "A relational algebra for SPARQL".

For those concerned about commercial implementations, it's true that there's no available implementation of minimum union. But it is expressable in SQL (see section 6.7).

4 Killer Applications of the Semantic Web

XML and Web Services Reference Guide "We start with a discussion of Google Base, Google's attempt at a semantic search engine, which
enables you to add information in such a way that it can be searched intelligently, with queries such as "engineering job in New York, more than $40,000 a year." From there, we move on to a discussion of Microformats, or standard representations of information you put on the web every day, such as addresses, events, and reviews. Next, you need a way to easily publish that information, so we look at StructuredBlogging, a plug-in that enables you to easily add structured data to your blog. Finally, we'll look at Live Clipboard, handy little technique that enables you to move structured information such as events and contacts from one place to another with the same ease you currently have in moving a chart from your spreadsheet to your word processor."

Also, Amazon and SPARQL.

Saturday, April 29, 2006

RDF on Rails

While searching for Ruby APIs for RDF I came across: ActiveRDF: object-oriented RDF in Ruby "Although most developers are object-oriented, programming RDF is triple-oriented. Bridging this gap, by developing a truly object-oriented API that uses domain terminology, is not straightforward, because of the dynamic and semi-structured nature of RDF and the open-world semantics of RDF Schema.

We present ActiveRDF, our object-oriented library for accessing RDF data. ActiveRDF is completely dynamic, offers full manipulation and querying of RDF data, does not rely on a schema and can be used against different data-stores. In addition, the integration with the popular Rails framework enables very easy development of Semantic Web applications."

"The development of such APIs has been attempted using a statically-typed language (Java) in RdfReactor, Elmo and Jastor. These approaches ignore the flexible and semi-structured nature of RDF data and instead:
1. assume the existence of a schema, because they rely on the RDF Schema to generate corresponding classes,
2. assume the stability of the schema, because they require manual regeneration and recompilation if the schema changes and
3. assume the conformance of RDF data to such a schema, because they do not allow objects with different structure than their class definition.

Unfortunately, these three assumptions are generally wrong, and severely restrict the usage of RDF. A dynamic scripting language on the other hand is very well suited for exposing RDF data and allows us to address the above issues."

The homepage: ActiveRDF. Uses YARS and Redland.

Recent related W3C note: "A Semantic Web Primer for Object-Oriented Software Developers".

Related previous posting: "Scripting the Semantic Web".

Update: It looks like Henry Story noticed ActiveRDF as a good idea too.

Update 2: Brian Gilman recent posting to the Life Science list links to the BioRuby project.

Wednesday, April 26, 2006

Links


  • On setters, constructors and modelling reality "In my experience there are almost no situations where a setter method is a good idea...I often see setters used where information relating to an object is not known at construction time, and needs to be added later. This is usually a symptom of choosing the wrong class to store that data...Note that just because all the fields are final and there are no setters, this doesn't mean that the object is immutable. It just means that its behaviour more closely models reality, and your interactions with it will be far more meaningful."

  • ABC Video On Demand including all your Chaser needs.

  • Agile Development: Schema Evolution "One of the characteristics of agile development is that designs are often refactored. As result, the data model may evolve during the lifetime of a project. What happens if the data model of the db4o databases is changed?"

  • Smalltalk to Java - the Good, the Bad, and the Unbelievably Ugly "The Smalltalk code was "too Smalltalky" for the translation (again, design is language specific IMHO). They had DNU handlers, descendants from nil, #perform, etc. Then there's the whole utility class issue - final classes in Java (String, Date) that would simply be subclassed in Smalltalk. Joshua Bloch, call your office :/"

  • Running Code Doesn't Lie "This statement pretty much sums up why agile software development practices like eXtreme Programming and Getting Real are so powerful. Instead of business analysts or programmers writing pages of documentation for what they think the system does, the system tells you what it does. I like to call this a Self Describing System."

  • TestDox "TestDox creates simple documentation from the method names in JUnit test cases."

  • Multi-core Processors: transputers reborn "
    In the Eighties, there were only a small number of people who were interested in fast drawing of Mandelbrot sets. The same is true today. But today, everyone is interested in having their web sites scale well in terms of performance and in terms of price. The killer application of parallel computing is all around us. It is called the Web."

Monday, April 24, 2006

Festive Flesh

Reading this about Capybara "The popularity of capybara meat in Venezuela is attributed to a 16th century theological decision by the Roman Catholic Church. Responding to queries by Venezuelan Catholics, the Church declared the capybara meat to be equivalent to fish meat, and thus allowed its consumption during Lent [1]. The decision may have been taken on the basis of incomplete or inaccurate descriptions of the capybara available to the Church authorities in Rome; but it was never reversed, and to this day the capybara is the only warm-blooded animal with that status. (This story should be treated with caution, however, since similar claims have been circulated concerning other semi-aquatic mammals, such as beavers and muskrats[2].)"

Sunday, April 23, 2006

Raving about Maven

So for every pro-Maven story I've seen I get, For F___ Sake, why does maven suck so much "On a more specific note of why I hate maven. The first one is the whole idea of maven repository. I agree that maven repo works if things are simple and the jars aren't changed that often. For all other real world cases where jars or versions change rapidly, maven often fails to update the repo. When that happens maven just craps itself. What's worse if one's network connection is buggy and unreliable. having a remote repo is worth crap when the network blows. Sure, one can setup a local repo, but what if the LAN is unreliable."

"Overriding build.properties is a bitch if one has lots and lots of properties. Say I have an EJB that is built nightly, but new branches are created every month. What if I need to test different branches on an on going basis? Well with ANT I can pass it a different build.xml file. With maven I haven't been able to find a way to do, I don't believe it can be done. It would be great if i could start maven and point it to say branch2build.properties instead of build.properites."

From what I can tell this is Maven 1, whereas Maven 2 is apparently a lot better.

Saturday, April 22, 2006

Triple Fest '06

Aperture "...is a Java framework for extracting and querying full-text content and metadata from various information systems (e.g. file systems, web sites, mail boxes) and the file formats (e.g. documents, images) occurring in these systems."

Supports: Plain text, HTML, XHTML, XML, PDF (Portable Document Format), RTF (Rich Text Format), Microsoft Office: Word, Excel, Powerpoint, Visio, Publisher, OpenOffice, OpenDocument, Corel WordPerfect, Quattro, Presentations and Emails (.eml files). Check out the Extractor API and associated interfaces.

Put all that together with stuff like Wikipedia3 and others.

The BBC's open programme information project... including Jon Pertwee in FOAF.

Friday, April 21, 2006

I Object

A response to some points in, The perils of avoiding heresy (or "What are Design Patterns") and Visitor Pattern and Trees Considered Harmful.

""21 reasons C++ sucks; 1 embarassment; and an Abstract Syntax Tree"...So if the book is predominately a catalogue of unfortunately necessary kludges around the semantic weaknesses of mainstream OO-languages, why do I still highly recommend it to new programmers?"

Design patterns are not reliant on OO, Java, C++ or any particular language or programming paradigm. It's not even reliant on Computer Science. The source of design patterns comes from architecture (Christopher Alexander) and is used in diverse areas such as dating. Grady Booch's Handbook lists 1000s of patterns, so many reasons OO-languages suck.

"Singleton. This is a global variable."

So variables and objects are not the same thing - variables lack behaviour (amongst other things). The Singleton pattern as implemented by IoC containers like Spring, Yan, PicoContainer all use Singleton as configuration on a plain Java object - so again it's not necessarily a concept in code at all.

"In a language with first-class constructors, the Factory Method Pattern consists of factory = MyClass.constructor"

This just shows a misunderstanding of the the Factory pattern - its intention is to decouple object instantiation, especially at runtime. In languages that have first-class constructors, like Ruby, you still use the Factory pattern.

An interesting discussion, Factory and Singleton are false Design Patterns?.

So the old chestnut, the visitor. "The visitor pattern is kludge used by programmers in a language that doesn't support multiple-dispatch to provide themselves with a static version of double-dispatch."

This I agree with. But the rest seems simply a rant against OO.

So Wikipedia says, "...visitor design pattern is a way of separating an algorithm from an object structure. A practical result of this separation is the ability to add new operations to existing object structures without modifying those structures."

So there's no need for multiple if-then-elses or case statements which is what happened in Python as there is no switch statement.

The Visitor pattern is not the ultimate answer to writing a compiler. It's very straight-forward for small languages, simple languages, languages where you might find changing the code and the syntax independently, etc. Having written a C compiler using SableCC I have seen the issue of breaking encapsulation - in fact most compiler implementations I've seen tend to create global state of one sort or another anyway.

The main issue with compiler compilers that I tried before SableCC (which uses the Visitor pattern) is the combination of grammar and Java code. I have similar problems with PL/SQL, JSPs, etc. This combination is also detrimental to tools like debuggers, IDEs etc. (the work that goes into JSP support in IDEs is a good example of how hard it is).

I can't think of a successful combination of the two styles, declarative and imperitive. To me it seems to always end in very poor, unmaintainable code. And through the eyes of a lemming it's much poorer than sticking within the OO paradigm.

A better article is, Translators Should Use Tree Grammars. At the end of article the author writes, "...aspect-oriented specifications as long as we are thinking about putting actions outside of the grammar. Action execution is just an aspect and each phase would be an aspect." which seems very similar to the way things like transactions and context have been implemented in Spring. It might well be that combining AOP and OOP will provide a clean solution to writing compilers.

Sharing Instances in Spring

So I had a fairly basic problem that I probably have solved before but wasn't able to remember and took some time to work out.

I had three objects A, B and C. Both B and C need to share the same instance of A. But I want to create multiple Bs and Cs – so they are not singletons. I also did not want other Bs and Cs to share the one instance of A so making A a singleton was also out of the question.

There’s several ways I came up with but none of which I was particularly happy with:
1/ Flatten out the dependencies – make C depend on B which depends on A for instance.
2/ Make A a singleton and create bunches Bs and Cs by using multiple BeanFactories.
3/ I could throw away dependency injection and let the objects using B and C construct/set-up B and C using A.

The solution that I finally settled on is creating a BCFactory (interface) that requires A, constructs B and C (in the implementation) and has getB() and getC() methods.

Wednesday, April 19, 2006

Link Parking

Monday, April 17, 2006

Spring Aspects - A Transactional Thing

I've recently been looking at transactions in Spring 2.0 - it certainly has more things to make your code sing.

The Spring 2.0 Transaction document has some useful information on using a TransactionTemplate to wrap transactional operations. Of course, the best way is Spring AOP for declarative transaction management and using Java 5.0's annotations.

There's a previous discussion of applying transactions using Spring 1.x using Hibernate in, Wire Hibernate Transactions in Spring.

Javapolis Spring Update and Maven 2.0 (see also, this Maven 2.0 article) most of talks are well worth a listen.

Articles on using the new AOP features in Spring 2.0: Typed Advice in Spring 2.0 (M2) (about finding methods in Spring AOP) and POJO Aspects in Spring 2.0: A Simple Example.

An article on JPA (Java Persistance API), Using the Java Persistence API with Spring 2.0.

Tuesday, April 11, 2006

Optimal Pair Swapping: 90 minutes

Promiscuous Pairing and Beginner’s Mind: Embrace Inexperience "It often takes days for a given pair to be comfortable enough with each other to be able to achieve Pair Flow at all. This means that pairings tend to be long. The longer the mean time between pair swaps, the less effectively pair net distributes information through the team."

"While two people are paired, they share knowledge. When the pair splits for a pair swap, the knowledge then spreads to all four participants. In this way, knowledge will slowly but automatically spread around the group."

And the surprising result:
"This makes it easy to see the shape of the curve near the 90-minute optimal point. However, we did note that longer pair times had slightly higher mean velocities."

So you think you're doing extreme XP and someone always has to crank it up one more level. 90 minutes seems pretty close to me to be the minimum period of time to actually get a chunk of work done - considering that getting work done by yourself usually requires an hour.

I was actually looking for evidence that pair programming's flow state is better/worse than normal. Specifically,
  • How much more or less is "pair flow" susceptible to interruptions,
  • Whether pairs are able to resume, after interruption, more quickly into a shared flow state,
  • Whether it's faster or slower to get into a "pair flow" state, and
  • The effects experience has on the above.

Even Flow

"Flow is a mental state of operation in which the person is fully immersed in what he or she is doing, characterized by a feeling of energized focus, full involvement, and success in the process of the activity. Proposed by psychologist Mihaly Csikszentmihalyi, the concept has been widely referenced across a variety of fields."

Alister Cockburn's Team Per Task, "It takes about 20 minutes to reach this state of flow, and only a minute to lose it. Our designers found that it took about an hour to get into flow and make progress after having been stopped. If a meeting or other task arrived during this hour, the entire period was essentially lost. As it also took energy to get into the flow, a distraction cost but energy as well as time."

Pairing to to the rescue (again). When a pair gets into a flow it's more resilient to distractions - it seems to allow one person in the pair to get back into it more quickly after being distracted. Maybe it is related to mirror neurons (video).

A Point of Difference

Reading, "Organizational Patterns of Agile Software Development" it suggests code ownership because "Something that is everybody's responsibility is really no one's responsibility". He does note some concerns related to one owner of the code including, "...tunnel vision, the implied risk of having only a single individual who understands a piece of code in depth, and a breakdown of global knowledge." as well as the bus factor and introduction of bottlenecks.

This disagreement between XP and Coplien's agile software development was noted by Kent Beck in a 1999 interview: "KB: I was talking about it with Cope [Jim Coplien] yesterday; this is our favorite fighting topic. The rule is, if you see a problem with code anywhere in the system, you fix it. So we’re sitting there with our DB40 transactions, and we say, “Y’know, if this export object over here was just structured this way, it would be really easy for us to do our stuff.” If it would clean things up else-where, we just do it."

"JV: So anybody can change anything, anywhere…

KB: Yup, absolutely. If you see it, and you got your partner there, and you’re going to run the tests within a few minutes—so it’s not like you’re going to break something—you just do it. And the system’s going to get better.

Now, I came up with this because I was working in strict individual code ownership shops, and we’d say, “Gee, we keep calling these same three methods in this object. Why don’t we just make a method in the object that calls the three methods for us?” “We don’t own that.” “But the guy’s just across the hall—” “Naah, don’t wanna bother him.”

The pace of evolution in projects that use individual code ownership, in my experience, is glacial compared to what is possible to do, in a controlled way, if everybody takes responsibility for making all the code as good as they can make it."

"JV: Has this been without pitfall?

KB: Yes. It’s just not a problem. You’ve got to have collective ego instead of individual ego. That’s the hardest problem, so that no one comes up and says, “Hey man, you changed my class.” "

See also: Ron Jefferies' Code Ownership and a list different kinds of code ownership.

Until Now


  • It's like, how much more black could this be? And the answer is none. None more black.

  • Managers smell funny or the meaninglessness of managers as class names.

  • Twin Prime Conjecture film clip.

  • Live Clipboard - Metadata Quality, Events Databases and Live Clipboard "This is the big problem with data mapping. In Jon's example, the location is called Colonial Theater in Upcoming and Colonial Theater (New Hampshire) in Eventful. In Eventful it has a street address while in Upcoming only the street name is provided. Little differences like these are what makes data mapping a hard problem. Jon's solution is for the community to come up with global identifiers for venues as tags (e.g. Colonial_Theater_NH_03431) instead of waiting for technologists to come up with a solution."

  • Exploring Live Clipboard "Like David Janes, Danny Ayers prefers URIs. Of the five listed above, the Wikipedia URL would clearly be Danny's first choice. "If there are fairly solid reference services like Wikipedia or IMDB," he writes, "then use their URIs." I'll go along with that, so long as the URIs are easy for people to invent, to read, and to write. And so long as they can function as tags in social classification systems -- which for now, it seems, they cannot. "

  • It's people committing piracy vs corporate piracy, in "Who Owns Culture?". Lawrence Lessig taking many of the themes from the book "Free Culture".

  • SPARQL now a W3C Recommendation, Sparql Calendar Demo and SPARQL2SQL Rewriter "There are rewriter-specific limitations as well, e.g. multiple/nested UNIONs, combined expressions, some of the built-ins (e.g. lang, langMatches), custom functions, and several other things are not supported yet."

Thursday, April 06, 2006

Kicking Native OSX Games in the Happy Sack

Boot Camp Public Beta As Apple now says, "Macs do Windows, too". The download page says this is a feature coming in Leopard. Boot Camp Beta: Requirements, installation, and frequently asked questions (FAQ) "Even after installling the Macintosh Drivers CD, the Apple Remote Control (IR), Apple Wireless (Bluetooth) keyboard or mouse, Apple USB Modem, MacBook Pro's sudden motion sensor, MacBook Pro's ambient light sensor, and built-in iSight camera will not function correctly when running Windows."

For some reason I haven't been able to bring myself to install it.

I found this a good summary of the issues with dual booting: "We've found that dual-boot scenarios tend to leave users spending the bulk of their time booted into one of the two OSes—typically the one that hosts the most narrowly compatible software (that is, many Windows applications).

Virtualization or terminal services work much better for enabling, for instance, a Mac OS X or Linux user to run Windows-only software.

When users lack full access to files on either operating system's partition, as is the case with Boot Camp, users will find it that much tougher for the OSes to coexist.

We'd love to see VMware cook up a version of its VMware Player for the Mac. "

Update: Easy DOS It "So Apple will at least offer the option for users to run a virtualized version of Windows Vista atop OS X, which brings with it two HUGE advantages. First, the bad guys and script kiddies will have to get through OS X security before they even have a chance at cracking Vista security. Second, by running a virtual version of Windows Vista loaded from a read-only partition, Microsoft's recommended method of dealing with malware (periodically wipe the OS and application from your disk and load them anew) can be done in seconds instead of hours and can be done daily instead of monthly or quarterly or yearly."

Tuesday, April 04, 2006

For new MacBook Pro Owners

Apple Addresses MacBook Pro Issues "According to Apple, it has begun replacing the mainboard inside its MacBook Pros with a new revision. It calls the udpated product "revision D", which is indentifiable by product serial number.

* Serial numbers starting with W8611: revision D
* Serial numbers starting with W8610: revision C

Apple said that revision D MacBook Pros have many issues addressed and improvements made, including fixes to the above mentioned issues. We were also able to get a hold of a MacBook Pro that just arrived during the week with a serial number starting with W8612, which did not exhibit any of the above issues."

10.4.6 is out, start your downloads and has fixes for Spotlight and the MacBook Pro.

There's also a new article which seems self explanatory: How to use your PowerBook G4 or MacBook Pro with the display closed.

DDD (Dog Driven Design)

From, "On the Edge": "Miner was an interesting sight at the Cyan labs. People who saw him in the halls often had to take a second look because a tiny black shadow seemed to follow his every move. The shadow was actually a little black Cockapoo named Mitchy that followed Miner everywhere."

"The dog became a fixture at Atari. Miner had a brass nameplate on his door that read, ‘J.G. Miner’, and just below it was a smaller nameplate, ‘Mitchy’. Mitchy even had her own tiny photo-ID badge clipped to her collar as she happily trotted through the halls. While Miner worked on his groundbreaking systems, Mitchy sat on a couch watching with puzzlement as her master slaved over diagrams and schematics."

"...Mitchy did most of the design on the system; much more than Jay did...Jay would draw gates, and he would look down at Mitchy and Mitchy would shake her head. Jay would erase it and draw it upside down, and try it a different way and look down and Mitchy would pant. He did design by dog."

Monday, April 03, 2006

JRDF 0.4 Released

JRDF 0.4.0 is now out. The main difference between it and previous versions is that it is for Java 1.5 and above only. Also, Tom's SPARQL query engine is in. There's also bug fixes to do with RDF/XML parsing (mainly to do with feedback from Kowari developers). There's also initial interfaces for graph and relational operations (which may change). The beginnings of an index interface (using the idea of perfect indexes) has begun (org.jrdf.graph.index package). An NTriple grammar has also been added but there's no parser as yet.

Blowing Your Mind

In pursuit of code quality: Monitoring cyclomatic complexity "This report's section labeled Top 30 functions containing the most NCSS details the largest methods in the code base, which incidentally almost always correlate to methods containing the highest cyclomatic complexity. For instance, the report lists the class DBInsertQueue's updatePCensus() method as having a noncommenting line count of 283 and a cyclomatic complexity (labeled as CCN) of 114.

As demonstrated above, cyclomatic complexity is a good indicator of code complexity; moreover, it's an excellent barometer for developer testing. A good rule of thumb is to create a number of test cases equal to the cyclomatic complexity value of the code being tested. In the case of the updatePCensus() method seen in Figure 2, you would need 114 test cases to achieve full coverage."

"Because cyclomatic complexity is such a good indicator of code complexity, there is a strong relationship between test-driven development and low CC values. When tests are written often (note, I'm not implying first), developers have the tendency to write uncomplicated code because complicated code is hard to test. If you find that you're having difficulty writing a test, it's a red flag that the code under test may be complex. The short "code, test, code, test" cycle of TDD invites refactoring in these cases, which continually drives the development of uncomplex code."

Sunday, April 02, 2006

Many Mock Frameworks

Mock frameworks - the two main ones for Java are EasyMock and JMock. My current preference is EasyMock. Largely because EasyMock is not tied to extending a test case. This allows the shortcuts to move into test utilities - a common one is a controller factory that lets you rollup the reply/verify methods into single calls instead of calling each controller separately.

Paul King, has written up a little example of Mock Alternatives describing using EasyMock, JMock, RMock and Groovy. Tom has also made his slides available from a recent talk he gave about what I'll call Mock driven design (MDD - see "Why and When to Use Mock Objects"). Take that TDD (Test Driven Developer/Test Driven Design) or BDD (behavior driven design). Much of the interesting stuff was around the discussions and shared frustrations - especially which stage people were at with respect to what level of testing various developers and organizations were at. I think it's also important to devise strategies on how to work with different levels of tests and developers.

Thursday, March 30, 2006

Sudoku SQL

Solving Sudoku with SQL "To make it even more fun for myself, I embarked on an exercise to write a program that solves Sudoku puzzles. And to make it even more challenging I decided not to write the program in the popular object-oriented fashion (Java, C++, C#, etc.) or in any of the old-fashioned procedural programming languages (Pascal, C, Basic etc); but in Transact SQL, within SQL Server 2000. Basically, I wanted to see how the features of T-SQL can be used to develop something like a Sudoku puzzle solution. I have learnt some useful things from the exercise, which I’m eager to pass on to my fellow programmers.

T-SQL is rich in in-built programming functions and features. Far from being just for holding and manipulating data, T-SQL is a programming language in its own right. Many algorithm-based problems that used to be solved with mainstream procedural or object-oriented languages can now be dealt with completely within SQL Server using T-SQL, because not only does it have the usual programming constructs such as ‘While…End’; ‘Case’ and ‘Ifs’; it also, of course, has SQL."

Related to the previous solution using OWL: Now for my Tax Return.

Vista Chicken - System/360 all Over Again

Discontent at Microsoft. "What I saw in MS was PM's pushing hard for features:
* even if it meant that the test combinations would be very large, so the product couldn't not be tested properly.
* even if it couldn't be done properly in the time allocated. After all an estimate of time was made, now all of those features mus go in the product evne if things are taking longer than expected.
* even if the product was falling apart at the seems b/c every other pm was doing the same thing.

In fact, people often played schedule chicken. It didn't matter if you were running late by the metric of the day as long as another group was running later."

"WinFS is a great example of a file system designed by lunatic engineers and inbred GPM teams (led by a totally lunatic DirPM) without a clue as to what a real customer even looks like. Complexity in the design for complexity sake is the kiss of death. Complexity without a clear, or even muddy, picture of the problem you are actually trying to solve for the actual customer is the kiss of death. Not having customers involved at every step of the design and development process is just arrogance. Believing you know better than the customer is just stupid."

Also, Exceptions to Brooks’ Law "Brooks’s Law: adding manpower to a late software project makes it later...It depends who the manpower is...Some teams can absorb more change than others...There are worse things than being later...There are different ways to add manpower...It depends on why the project was late to begin with...Adding people can be combined with other management action."

Fortune interview with Fred Brooks: "One is to officially slip the schedule. And officially doing it has many benefits over unofficially letting it slip...That is, if you're going to take a slip, get everybody onboard, get organized, and take a six-month slip, even though you may at the moment feel as if you're only four months late."

Wednesday, March 29, 2006

RDF Beanz

Robert Turner has been doing something interesting with JRDF and mapping RDF and Java together to get dynamic objects using RDF.

RDFBeans hot off the source control.

Tuesday, March 28, 2006

To be Web 2.0...

You must integrate with Google maps. Like FOAF Map.

Monday, March 27, 2006

All Code is Agile Code

Refactoring Test Code
Includes a list of code smells specifically for test code and this reason as to why test code is important: "The downside of having many tests, however, is that changes in functionality will typically involve changes in the test code as well. The more test code we get, the more important it becomes that this test code is as easily modifiable as the production code."

"The most common case for test code will be duplication of code in the same test class. This can be removed using Extract Method (F:110). For duplication across test classes, it may provide helpful to mirror the class hierarchy of the production code into the test class hierarchy. A word of caution however: moving duplicated code from two separate classes to a common class can introduce (unwanted) dependencies between tests."

Friday, March 24, 2006

Making Things Easy

Sometimes you just need a little refactoring and time to solve an issue. In JRDF you used to have to do the following to remove triples as a result of find:
iter = graph.find(ANY_SUBJECT_NODE, ANY_PREDICATE_NODE, ANY_OBJECT_NODE);
while (iter.hasNext()) {
iter.next();
iter.remove();
}

What users really wanted to do but couldn't because it would throw a ConcurrentModificationException is:
ClosableIterator iterator = graph.find(ANY_SUBJECT_NODE, ANY_PREDICATE_NODE, ANY_OBJECT_NODE);
graph.remove(iterator);

By putting this first bit of code inside of the remove(Iterator) method the operation can then be performed much more simply by the user. The only implementation issue was determining whether the iterator was from the source graph or not.

For some reason, this solution did not present itself before - I'm putting it down to the code being more consistent (mainly the implementation of the iterators). The main reason has to be though that someone asked the question, again, why did it need to be so complicated.

It seems very similar to the situations I increasingly find when you combine TDD, 100% code coverage, zero duplication and reflecting on the design. The solutions just seem to fall out a lot more easily.

Thursday, March 23, 2006

Test Drive Parameter and Member Variables

Reflective parameter names in Java 6 points to Parameter names for Java 6 (Mustang) question "My colleague Paul Hammant is asking about how we would like reflective access to parameter names to work (if it is indeed implemented) in Mustang...I wonder whether this feature, inconjunction with an AOP framework, might allow a way to introduce keyword arguments with defaults, in a similar fashion to Python and Ruby?"

The example of enhancing the IDE code completion without source is a good example too.

My view is, it's not an option it's extra metadata on classes that should always be available.

Tuesday, March 21, 2006

Words that aren't

Here are a few words that technical people tend to use that aren't in the dictionary or aren't used correctly:
* Architected - as in, "that's a well architected design" (2 millions hits on Google - architecting has 3.3 million).
* Performant - as in, "that code is so fast, it's highly performant" (over 9 million hits on Google).
* Conformant - as in, "that code passes checkstyle, it's conformant code" (nearly 8 million hits on Google).

Monday, March 20, 2006

To the Source

Derivability, Redundancy and Consistency of Relations Stored in Large Data Banks "The first part of this paper is concerned with an explana-tion of a relational view of data. This view (or model) of data appears to be superior in several respects to the graph or network model [l, 2] presently in vogue. It provides a means of describing data with its natural structure only: that is, without superimposing any additional structure for machine representation purposes."

And the easier to find "A Relational Model of Data for Large Shared Data Banks". From, E. F. Codd.

Better Printer Software

HP gets 3.4x productivity gain from Agile Management techniques "These guys are awesome - Bret Dodd and Sterling Mortensen. Last year they attended Lean Design and Development and watched my presentation. They were so impressed and felt it was such a good fit for their process for development of printer firmware that they went back to HP and plotted the historical cumulative flow diagram."

"A 10x reduction in inventory in the system. A 5x reduction in WIP. A 3.4x increase in productivity with no new money, resources, people or any change in the way software engineering (development and test) were conducted. These figures are even better than my Microsoft XIT Sustained Engineering project results. Now here is the real kicker - a reduction in lead (cycle) time from 9 months to only 2 months. Printer firmware development at HP was never this good. Imagine what this means for the people. They now go home early on Friday afternoons, they don't work overtime, they have rediscovered their social lives, their families and their passions."

WIP = work in progress.

Also, Agile Practices that Scale links to "Seven Agile Team Practices That Scale (Part I of II )". Includes: Iteration foundation (time boxed working code), The definebuildtest component team, Smaller and more frequent releases, Two-level planning (small and large), Concurrent testing (all code is tested code), Continuous integration and Regular reflection and adaptation.

Agile Journal looks interesting including "Agile Processes: Making Metrics Simple". This hits several nails on the head with definitions of code toxicity (like code duplication), hygienity (OO), and quality (bugs released).

Tuesday, March 14, 2006

XML Configuration - Howzat?

Does Wicket Suit Your Web Framework Style? "One Web framework style tends to favor external configuration over explicit Java code. Struts, for instance, relies on one or more XML configuration files to specify the flow of a Web application. While that style works well for some developers, XML files irritate just as many, who prefer to specify Web application logic in Java code instead.

According to a recent introductory article by Guillermo Castro about the Wicket framework:

[In Wicket] all the application logic falls inside the Java classes, instead of mixing it with the pages, like JSP (true separation of concerns). The Java code is glued to the HTML page by using a special wicket:id attribute that can be assigned to almost any HTML tag, and that tells Wicket where do you want to render a component. Wicket comes with several components like Labels, Links, Lists, etc., which are uniquely defined on a webpage by setting an Id to the component, and the content which is represented by a Model.

If you're using Wicket, there's only one XML you really need to modify, web.xml, and this isn't even a Wicket requirement, but rather a servlet specification requirement (i.e. you can't make a servlet work if you don't define it in the xml)."

Copious Quality Content from Copia

An assessment of RDF/OWL modelling "We conclude that RDF/OWL is particularly suited to modelling applications which involve distributed information problems such as integration of data from multiple sources, publication of shared vocabularies to enable interoperability and development of resilient networks of systems which can cope with changes to the data models. It has less to offer in closed world or point- to-point processing problems where the data models are stable and the data is not to be made available to other clients."

"This same ability to handle irregular and optional data without losing all typing and structure information is also relevant to handling change over time.

A common requirement in many system designs is to allow loose coupling between
clients and providers so that the providers can evolve over time without breaking existing clients (backward compatibility) and older providers can successfully respond to updated clients (forward compatibility).

Achieving this resilience to change is simpler using RDF/OWL than using a strict schema-validation approach, particularly due to the open world assumption."

Via, del.icio.us bookmarks for 2006-03-10.

Semantic hairball, y'all "if you had any idea how deadly seriously Big Business is taking this stuff: it's popular in terms of dollars and cents, even if it's not the gleam in your favorite blogger's eye). On one hand we have the Daedalos committee fastening labyrinth to labyrinth. On the other hand we have the tower of Web 2.0 Babel. We need a mob in the middle to burn 80% of the AI-one-more-time-for-your-mind-magic off of RDF, 80% of the chicago-cluster-consultant-diesel off of MDA, 80% of the toolkit-vendor-flypaper off of Web services. Once the ashes clear, we need folks to build lightweight tools that actually would help with extracting value from distributed information systems without scaring off the non-Ph.D.s."

Thursday, March 09, 2006

No Snappy Title

I posted this to the JRDF list but it hasn't come up on the archives - so it's here as well. I'm using this for a current project I'm doing at Uni - I don't know if it's a good topic but at least it's one I can complete in a sane amount of time and isn't completely reliant on working code.

Here's a brief description of the changes that I've made to the relational layer of JRDF. Basically, it now tries to closely follow the concepts of relations and tuples. So far, I think it's closer than previous attempts such as, "A relational algebra for SPARQL". One of the ideas that I keep coming back to is that having duplicates are indicative of using bags/multisets not sets - and RDF is all about sets. There's a whole stream of research on the power of bag languages ("Query Languages for Bags", which claims bag oriented languages can't do transitive closure for example) that I've yet to look at more fully.

Relational Tuples

Components:
  • Type name - integer, char, sno, name.
  • Attribute Name - status, city, sno, sname.
  • Attributes - status:integer, char:city, sno:sno, sname:name
  • Attribute:Value - sno sno('s1'), sname name('smith'), status 20, city 'london'
  • Heading - sno sno, sname name, status integer, city char.

Proposed Types for RDF

Basic interface:
  • isAssignableFrom - return true if the object is a super-type of the given type. Similar to Java's and Rel's.
  • getName - the name of the type.

Type hierarchy:
  • Object -> Subject -> Predicate. Meaning that Object is a super-type of Subject, which is a super-type of Predicate. This allows joining columns of different but compatible types.
  • URI Reference, Literal and BNode are all incompatible types of each other - you won't be able to join these.

They are all nodes. In the future this will allow selecting certain types or certain operations to be performed only on certain types.

Proposed JRDF Tuples

Components:
  • Types - subject, predicate, object, uri, literal, bnode. As defined above.
  • Attribute name - variable name or default name.
  • Attribute - s?:subject, P1:predicate, O1:object, P2:predicate, ?p:object, P3:predicate, ?city:object
  • Attribute:Value - s?:subject(#s1), P1:predicate(#name), O1:object('smith'), p?:predicate(#p1)
  • Heading - s? subject, P1 predicate, O1 object.


Proposed JRDF Relation

Components:
  • Heading/Attributes - set of attributes.
  • Body/Tuples - set of tuples


An aspect of this is that the heading of the relation doesn't modify the type in the attribute of the tuple. This means you always know the position of where in the graph the value came from. This used to bug me in Kowari/TKS that the underlying layers didn't know this information.

Example

Graph:
S1:subjectP1:predicateO1:object
s1#snos1
s1#spp1
s1#spp2
s2#spp1
s2#spp2
p1#city'London'
p1#city'Paris'

Query:


select ?sno ?pno ?city
...
where ?sno #sno s1
?sno #sp ?pno
?pno #city ?city

First Relation:

?sno:subjectP1:predicateO1:object
s1#snos1

Second Relation:

?sno:subjectP2:predicate?pno:object
s1#spp1
s1#spp2
s2#spp1
s2#spp2

Third Relation:

?pno:subjectP3:predicate?city:object
p1#city'London'
p2#city'Paris'

First and Second:

?sno:subjectP1:predicateO1:objectP2:predicate?pno:object
s1#snos1#snop1
s1#snos1#snop2

First and Second and Third:

?sno:subjectP1:predicateO1:objectP2:predicate?pno:objectP3:predicate?city:object
s1#snos1#snop1#city'London'
s1#snos1#snop2#city'Paris'

After Project:

?sno:subject?pno:object?city:object
s1p1'London'
s1p2'Paris'

Overcoming the problem with static methods in Java

There's a number of possible solutions that I've recently had the opportunity to see other people try in test driving static methods. Generally, when I've come across it it's been a refactoring job.

The general process is: create interface and change the statics to be just normal member variables on the class.

The problem is when it's something you can't change, for whatever reason.

If you've been left the chance to extend it you can simple add methods that wrap the statics and base these new methods on an interface.

If you're unable to extend it then you create a wrapper (or boundary) class and a matching interface.

Graphing Gaffs

Five Signs of Trouble in an Iteration "During the course of an iteration, an agile team is able to track it's own progress through the use of burndown charts. The team and the process facilitator can use the burndown chart to watch for signs of trouble. As a coach, I find the following five burndown shapes are common indicators of trouble."

The sixth one I would put down to doing work, like refactoring, test utilities and the like, and then making the expected work less.

Data and Metadata

Hysteresis, History and empty metadata fields "Hysteresis occurs whenever the effect that accompanies some cause is delayed for some reason. The term is most often associated with processes in the physical world. The movement of interest rates, the growth of insect populations, the rise and fall of magnetic fields, that sort of thing."

"There is a hysteresis-based relationship between content and non-trivial metadata about the content."

"Writers write and categorizers categorize. There is an unavoidable delay between the two activities. The writers and the categorizers can be the same people but the activities are very different and cannot be done at the same time. Build this hysteresis into your workflows rather than fight against it. The alternative is blank or dummy metadata fields."

Riki

KaukoluWiki "KaukoluWiki is a Java-JSP-based Semantic Wiki that manages its data by using Semantic Web tools.

The main reason for developing such a Semantic Wiki was the fact that most Web pages lack machine-readable semantics, i.e. means to include the meaning of a certain piece of data in a formalized representation. This is the reason why automated integration of knowledge and reasoning over this knowledge is not possible yet."

Via, gnowsis 0.9 technology preview.

Wednesday, March 08, 2006

Still Evolving

Still Evolving, Human Genes Tell New Story "Some are genes involved in digesting particular foods like the lactose-digesting gene common in Europeans. Some are genes that mediate taste and smell as well as detoxify plant poisons, perhaps signaling a shift in diet from wild foods to domesticated plants and animals."

"Dr. Pritchard's test for selection rests on the fact that an advantageous mutation is inherited along with its gene and a large block of DNA in which the gene sits. If the improved gene spreads quickly, the DNA region that includes it will become less diverse across a population because so many people now carry the same sequence of DNA units at that location."

Via Slashdot.

More on Benefits of Pair Programming

A slight dated bibliography on Pair Programming.

A Pair Programming Experience "The error analysis showed the project had achieved an error rate that was three orders of magnitude less than normal for the organization. Integration of the first two components (approximately 10,000 source lines) was completed with only two coding errors and one design error. The third component was integrated with no errors. The remaining three components had more errors, but the number of errors for these components was significantly less than normal."

Also, linked via Pair Programming.com.

Wednesday, March 01, 2006

XP Sunscreen

The New XP "...nature continuously uses fractal structures, which are similar to themselves but at various scales. The same principle should be applied to software development: we should be able to reuse similar solutions, in different contexts."

Or as Greg says, "Only by pursuing code reuse in the small will you ever achieve code
reuse in the large."

"Software defects must be looked for, found and fixed in many ways (pair programming, automated testing, sit together, real customer involvement, etc.). This is redundant, because many defects will be found many times. However, quality is priceless."

"...quality must be always at maximum. Accepting a lower quality does not yield neither savings, nor faster development. On the contrary, improving quality necessarily makes an improvement of other system features, like productivity and efficiency. Moreover, quality is not only an economic factor. Team members must be proud of their work because it improves team self-esteem and effectiveness."

"It is easy to order to developers “Do this”, or “Do that”, but it does not work. Unavoidably, you ask less than what could be achieved or, more likely, more than that can be accomplished."

Natural Enemies of XP

The corner desk...

Meta-system

The Most Important Idea in Computer Science links to two Alan Kay articles. The most interesting, "A Conversation with Alan Kay", "So the problem is—I’ve said this about both Smalltalk and Lisp—they tend to eat their young. What I mean is that both Lisp and Smalltalk are really fabulous vehicles, because they have a meta-system. They have so many ways of dealing with problems that the early-binding languages don’t have, that it’s very, very difficult for people who like Lisp or Smalltalk to imagine anything else."

"I feel like my answers are quite trivial since nobody really knows how to design a good language, including me."

Punny

The semantics of BYO… "As more wine makers switch away from the venerable cork stopper to the more pragmatic yet unromantic screw-top cap, I wonder if BYO restaurants will start to charge ‘torque-age’ instead of ‘corkage’?"

Fully Covered for Quality

In pursuit of code quality: Don't be fooled by the coverage report "I'll say it one more time: you can (and should) use test coverage tools as part of your testing process, but don't be fooled by the coverage report. The main thing to understand about coverage reports is that they're best used to expose code that hasn't been adequately tested. When you examine a coverage report, seek out the low values and understand why that particular code hasn't been tested fully. Knowing this, developers, managers, and QA professionals can use test coverage tools where they really count -- namely for three common scenarios:

* Estimating the time to modify existing code
* Evaluating code quality
* Assessing functional testing"

Also a previous article, Measure test coverage with Cobertura ""The general philosophy is this: if it can't break on its own, it's too simple to break. First example is the getX() method. Suppose the getX() method only answers the value of an instance variable. In that case, getX() cannot break unless either the compiler or the interpreter is also broken. For that reason, don't test getX(); there is no benefit. The same is true of the setX() method, although if your setX() method does any parameter validation or has any side effects, you likely need to test it."

I don't agree. I've lost count of the number of bugs I've found in code that was "too simple to break." It's true that some getters and setters are so trivial that there's no way they can fail."

"In theory, there's no guarantee that writing tests for uncovered code will reveal bugs. In practice, I've never seen it fail to find them. Untested code is full of bugs. The fewer tests you have, the more undiscovered bugs lurk in your code."

Both talk about a free code coverage tool, Cobertura.

A recent thread on the AJUG QLD list.