Spiral Dive

  Saturday, November 30, 2002


On Prevayler.

It works well for the simple case...single app running in a VM. It gets more difficult when you extend out into a distributed environment. I constructed something similar to Prevayler for interconnecting peers. Essentially each peer would attempt to keep its data model in sync with all the others. I used a time-ordering protocol to do this -- commands to change the data set were broadcast to each connected peer, which would reorder the the command set so each peer would have the same set of commands, in the same order.

Things get dicey when you want to synchronize -- where, exactly, do you do that? You need to have voting mechanisms to resolve conflicts amongst the connected peers in the group. Vote for snapshot point, vote to claim the earliest mutable command, etc...

When you're reordering commands you need to do a lot of undoing and redoing. If you want to insert a command somewhere in the past, you need to undo enough to get back to that point, insert the command, then redo as appropriate. There are definitely more optimal ways to do this; I just haven't really explored them yet.

In summary: Prevayler good -- but now do the distributed case!
12:00:33 PM    


  Friday, November 29, 2002


Blocks vs. Functions
There's been a bit of writing on blocks lately.  I think blocks are cool, but I'd much rather see a more general purpose functional construct added to Java.  In functional languages you have the notion of a thing that returns a value of a given type.  This is really handy for doing, well, just about everything.  It's desperately missing from Java.

class ACollection {

   // Declares a function signature...pretty much like a typedef
   public int function WorkOn(Object parm);

   // Shows how we can declare a function that takes another function
   // as an argument
   public int function SecondOrder(Object testMe, WorkOn work);

   // Declares a function that takes another function as a parameter
   public int apply(WorkOn work)
   {
      int total = 0;
      for (int i = 0; i < array.length; i++) {
         total += work(array[i]);
      }
      return total;
   }

   // These should be call compatible -- the compiler should be
   // able to automatically make this work.
   public int memberWorkOn(Object parm)
   {
      // do something with parm
      return 4;
   }

   public void printer()
   {
      int total = apply( function WorkOn(Object parm) {
         System.out.println(parm);
         return 1;
      } );
      System.out.println("Total is " + total);
      // Can also do this:
      total = apply(memberWorkOn);
   }
}

That's just off the cuff; don't put too much stock in it.  The point is that functions are first order objects that can be passed around like any other.  Note that there are two kinds of functions: Those that stand alone, and those that are really member functions of an object.  Back in the day Delphi had both kinds -- the combination of a this pointer and a function pointer was called a closure.  If we're going to do something like this in Java we need to have seamless support for something similar; that's the point of the memberWorkOn you see above.  The compiler can either generate the necessary closure, or create a simple one-time stub function that knows how to call the object.

When creating a new function inline we will really want to have the context that surrounds the function available to us.  What is the best behavior to have here?  The only thing I can think of that will really work is to provide a copy of the functions context.  Can we really have the function block doing things that will modify the context it comes from?  That's a pretty big can of worms.  A copy means that we don't have to worry too much about it.  Or, we can just check for the variables that are actually used by the inline function, and make sure those are initialized correctly.  A change to any of those variables is not reflected in the surrounding environment.


3:43:43 PM    

Coffee and a notebook.

I've become more and more sensitized over the past year to my ability to think. There are certain patterns that help, certain things I can do that bring out the creativity. Then there are the times that even those things don't work.

Right now I need the creativity. I am trying to conjure up rules that will infer things that don't look inferable. My hope is that by surrounding the situation with an adequate number of small-scale rules I'll create some sort of emergent behavior. It feels like a bet in a casino. But it's paid off so far.

The bottom line is that the farther I get into my life the more I feel superstitious about what works and what doesn't, for my concentration level. It almost gets self-defeating: If I don't get enough sleep, I'll just know that I'm going to have a bad day, and that becomes the self-fulfilling prophesy.

We have to refactor ourselves sometimes; not just our code.
10:48:14 AM    


On java.blogs.

Here are a few thoughts. Communities that grow as quickly as this one has are in dire need of organizing mechanisms. There's quite a bit of information showing up on java.blogs already, and not all of it is related to Java. I'd like to encourage those who can to create a separate channel that consists solely of their Java-related content. Radio Userland makes it easy.

I'm a big believer in the promotion of ideas of merit. Some form of scoring or rating system would be a great addition to java.blogs. It doesn't have to be particularly sophisticated -- just allow users to tag the blogs that they find particularly good, and the cream will come to the top. Provide separate feeds for the top, middle, and bottom tier blogs.

