<< July 2003 | Home | September 2003 >>

The Elusive Separation of Layers

Writing business applications used to be easy. Something like this will do:

Application
  Init:
    con = SqlConnect("server", "username", "password")
  Window:
    Menu:
      Exit:
        Quit()
    Field:
    Button:
      Clicked:
        SqlExec(con, "update table1 set column1 = :Field")

Then they said, "We need to separate business logic from the presentation logic." So we change:

Application
  UI:
    Init:
      BO.init()
    Window:
      Menu:
        Exit:
          Quit()
      Field:
      Button:
        Clicked:
          BO.Action(:Field)
  BO:
    Init:
      con = SqlConnect("server", "username", "password")
    Action(Field):
      SqlExec(con, "update table1 set column1 = :Field")

Then they said, "We need to separate business logic from the data access logic." So we change:

Application
  UI:
    Init:
      BO.init()
    Window:
      Menu:
        Exit:
          Quit()
      Field:
      Button:
        Clicked:
          BO.Action(:Field)
  BO:
    Init:
      DA.init()
    Action(Field):
      DA.Action(Field)
  DA:
    Init:
      con = SqlConnect("server", "username", "password")
    Action(Field):
      SqlExec(con, "update table1 set column1 = :Field")

They also said a lot of other things: "use a web server, turn UI to HTML", "use an app server, turn BO into remote calls", "use an abstract persistence layer, turn DA into EJB QL", "use XML, turn remote calls to web services", "use XML schema and WSDL to define BO interfaces", etc., etc.

We can do all of these without too much thought. There is probably an XDoclet module that will do any of these for us. All we have to to is to add gazillion Javadoc tags to the real object.

But have we made real progress? Does it help to have twelve layers that all look alike?

I want an XDoclet module that writes the Javadoc tags for me!

Teaching Experience?

Have you ever bought a book that supposedly will teach you "experiences of the masters"?

I have. From Code Complete to Design Patterns to The Mythical Man-Month to The Pragmatic Programmer.

I don't think they succeeded. It's true that they contain valuable information. But, at least for me, I become more and more appreciative of what they have to say as I gained my own experience.

After all, it won't be called experience if you can get it by reading books.


A computer is like a violin. You can imagine a novice trying first a phonograph and then a violin. The latter, he says, sounds terrible. ...

---Marvin Minsky, quoted in SICP

Tags :

Closest in 50,000 Years

Every news outlet is reporting that Mars is closest to Earth in 50,000 years.

But who did the calculation? Anybody whom we know?

When was the calculation made? Did Caesar know this? Did Galileo know? Did Newton know? Did Halley?

How much closer was Mars 50,000 years ago than today?

How close will the two planet ever get? When will that happen?

Tags :

This Has To Be a World Record

Received another JDK bug confirmation:

dateCreated : 2002-12-02 09:46:25.2
dateEvaluated : 2003-08-26 12:10:30.234
Tags :

How Do I Do X in Ant

Questions of the form "How do I do X in Ant?" gets asked on the ant-user mailing lists quite often. Usually it involves something that is platform specific but quite trivial on one platform but not on another platform.

There are four canned answers:

  • This is a platform specific thing, don't do it!
  • Use such and such Ant task.
  • Write your own Ant task to do it, and contribute it to the Ant community.
  • Use the exec task.

Of these, the last appealed to the pragmatist in me. The first appealed to the purist in me. And I can live peacefully with either approach.

The second and third approaches makes me uneasy. The third one just adds a lot of busy work to the project without any practical benefit or gain.

The second approach should appeal to the Java partisan. But there's none of it left in me. As the number of such tasks (touch, for example) grows, Ant will become more and more heavy, less and less maintainable, and eventually collaps under its own weight.

Duncan started out with a "simple" roll-your-own replacement of the unwieldy and platform specific build tool with wrinkles. We end up with a combination shell + build tool that does neither very well.

Printer-Hostile Web Pages

I admit it. I like to print web pages out on paper. The 1200 dpi of the printed page is simply easier on the eye than the 92 dpi of the screen.

And nothing frustrates me more than those web pages that are plain printer-hostile. You know the ones: You print out a few pages, walk all the way to the printer, pick up the print out, go back to your seat and start to read. Then, you discover that every line is missing a few words near the right margin.

