Making it stick.
Friday, August 22, 2003
  Annoying tuple syntax: partial solution

Victor Ng writes about Python's tuple syntax for length one tuples.

Not that I use a lot of explicit length one tuples, but here's something you can do instead. Redefine the tuple function to accept non-sequences. If so, just put them in a length one tuple.

def tuple(x):
    try:
        return original.tuple(x)
    except TypeError:
        return original.tuple([x])
Then you can express an explicit length one tuple as tuple(x) 
Thursday, August 21, 2003
  Compound Documents

In terms of big picture ideas, open source is running out of things to copy. Here's something that hasn't been done yet.

Interesting claim about big picture ideas. I never thought of that.

I do agree that "smart clients" is a ripe area for innovation. I never used OpenDoc.

I wonder if Eclipse is a good platform for these ideas?  

Wednesday, August 20, 2003
  Checked Exceptions and Encapsulation

Are checked exceptions a good thing? Do they break encapsulation?

Consider an analogy.

I don't think checked exceptions are necessary. I think they can provide value.

But the cost of maintenance of static checking in Java is not worth the cost. What is my evidence?

I am more productive in Jython, which is capable of dynamically handling checked exceptions at runtime without the cost of static checking.

Let me illustrate my point with an analogy.

Consider an application command processor. The application has many functional areas. Each functional area has multiple commands that can be processed.

I can define a command abstraction and a command processor that works on the abstraction, independent of the specifics of any one command and any functional area.

In this case the commands are encapsulated and the command processor only has to be written once. New commands can be added at any time.

Now say the commands have names. And say that optionally a command can be designated as "checked", i.e. that at compile time the command processor must declare its awareness that some functional area is providing such commands.

Has encapsulation been broken? No. The problem is that named encapsulations are checked at compile time.

Is this a good thing? You decide the value.

Does it have a cost? Yes. The command processor has to be updated whenever a checked command is added to the system. 

Patrick Logan's weblog.


ARCHIVES
March 02, 2003 / March 09, 2003 / March 16, 2003 / March 23, 2003 / March 30, 2003 / April 06, 2003 / April 13, 2003 / April 20, 2003 / April 27, 2003 / May 04, 2003 / May 11, 2003 / May 18, 2003 / June 01, 2003 / June 08, 2003 / June 15, 2003 / June 22, 2003 / June 29, 2003 / July 06, 2003 / July 13, 2003 / July 20, 2003 / July 27, 2003 / August 03, 2003 / August 10, 2003 / August 17, 2003 / August 24, 2003 / August 31, 2003 / September 07, 2003 / September 14, 2003 / September 21, 2003 / September 28, 2003 / October 05, 2003 / October 12, 2003 / October 19, 2003 / October 26, 2003 / November 09, 2003 / November 16, 2003 / November 23, 2003 / November 30, 2003 / December 14, 2003 / December 21, 2003 / December 28, 2003 / January 04, 2004 / January 11, 2004 / January 18, 2004 / January 25, 2004 / February 01, 2004 / February 08, 2004 / February 15, 2004 / February 22, 2004 / February 29, 2004 / March 07, 2004 / March 14, 2004 / March 21, 2004 / March 28, 2004 / April 11, 2004 / April 18, 2004 / April 25, 2004 / May 02, 2004 / May 09, 2004 /


Powered by Blogger