It's not that I think poorly of what I've seen: I just think that the megaphone has to be earned. There is clearly some good thinking going on...let's highlight it!

Thanks to the Atlassian guys for making the effort to set all this up.
9:14:10 AM    


  Thursday, November 28, 2002


My Java.

Since everyone seems to be putting out their wish lists for Java, I thought I'd contribute mine. It's pretty short, though.

First, I'd like to see simple enumerations and sets, a la Pascal. Pascal is one of the most readable languages for a reason -- its enumerations and sets are a big part of that. Why modern languages have become so miminal is beyond me. There are some things that are just extremely general and useful. They shouldn't be removed simply because we can find another way to do them.

Next, let's get first class functions (or blocks) into the language. I've see at least one proposal floating around for that, but I'd have to say that I didn't really like it. It confused function calling notation with block calling. There's probably a better way.

I'd like to see the VM pushed strongly in the direction of being more language independent. The CLR has a big advantage in this area -- Sun really needs to get it together here. We should be able to construct IDEs that do just what is done with .NET -- multiple languages can be plugged in and used with a common toolset.

I'd like to see aspects or their equivalent built into the language. Any sufficiently complex application will end up writing its own versions of crosscutted functionality. We might as well have it in the language. Yes, it's overkill for the little programs. So what. It won't be for long.


11:21:30 PM    


  Wednesday, November 27, 2002


On Java vs. C#.

Language evolution doesn't interest me all that much. I think that Java could be substantially improved by having enumerations, basic set logic (a la Pascal), an attribute mechanism, and so forth...but that's not the real issue.

My company sells one of the more complex Java applications on the market today. It's got a few million lines of code in it, reaches out to dozens (and sometimes thousands) of systems while it's running, is servicing hundreds of users simultaneously, and is generally doing a crapload of work.

Such a thing usually deserves a lot of OS-like features. Java is a cross-platform place to program simple applications; it starts to fall down pretty badly in the large. The VM needs to have walls that can be set up between various programs. It needs to have the ability to set resource limits on threads. Scripting systems need to cooperate with this -- one of the most difficult things we've had to deal with is the proliferation of scripts (run in JavaScript/Rhino) that are running inside our application. They gum up the works!

The bottom line -- make the Java VM more managed, with better divisions and walls. That's what's on my Christmas list.
4:29:56 PM    


Thanksgiving

Sigh. I think this is many years now that I've been here for American thanksgiving, freeloading off of a friend or two for some turkey. Most years I just miss the Canadian one; it's always bad timing to try and go home. Christmas is just around the corner anyway. So every year at this time I feel pressed to the window, looking in...

At least the food is good. And because my mother isn't looking, I can watch football with my friends if I want to!
3:01:05 PM    


Extrapolation

Building an expert system is tough. The things that you want to be able to conclude are things that seem like they would "just make sense", but when you actually try to build the rules that form a conclusion, it becomes another game entirely. At the same time, unexpectedly easy conclusions arise from the data you have.

Rule systems create a kind of emergent behavior, where you define hundreds of small rules that perform specific transformations on a knowledge model. Those small rules interact to do much more interesting things on the macro scale.

Most of my work these days involves figuring out good knowledge representations and the kinds of transformations that can be performed on them. If you haven't looked at this stuff before, you owe it to yourself to do it. Most of your program logic shouldn't where it is. It should be coded in rules.
2:34:58 PM    


  Monday, November 25, 2002


Web Advertising.

They keep saying that it doesn't work.  I really don't mind seeing banner ads on web sites.  I like them; they're so unobtrusive compared to most other methods.  It's been said over and over again that web advertising doesn't work.  I can tell you what the real problem is. 

Start showing me ads that I actually care about. 

I am not interested in your stupid casino.  I am not interested in all this untargeted crap.  I am perfectly willing to make my "profile" accessible to a site, so that targeted ads can be delivered to me.  Such a profile would consist of subject areas that interest me. Believe it or not, I actually want to see ads about new products in areas that I find of interest.

What the world needs is an uber-cookie; something that has an ontology appropriate for advertising...something that can tell these dumb-ass web sites what kind of ads I would find appealing and actually consider clicking through.  Maybe somebody's already tried this -- I just don't see it really happening unless the King Of All Browsers begins to support something like it by default.

As a parent, I could indicate that no adult ads are to be given to me.  As a technologist I can request ads on Java tools.  As as farmer I can find out about bovine sperm.  Or maybe that'll violate the first one.  I don't know.

The bottom line is that I know that somebody out there has thought of this.  Why isn't it a reality yet? 