I emailed webmasters, often without response. I received a response once suggesting that I print their pages in landscape mode.

Fortunately, Mozilla comes with a tool called the Composer. It's an HTML editor. Now every time I want to print a page, and I suspect that it might be printer-hostile, I simply highlight and copy the portion I want (usually in a table cell), and paste into the Composer. I can then print from there.

Thank you, Mozilla, for the Composer.

Tags :

My Computer Virus Story

Microsoft-oriented computer virus stories dominated the popular media in the past two weeks.

First it was the MS Blaster worm.

Then it was the SoBig.F virus.

Then it was the worm that exploits the same vulnerability that MS Blaster did, but does something nice: it wipes out MS Blaster, downloads and installs the Microsoft patch that fixes the vulnerability.

I was not affected by any of these nonsense, as has been the case for the last ten years. I use GNU/Linux. ;D

Oh, I did receive this amusing email:

From: Mary Dumas 
To: weiqigao@xxxxxxxxxx.xxx
Subject: Re: Thank you!
Date: Tue, 19 Aug 2003 12:04:24 -1000

Are you trying to apply to the Executive MBA program?  I
could not open your attachment.  Please advise.  Thank you

Best regards,

Mary Dumas
Office of Student Academic Services
College of Business Administration
University of Hawaii at Manoa
(808) xxx-xxxx
http://xxx.xxx.xxxxxx.xxx
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The school of choice for Asia-Pacific Business
Offering Hawaii's only AACSB accredited MBA/MAcc programs
Tags :

Let's Make It Twisted

Overheard this on the ant-dev list:

I am suprised that there is no perl task at least on the core or optional tasks. Perl is very popular and run on multiple platforms. Do you know if there is any contribution group that provides such task?

Which beget this response:

For some twisted reason, Perl is not supported yet by BSF, only PerlScript on Windows (thru the ActiveScript integration which depends on a Windows DLL).

Do we really want to see perl in our build.xml?

Clarification: java.lang.Math, java.lang.StrictMath

Got some clarification from Jeff Smith, the author of the JavaWorld article: "java.lang.Math in J2SE 1.4 is really the StrictMath library now. So the name is the same but the speed has gone away. :-)"

It all make sense now.

Tags :

JavaWorld Stopped Making Sense

What's up with JavaWorld?

Try reading this article and see if it makes sense.

It started off with this claim:

(J2SE 1.4) uses a new StrictMath package to perform mathematical calculations, but many of these math routines are much slower than the corresponding routines in J2SE 1.3.

And it went ahead and created a JNI version of the Math class, which it called MathLib, that had this characteristic:

(The MathLib) routines are about half as fast as the Math routines in J2SE 1.3.1---a result of the overhead involved in making a JNI call. Note that when you make numerous calls to the MathLib routines in a tight loop, you sometimes get an exception.

We have just received a tip that makes our code half as fast and prone to exceptions. Great!

Tags :

The Users Just Don't Care

We software programmers are a curious bunch. We subconciously project our beliefs and values onto the our users.

"Our users love Java applications, because it is portable to multiple platforms." we thought. Yet what applications do people use most often? Internet Explore or Mozilla, written in C or C++. And Mozilla is ported to more platforms than Java.

"When we write Java GUI's we should use Swing, because it is a Java standard and is more powerful." we thought. Yet when it comes to Java IDEs, Eclipse, an IDE written in SWT---the other toolkit---is gaining ground over NetBeans, an IDE written in Swing.

"When we write Web applications, we should use J2EE, because it is superior technology." we thought. Yet we gladly use Amazon.com, Yahoo.com, and Google.com, etc., without even asking what they are written in.

"When we design API's we should use Java interfaces, and refrain from using too much implementation inheritance." we thought. Yet we use API's designed with implementation inheritance everyday---javax.swing.JFrame, for example.

When we are users, we just don't care! What matters at the end is whether it works and works well.


"Which is worse, ignorance or indifference?"

"I don't know and I don't care."

Tags :

Multiplication

"Quickly, what is 1000 x 1000?"

"1,000,000."

"How did you arrive at the answer?"

"Simple. I just multiplied them together."

"You sure?"

"Of course!"

"Hmm... Now, what is 999 x 999?"

(Timed out thinking) bzzz---

"You didn't do the multiplication that time, did you?"

