Friday, April 29, 2005

Tiger Disappointment (not for long though)

> java -version
java version "1.4.2_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_07-215)
Java HotSpot(TM) Client VM (build 1.4.2-50, mixed mode)


No download, no update, no Tiger on Tiger.

UPDATE: Found these links: Java 2 SE 5.0 Release 1 and Java 2 SE 5.0 Developer Documentation on the Apple Java mailing list.

Thursday, April 21, 2005

JMock Invocation Order

After many fruitless Google searches I finally found an example (on the JMock site no less) on how to ensure invocation order of methods:
"logger.expects(once()).method("setLoggingLevel").with(eq(Logger.WARNING))
.id("warning level set");
logger.expects(once()).method("warn").with(warningMessage)
.after("warning level set");
logger.stubs().method("getLoggingLevel").noParams()
.after("warning level set")
.will(returnValue(Logger.WARNING));

A rule of thumb to follow when specifying the expected order of method calls is: test the ordering of only those calls you want to occur in order. The example above allows the warn and getLoggingLevel methods to occur in any order, as long as they occur after the call to setLoggingLevel. Thus we can change the order in which our tested object calls warn and getLoggingLevel without breaking our tests."

So the ".id("warning level is set")" sets a property that the second and third calls check with ".after("warning level is set")".

EasyMock makes it easy by allowing you create a strict type of control object: "If you would like a "strict" Mock Object that checks the order of method calls, use MockControl.createStrictControl() to create its MockControl."

Sunday, April 17, 2005

The Metadata Schema Data OS (MSDOS)

Core Data is the most recent article added to Apple's developer connection - the user interface generation is pretty neat: "We've mentioned that you can use Cocoa bindings to connect a Core Data managed object context to your application's user interface. However, early in an application's development life cycle when you are exploring what kinds of objects you need to capture in the data model, you can take advantage of a new feature of Interface Builder that will create prototype interfaces for you. All you need to do is Option-drag an entity from the Xcode Data Model design tool onto a window in Interface Builder and a comprehensive interface will be created for you."

Although think what you could do if the UI and the data used the same data format, like RDF, instead.

Also, spotlight and automator. A review of Tiger fom Supersite for Windows.

And it maybe time to start learning Object-C with things like categories: "Categories allow us to split up a large class into several pieces. Each can be developed and created independently, and then brought together at the end to form the class.

As a consequence however, this allows us some nice advantages. We can, in essence, extend the functionality of any class that may fall into our hands, whether it is in a class you create yourself, or in a binary form, such as in the OPENSTEP/Cocoa/GNUstep frameworks, we can add a category to NSString to provide functionality that the original NSString did not provide. It is possible to even add categories to Object! Categories can also be used to override previous functionality, which allows us then to "patch" these preexisting classes also, which might be provided with a bug."

Saturday, April 16, 2005

How to Ensure the Java you Write is Procedural

Step 1, remove inheritance. Articles such as "Why extends is evil" should give enough ideas as to why you should never, ever use inheritance.

Step 2, destroy encapsulation. Make it easier and accepted to create data objects. For example, use something similar to EqualsBuilder but make it a replacement to java.lang.Object and use reflection to determine things like equality. This also leads to continual usage of getter/setter. Pass these objects around to the other "doing objects".

Step 3, prevent polymorphism. Call something IoC but instead of the usual idea only allow one implementation of a particular interface to exist. Sort of like a .h file and a .c file. This not only prevents multiple implementations of an object but also multiple instances. Great for the "doing objects".

Friday, April 01, 2005

Uniqueness and an Open World

Unique Name Assumption "He cites an OWL Flight paper that caused me quite some headache a few weeks ago (cause there was so little in it that I found to like)...There was an OWL requirement that gives a short rationale for the UNA, but it seems it is not yet stated obvious enough."

The main problem was that the expression of this did not seem to be sufficiently addressed - especially as it is such a basic concept and that there wasn't a simple concrete example (unlike the Cain/Kain and Able one given).

The initial problem was cardinality and OWL Flight attempts to solve the problem with cardinality. Paul put it succinctly: "So what is the point of statements with the owl:minCardinality predicate? They can't ever be false, so they don't tell you anything! It's kind of like a belt and braces when your belt is unbreakable."

"OWL-Flight and proponents of UNA actually forgot that it's a Semantic Web, not just a Semantic Knowledge Base. If you want UNA, take your Prolog-engine. The Semantic Web is more. And therefore it has to meet some requirements, and UNA is an astonishingly basic requirement of the Semantic Web. Don't forget, you can create local unique names if needed. But the other way would be much harder."

The statement of the problem and a solution seems to be better explained elsewhere and I did comment that the resolution, local unique names using AllDifferent, didn't actually seem to solve the problem well enough (without consideration for scalability for example). I have a feeling that context is a better solution to this problem (that might just be my golden hammer though).

"Still, Andrews arguments lead to a very important question: taking for granted that Andrew is an intelligent guy with quite some experience with this kind of stuff, how probable is it, that Joe Random User will have really big problems with grasping such concepts as non-UNA? How should the primers be written? How should the tools work in order to help users deal with this stuff - without requiring the user to study these ideas in advance?

Still a long way to go."

I would agree - this was my main problem - how do you explain to Joe (and Andrew) that all his CDs are the same rather than different. In Joe's experience things are usually different until you start comparing them and then he finds similarities (or like Ernie putting away toys). This is a good example of why the Semantic Web is not AI - it's not trying to emulate the way people think.