3:19:29 PM    

  Sunday, November 24, 2002


Learning.

I'm really tired right now.  I've had an exhausting day, doing just one thing -- being out in airplanes.  My lesson started this morning at 8am, which means leaving my place by 7am, which means getting up at 6:30.  Too early for a Sunday, I think.

The real adventure happened afterwards -- I went with a friend to Cape May.  On the way back we had a hell of a lot of haze, and we were flying straight into the sun.  Our altitude was around 4500...outside air temp was 2C. 

The experienced pilot will recognize that this is a carberetor icing situation, and that's exactly what happened.  We noticed the engine RPM steadily dropping...time to apply carb heat.  It was a bit nerve-wracking because it happened over the Chesapeake Bay. 

I'd say that with the sun it wasn't the best day to fly.  I need to buy some sunglasses that are going to cut that glare and make it more pleasant. 

The flight made me think about the consequences of screwing up when you're in the air.  If I continue to fly, I better do things right -- no exceptions.  There isn't much margin for error.


11:10:52 PM    

  Saturday, November 23, 2002


Evil Powers.

I think when the government uses certain powers and capabilities in investigations, they should lose the ability to prosecute some crimes.

I don't know about you, but I get a little scared when the guvment decides that the list of powers they need to fight terrorism is really quite extensive.  History is littered with examples of countries that decided to just hand power over to the government...wasn't this country founded on the notion that it's a bad idea?  The constitution is really supposed to mean something. 

The "just trust us" mentality of the people in power is highly inappropriate.  At some point the governing authorities in this country need to be subject to laws and limits themselves.  Being able to jail someone for the rest of their life simply by calling them an "enemy combatant" is an act that belongs in a dictatorship, not in the seat of democracy.

What the government is asking for now is the ability to use intelligence assets to aid domestic investigations of terrorists.  The problem is that the threshold for defining terrorism is completely arbitrary.  The products of these investigations can be used by the government in many ways, against its own citizens.  This is not an area where we should simply trust the powers that be.

Back to my point -- what should the government lose?  Each technique of investigation has an associated cost to privacy and dignity for citizens.  If the government orders a wiretap in the course of a "terrorism" investigation, I think they should lose the ability to prosecute any evidence gained of minor crimes.  By invoking their ability to wiretap, they automatically grant a measure of immunity to the target.  As successively more invasive and questionable tactics are used by the government, they give up more and more of their ability to prosecute for offences based on what's found -- with the most invasive techniques only the most serious of crimes would be prosecuted.

This rule should not be subject to limitations -- if you, as a government agent, invoke an extra-constitutional mechanism or use information derived from military assets, the government permanently forgoes the right to prosecute that citizen of any minor crime commited prior to the date of the surveillance.

That will at least give us a chance of keeping our law enforcement out of temptation's way.

It's not that I have a poor opinion of law enforcement; I don't.  But a recent run-in with local police (and I have never had anything but a completely professional interaction with police officers) has convinced me that, well, there's a good reason for the constitution and the case law to say what they do.

I hope you think so too.  Otherwise...


7:21:15 PM    

Saturday Morning.

Let the arguments begin!  The only time the senior folks in the company can get together and have a proper product discussion is this morning.  Tedious but necessary...


11:06:43 AM    

Crosscutting Knowledge.

When you're building an ontology you tend to get lots of multiple inheritance.  You'll have an object that is one of those, plus one of those, and still yet one of those.  It's irritating.  When dealing with rule systems, you need to be able to use inheritance quite a bit -- there are large swaths of logic you want to apply to all similar objects, but in this case, well...similar doesn't just adhere to extends.

I am producing aspects, where I declare entities, then link aspects to them.  The problem is that I get around one part of it (I can attach any aspects I like to anything I like), but hit smack into another: I really want to use inheritance on my aspects.  As in, some aspects are extensions of other aspects.  And then, of course, I found that I wanted to use multiple inheritance on my aspects.  Does it ever end? 

You are in a twisty maze.


1:28:46 AM    

Warm Hum.

I just pulled out Pat Metheny's Road to You.  It's a connection back to my university days -- so beautiful to listen to, so calming.  It's been a stormy week.

Connections are mostly what I'm thinking about right now.  When we know one thing has to have a connection to something else, we usually know more than that.  We can characterize the connection with constraints, and when something else comes along that looks right, we can begin to make the connection real.  We can start out with low levels of confidence, and increase them slowly.  There's a lot about the world around us that responds to simple pattern matching. 