"Uhh... No, I didn't."

"What did you do?"

(Hang head in shame, low voice) "I counted zeroes. There are three zeroes in 1000. And three plus three is six."

Tags :

Aspect Oriented Programming

Yesterday's presentation at the St. Louis Java User's Group is excellent, even though we have to move 50 people to OCI.

Mark Volkmann talked about Aspect Oriented Programming. Very thorough, very lively. The presentation material is on the Javasig website, here.

Tags :

A Microsoft Moment

microsoft-moment.jpg

Enjoy.

Tags :

Toughts, Truths, Originality, ...

Think a thought. Any thought. Think it quickly.

Was it hard? Was the thought pleasant? Was it interesting, or merely routine? Was it even true?

Was it original? Could someone else be thinking the same thought somewhere else? Could someone else have thought the same thought many hundreds of years ago?

Well, if the thought is true, chances are someone else can also think about it independently.

Thus truth does not belong to any individual. It is out there. It is shared by all. We can only discover it by logical reasoning based on known truths.

Errors, on the other hand, are our own.

Tags :

Bloggers, Blogging About Blogs, Other Observations, ...

Blogs have to talk about blogs. So here goes.

Heard this on the radio Friday:

A blogger is a nerd with a journalist degree and no social life who spends most days and all nights writing e-mails to himself and his friends in hopes of attracting attention from traditional media outlets.

Hmmm, have I joined the wrong crowd?


Since I started using the nntp://rss, I had a first row seat to watch blogs talking about other blogs, back and forth, several levels deep:

"Sam said David said Jon said Sam said It was wrong."

Fun!


Another curious thing: As soon as I add a RSS feed to my nntp://rss weblog grabber, the blogger stops blogging. It would go days without new blogs from certain bloggers.

Makes me wonder if blogging is this thing that you get tired of after three weeks. I'm approaching the three week mark. Better line up some more topics.

Tags :

JDK 1.4.2 Bug, Reported May 31, Confirmed August 7, ...

I finally received the bug confirmation email from Sun on a bug I reported on May 29.

It took Sun 10 weeks to evaluate the report and confirm that it is a bug.

Take a look at Bug Parade, and see how long it would take you to evaluate it.

Compare with the 1 hour 36 minutes evaluation time for a gcj bug I reported.

Tags :

Breaking News: Apache J2EE (Geronimo), JBoss, ...

Within the last twenty-four hours, a few messages were posted to mailing lists across the Internet.

Firstly, there is Geir Magnusson Jr.'s message on the Apache mailing lists. Apache is not happy with the current crop of open source J2EE servers. They are writing a new one. Good for them. It has generated tremendous interest in the Open Source community. All I can say is read the name of the third author of the proposal. (Quiz for the day: Do you remember what the second author did recently?)

Then, a Greg Stein (Chairman of Apache Software Foundation) message was sent to the JBoss developers list, amount others. The message was purges and did not make it to the archives. But remnant of the message can be seen here. as well as here.

Finally, true to his style, a feisty Marc Fleury message showed up, distancing JBoss from Apache J2EE.

I'll be using JBoss for the foreseeable future, but Apache has a good history of getting its ways. (Velocity was started as a clean room reimplementation of the GPLed WebMacro.)

Google, SourceForge, Shoulders of Giants, ...

If it's on Google, do you know it?

How many times have you had a question, and you say to yourself "I'm going to search for it on Google." You do. Google finds the answer. Then you stop. Without going to the actual pages. All the time reassuring yourself "Ah, it's on Google," with a smile.

Thus no learning takes place.

If you start a project on SourceForge, have you innovated?

Once in a while I come across a SourceForge project that's started a year and half ago, with a few CVS commits in the three weeks following, and then went silent. "This file last modified 15 months ago," SourceForge CVS announces. "This project has not released any files." SourceForge's File page announces.

Thus no innovation takes place.

Weakest Link Host: In mathematics, what is negative eight times three?

Contestant: (taking his time thinking furiously) ... Twenty-four.

Weakest Link Host: No. The correct answer is negative twenty-four.

We all laugh. But we would be laughing at ourselves, for day in and day out, we utter things just as ignorant and laughable, in the context of our lives and our work.

"If I have seen further it is by standing on the shoulders of giants." said Isaac Newton in 1676.

We all need help getting up there!

Tags :