Like when you find your stride in your life, or your career.  Things that give you pleasure to think about.  It's about figuring out your own constraints on the connections you need to make in your life, with those around you, and to the work you need to do.  You'll never make a mark if you are firmly connected, constrained...needing to do it.


12:02:24 AM    

  Friday, November 22, 2002


You got it all wrong.

Computer makers need to simplify their products and reduce crashes and conflicts among programs. As long as the industry gives nerds who think about computers 24 hours a day the final say on products headed to market, they're going to have stagnant sales.

The computer industry isn't suddenly stupid. it has always been stupid, conducting business by nerds for nerds year after year. Now they wonder why people aren't rushing out to buy the newest, fastest machines. The faster machines will crash just as often as the ones sitting on everybody's desks! Forget about speed—give us reliability.

--Warren Jamison, PC Magazine, December 3, 2002, p. 57

With all due respect, Warren, you've got it all wrong.  Most crashes and conflicts amongst programs happen because the non-nerds in the company push the damn thing out the door too soon!  But I do agree about new machines -- they're just not as necessary as they once were.  Many of the most common tasks we used to do on computers would take what seemed to be forever...buying new machines was keeping up, and making your existing life better.

For a couple of years now, it simply hasn't mattered.  I do some pretty cutting edge development, and I do it on a three year old laptop that hasn't seen a single upgrade.  I'm getting to the point now that I'd like something new, but that's mostly because the case is getting busted on the side.  I don't need it to be much faster than it is.  I'd like it to be, but I don't need it to be.  Except when I'm running Oracle's JDeveloper.  That thing is a dog.  I take back what I said.  Please give me a faster laptop.


11:58:12 PM    

Bits and Pieces

I just picked up the NaturallySpeaking 6 software recognition product. Seems to be working really well. So I suppose now I'll be of the dictate at least part of my wedlock.

So I suppose now I'll be able to dictate at least part of my Web wedlock.

So I suppose now be able to dictate at least part of my wedlock.

I guess I need to teach it with the word weblog means.

I guess I need to teach it what the word weblog means.

I guess any to teach it what the word weblog means. Sea of the accuracy improves? See how the accuracy improves?

I have the feeling this is going to be a long process.


8:00:19 PM    

  Thursday, November 21, 2002


Someday

Someday the rest of the world will realize that the beautiful future consists of hierarchical, bitemporal knowledge spaces, with intelligent endpoints pushed into them, probing and influencing the statements within, functioning with partial knowledge, pattern matching to trigger rules that run fast inside a RETE network...and it's all sewn together with asynchronous messaging and a leasing model.

Yeah, someday.

 


12:41:19 AM    

  Wednesday, November 20, 2002


Trick Rules

The thing about rules is, they're pretty hard to debug.  You know what you want, but there are a lot of gotchas on the path.  I think I'm getting better at writing them...but I've got a long way to go before I'd consider myself to be an expert.  Jess is pretty cool; I especially like the view command, which lets me see the network of nodes that my rules are generating.  Now if that was annotated with sizing information, I'd be even better off...I could see the weight of each node, understand its system impact better.

What matters in expert systems is what you don't know.  But sometimes you know that you don't know something, and that lets you reason about it.  And maybe later on you can prove that it's the same as something else.  I have a little set of techniques that do these things now.


10:57:02 PM    

Stupid Chain Stores

Don't you hate it when you find something that's almost what you want at a chain store?  First, you hate yourself for being there.  Then you get annoyed that the buyers for that store can't seem to get it right.  Then you get annoyed at the zillions of people who must be buying the crap that isn't right. 

Almost.


2:54:35 PM    

Automatic Layout

Is there anything cooler?  I've been examining the various viz systems out there for Java: Tom Sawyer, JLoox, JGraph, ILog, YFiles.  The commercial ones all have one main thing in common: They're expensive.  Not in the "how much would it cost you to develop this yourself sense", but in the "damn that's quite a bit of money" sense.  So far I like YFiles the best -- looks like good engineering, very fine results in the layout.  Poor documentation is a major minus for it, though.  Tom Sawyer has amazing documentation, but the price!  Ouch!  JLoox falls somewhere in the middle.

Most of these kits do a variety of things.  They take a graphical presentation layer, add dynamic capability to it, then blend in automatic layout.  YFiles seems to be more oriented around the layout task than the others.  I just like how its code hangs together -- it just looks good.  Very fast response from the author when I ask dumb questions, too.  I hope to send him a screenshot or two soon, so he can see what I've done with it.

Things I'm thinking about: Network discovery, layouts, service views, and inferencing.


10:09:19 AM    

I did math.

I just did some math.  Not complicated math.  Really simple stuff.  Like rearranging equations and trig and things like that.  It took me three tries to get it right; my equation-handling skills are pretty atrophied at this point.  Still, I got the job done.  The problem was simple: If you want to put n circles of radius r inside another larger circle of radius R, and have them touching each other, what is the value of r given R and n?

Like I said, it took me a while.  I'm glad to see that the laws of mathematics still apply in the Bush era.  At least, they do on paper.

So I have my pretty rings all displayed in a pretty form, nice hit-testing, and TreeModel compatibility.  Over the next few days I'll refine the algorithm for display, try to do some LOD, and figure out a good mechanism for showing what's under the cursor. 

The idea is to produce a nice circular layout that's plug-compatible with JTree.  I don't know if I'll get the whole way there because in a circular layout you can't retain the desired order if you want to use more than one ring to represent a level of a tree.  Otherwise, you can.  What I'll probably do is retain as much of the order as I can.

Time to sleep -- much work to get done tomorrow. 

Automatic layout and visualization is interesting!


1:22:45 AM    

  Tuesday, November 19, 2002


Running is good for you.

It's been good for me.  Two miles, three times a week is all you need to do.  I've been doing it for six months now -- I lost 15 pounds, feel more energetic, and I can wear all my old clothes again.  Good for me.  You should do it to.  Start by buying a $100 pair of shoes.  Get clothing that's warm enough.  Be comfortable.  Don't run if it hurts.  Just walk whenever you feel like it.  Do it three times a week.  You'll be doing a few miles in no time.


9:10:59 PM    

All the Java IDEs.

Everything seems to do at least one thing well.  I haven't hit one that does it all.  Here's my toy set:

  • Together/J for the model.  Can't beat this.  Everybody who's raving about refactoring support anywhere has yet to see what TJ does.  Bring your checkbook.  Thank God I got in on the ground floor.
  • NetBeans for clean 1.4 development.  I am starting to like it more and more.  Pretty fast now, rapid advancement.  Good GUI editing.  Love the fix and continue.
  • Eclipse for the very fast UI.  Someday this is going to be really cool.  Some guys I went to school with wrote some of it, so there's the connection.
  • JBuilder for...well...work stuff.  All our projects (like, 60 of the them) are JBuilder-based right now.  We have an ANT build, like everything else on the planet, but JBuilder is my mainstay.  Bad dependency checking in 7 bugs me.  Borland's upgrade policies have pretty much guaranteed that my company will be looking elsewhere.
  • JDeveloper has built-in profiling.  Pretty solid; friends say that they love the stability.  For me, it's too slow.  It's agonizing to wait for code completion on big projects.

That's a lot of toys to have in the box.  The best thing about Java is, with one decent project structure I can switch back and forth between all of these tools effortlessly.  Designing?  Go to TJ.  Debugging?  NetBeans.  Refactoring?  TJ again. 

Hey -- I guess I pretty much just use NetBeans and TJ these days. But it's fun to track the others.  I think it's fantastic that we've got so much choice. 


9:03:45 PM    

[James Strachan's Radio Weblog]

An interesting read. OO is a great way to build software but I do think we tend to look at things with OO rose tinted glasses sometimes. Things like object databases and distrbuted objects can often be a leaky abstraction. Sometimes we should just treat data as just data. 

Typically data comes from databases or remote services which requires runtime marshalling and typechecking anyways - so much of the compile-time benefits of using typesafe objects are often moot. It can often simplify development, particularly of front ends, to keep the data seperate from the business logic and use something like DynaBeans as an AOM style API to your data.

Non-OO is what I've been thinking about for quite a while.  But OO models do some pretty interesting things for us, and we don't necessarily want to lose that.  The key thing I've realized is that object models provide good design-time flexibility, but provide very poor runtime flexibility. 

The neat thing is, OO breaks down cleanly into statements.  Remember LISP?  Prolog?  CLIPS?  That, my friend, is the wave of the future.  Tuples (or statements) are such clean, interesting things.  They're easy to move around a distributed system.  It's easy to construct just about any kind of metamodel you want.  You can easily run multiple metamodels in parallel.  In short, it's the flexibility that we've always wanted.

The downside is exactly the same as the upside: Flexibility.  It's almost too easy to do too much.  And it can get confusing.  When does something really mean something?  Where does the data end and the model begin?  Just like in LISP, where the program is the data is the program.


8:34:49 PM