Software development industry analysis by Larry O'Brien, the former editor of Software Development and Computer Language
Sunday, February 29, 2004
Why spoil a perfect record? Yes, it's March. No, Cross hasn't shipped their pen for the Tablet PC.
Sunday, February 29, 2004 10:41:53 PM (Hawaiian Standard Time, UTC-10:00) |  Disqus link  | Knowing#
Saturday, February 28, 2004

In a comment on my last post, Alex Peake points out the Dispose() method and the using keyword. This is what I referred to in the post as "implementing IDisposable", but I realize that I glossed over that too fast.

IDisposable is an interface that defines a single method, Dispose(). If you have "valuable resources that have to be put back on the shelf" the recommendation in .NET is that you define your class as implements IDisposable  and release the resources in the Dispose() method.

C# goes a step further and provides a keyword, using, that generates a try...finally block and, in the finally block, calls the Dispose() method of the IDisposable object that the using keyword refers to, for instance:

using(myNetworkConnection){
    doStuff();
 throw new EvenIfItThrowsAnException();
} //when execution reaches here, myNetworkConnection.Dispose() will be called

This is how you should get rid of valuable resources, not wait around for the finalizer to be triggered by a call from the garbage collector.

But that raises the question: if IDisposable and Dispose() are the .NET-recommended ways to dispose of non-memory resources, what is the purpose of the finalizer? That is, what are the recommended contents of Object.Finalize() other than a "last chance" call to: if(this is IDisposable) this.Dispose() ? And if those are the intended contents, why not just emit that IL instead?

Saturday, February 28, 2004 6:41:12 AM (Hawaiian Standard Time, UTC-10:00) |  Disqus link  | Knowing#

I read Bryan Flamig's criticism of C# via Loren. Bryan voices a common criticism of C#'s garbage collection (the criticism actually would apply to all languages that don't go beyond the default memory management model of CLR, but let's just continue to use C# as the example): in C++, the timing of when an objects is "cleaned up" is under program control (it's fully deterministic), while in C#, the default behavior is that the timing is non-deterministic (in fact, reclaiming memory is an aspect of "cleaning up" whose precise timing is very explicitly beyond the control of the developer).

Bryan makes the excellent point that "cleaning up an object" certainly means releasing the memory for reuse but can also mean closing a network socket, database connection, file handle, etc. There are many examples of valuable resources such as these that come from a limited pool, and it's perfectly understandable for a programmer to want to control the timing of when such resources are "put back on the shelf," as it were.

In C++, releasing resources and releasing memory are thought of as one event. In C# and most other .NET languages, the act of cleaning up is thought of as being two events: the release of valuable resources (finalization) and the release of memory (destruction). By default, the CLR's garbage collector guarantees that it will call a "finalizer" function prior to releasing an object's memory. So, if you use the finalizer method to control your valuable resources and do nothing else, "cleaning up" is linked to the non-deterministic garbage collector. That's the chief criticism of C#'s garbage collection.  

But, to be fair, these non-memory resources are not what garbage collection aims to solve. Garbage collection aims to solve managing physical memory. Allocating and deallocating memory has unique problems (in that memory can point to other memory) and characteristics (the ratio of memory allocations and deallocations to, let's say, the number of file handles opened and closed is approximately a zillion to one). So relying on an algorithm for garbage collection based on physical memory to time the clean-up of your valuable resources is a questionable strategy. But that doesn't mean that garbage collection (of physical memory) is not a great advantage: the garbage collector is fast, it compacts the heap, and it goes a long way to help the most common types of programming bugs in C and C++. It doesn't solve memory management, but it helps a lot.

So if you don't want to rely on the garbage collector to trigger your finalizer to release your valuable resources, what do you do? You implement IDisposable and put the release of valuable resources entirely under programmatic control. Sure, that's an error-prone burden, just like managing physical memory was. But it's a start.

Now, can one imagine a CLR that had an algorithm that was optimized for managing non-memory resources? Yeah, but it might have poor performance. Or can one imagine some in-language facility that provides "deterministic finalization"? Yeah -- C++/CLI will have such a thing and it's certainly on the radar of the designers of the C# language.

But memory management via garbage collection? .NET provides a great implementation of a great idea.

Saturday, February 28, 2004 5:04:58 AM (Hawaiian Standard Time, UTC-10:00) |  Disqus link  | Knowing#
Friday, February 27, 2004

My take on the debate of whether typing is needed in a language. Rather than taking sides, I revert to my previous incarnation as a philosopher, and try to see what we are really talking about when we seem to be talking about types. via [Artima Weblogs]

Jim Waldo says that strong typing advocates spend more time thinking about large systems. Yeah, I agree.

Friday, February 27, 2004 8:15:17 AM (Hawaiian Standard Time, UTC-10:00) |  Disqus link  | Knowing#
Thursday, February 26, 2004

ReplayTV...I love download into MS lectures and playing them back at 1.5 speed...All media should be timeshifted. *All* *media*. via [Marquee de Sells: Chris's insight outlet]

I don't even have a PVR and I agree. One of my many, many side-projects is writing a .NET CF RSS aggregator that displays the articles using RSVP (Rapid Sequential Visual Presentation -- flashing the words at you at a rate that significantly exceeds your regular reading rate). So much software to write, so little time...

 

Thursday, February 26, 2004 11:53:27 PM (Hawaiian Standard Time, UTC-10:00) |  Disqus link  | Knowing#

Peter just messaged me: "Hands down, InfoPath (prerelease version) is microsoft's coolest ink app, after onenote." I can't wait to read his comments on his blog.

OK. That settles it. I'm downloading the prerelease InfoPath even if that means I have to reinstall everything later. Here goes nothing... via [Incremental Blogger]

Hmmm... InfoPath isn't really targeted towards an independent contractor like myself, but if it's mad for ink...

Thursday, February 26, 2004 11:46:31 PM (Hawaiian Standard Time, UTC-10:00) |  Disqus link  | Knowing#

As seen at adimiron's place:

Step 1: Open your mp3 player. (iTunes here)
Step 2: Put all of your music on random.
Step 3: List the first ten songs it plays, no matter how embarrassing.

via [The .NET Guy]

Stuck In A Moment You Can't Get Out Of" -U2

"Get Down" - Butthole Surfers

"Sunday Morning Coming Down" - Johnny Cash

"Acetate Prophets" - Jurassic 5

"Smells Like Funk"  - Black-eyed Peas

"Baby's Got Sauce"

"Insomniac" - Echobelly

"A Charlie Brown Christmas"

"New Age Girl" - Deadeye Dick

"The Shame of Life" - Butthole Surfers

That's too good to be random (Down-Down name match, Jurassic 5- Black-eyed Peas match, 2 Songs from the "Dumb and Dumber" soundtrack, 2 songs from the Butthole Surfers), but that's why I use Music Match Jukebox. I got to clear that Christmas stuff off my machine, though!

 

Thursday, February 26, 2004 1:27:32 AM (Hawaiian Standard Time, UTC-10:00) |  Disqus link  | Knowing#

The January '04 CACM's lead letter is a smackdown of Hans Moravec and the concept that more MIPS is the path to AI. (When really it's spam that will lead to AI.) Anyway, the author tersely makes the excellent points that people such as Moravec are again making the argument that "Someday computers will wake up," with "the same intellectually faulty arguments and foundational quicksand AI has always suffered....Just because you put a picture of a chim and a human on the same graph with a Dell Computer doesn't mean the chimp, or human, capabilities will be meaningfully measured in MIPS...[Moravec leaves] entirely undefined, unspecified, and unaddressed [such questions as]: What is behavior?; What is a mind?; What is consciousness?; What is reasoning?" to which Moravec's lame reply is to pretend that the letter writer is caught up in "Western philosophy, let alone religion."

There's been virtually no progress in AI theory in the past decade. Everyone in AI seems to be crossing their fingers and hoping that some unexpected emergent phenomena will kick in when enough something (data, MIPS, facts, environmental input...) crosses some line. Maybe. I think it's less likely than my joke that spam will lead to the co-evolution of machine intelligence.

Thursday, February 26, 2004 12:01:17 AM (Hawaiian Standard Time, UTC-10:00) |  Disqus link  | Knowing#
Wednesday, February 25, 2004

Nemerle is a new hybrid (functional, object-oriented and imperative) programming language for the .NET platform.

Wednesday, February 25, 2004 4:46:34 AM (Hawaiian Standard Time, UTC-10:00) |  Disqus link  | Knowing#

http://west-wind.com/weblog/posts/269.aspx

An excellent blogicle (blog article) describing each of the paths in ASP.NET, and what they actually point to. via [Kent Sharkey's blog]

Wednesday, February 25, 2004 4:44:18 AM (Hawaiian Standard Time, UTC-10:00) |  Disqus link  | Knowing#
Monday, February 23, 2004

With this add-in you can permanently remove hidden and collaboration data, such as change tracking and comments, from Word 2003/XP, Excel 2003/XP, and PowerPoint 2003/XP files. 
via [Early Adopter Weblog]

Everyone needs this add-in. In the past 6 months, I've received 3 Press Releases with embarassing internal comments and 1 document whose author had gone to significant pains to remain anonymous but who forgot or didn't understand Word's document properties fields.

Monday, February 23, 2004 12:36:13 AM (Hawaiian Standard Time, UTC-10:00) |  Disqus link  | Knowing#
Sunday, February 22, 2004

Finalization is expensive.  It has the following costs...<snip of 2, 930 additional words>... Subject to all of the above, we guarantee that we will dequeue your object and initiate a call to the Finalize method.  We do not guarantee that your Finalize method can be JITted without running out of stack or memory.  We do not guarantee that the execution of your Finalize method will complete without being aborted.  We do not guarantee that any types you require can be loaded and have their .cctors run.  All you get is a “best effort” attempt. 

 via
[cbrumme's WebLog]

I'm becoming more and more convinced that the guideline for non-deterministic finalization should be: avoid it. The only thing you need finalization for are non-memory resources: file handles, database connections, etc. You can either exercise a little diligence so as to manually track and clean up these things or you can subject yourself to the complicated algorithms described by Brumme. If I were managing a programming team, there's no way that I'd trust junior programmers to read Brumme's post and then tell them "Okay, make sure we don't run out of database handles." Nuh-uh. I'd say: "Refactor your non-memory resources into xPool objects and deterministically finalize them using try...finally or using statements and the IDisposable pattern." Learning that might be more complex than reading Brumme's post, but the results are much easier to review and duplicate.

 

The people who really get a huge benefit from non-deterministic finalization are library writers, who finally have a guarantee that sometime before the process ends, they'll get a final shot at cleaning up resources. Even they, I think, should strive for explicit deterministic finalization and use the finalizer as a "last chance" effort to trigger clean-up.

Sunday, February 22, 2004 11:37:54 PM (Hawaiian Standard Time, UTC-10:00) |  Disqus link  | Knowing#

Sun has posted an article claiming that Java is faster than .NET for processing XML.... via
[Better Living Through Software]

It's quite possible that Sun has achieved major improvements to their XML processing, since it used to be quite poor compared to .NET 1.0's performance. The competitive marketplace in action...

Sunday, February 22, 2004 11:15:47 PM (Hawaiian Standard Time, UTC-10:00) |  Disqus link  | Knowing#
Thursday, February 19, 2004

A recent CACM has an article on CAPTCHAs (those visual problems used to defeat registration 'bots). The article made the point that solving a CAPTCHA requires advancing the state-of-the-art of artificial intelligence and image recognition. Similarly, the spammers have begun using Markov chains to fool spam tools that work at the level of the single word. Naturally, the next step for anti-spam will be to apply rudimentary grammatical analysis to the body text, diagram the sentence like a 9th grader, and do Bayesian analysis of the sentence structure. Naturally, the spammers will counter with more sophisticated sentence generators, the anti-spammers will improve their contextual analysis, and the two forces, driven by the ridiculous economics of spam, will co-evolve machine intelligence.

Eventually, the machine intelligence will send a robotic assassin back in time to kill Thomas Bayes and ensure a future in which all humans have low-interest loans, college diplomas, and an herbally-enhanced sex life. Chilling.

Thursday, February 19, 2004 1:02:31 AM (Hawaiian Standard Time, UTC-10:00) |  Disqus link  | Knowing#
Wednesday, February 18, 2004
ReSharper is very early, the only refactoring this first version supports is "rename..." The license also expires in two days! So you needn't rush to the download site quite yet...
Wednesday, February 18, 2004 4:52:55 AM (Hawaiian Standard Time, UTC-10:00) |  Disqus link  | Knowing#

If you follow the rumor mill, you may have heard of X# or "Xen", the crazy next-generation programming language that was reportedly being cooked up by people on my former team.  I won't say what they all are working on now, but some more of them have started blogs....


I just finished reading Cory Doctorow's latest book Eastern Standard Tribe. It was a cool book and the next time I hit a bookstore or Amazon.com I will buy a copy. Because Cory released the book under a Creative Commons license people have been transforming it into a variety of formats. The one that caught my eye was "speed-reader" by Trevor Smith. This is a Java applet that flashes the book up on the screen a word at a time. The single user-interface control it has is for varying the speed at which the words are presented....


Harald Leitenmüller (Microsoft Austria) mentioned that the book Presenting to Win - The Art of Telling Your Story helped him a lot with preparing his morning keynote (Alex Holy and his team: Beat Schwegler, Mario Szpuszta and Harald Leitenmüller) for the .NET Day in Vienna.

I'm just reading chapter 6 of this book, and it is really great. There are many good ideas from Jerry Weissman that help doing great presentations....


 Http://www.cookcomputing.com/blog/archives/000346.html

Seen on one of the Mono lists: version 0.1 of Nemerle - "a statically typed functional language with well founded .NET" - has been released by a team at Wroclaw university....


The Geek Hierarchy


 http://boingboing.net/2004_02_01_archive.html#107611107718531399

Stephen Wolfram has made the complete text of his New Kind of Science (a 1000+-page treatise on the way that virtually everything in the universe can be explained with cellular automata), which he self-published a couple years back with some of the squillions of dollars he's earned on his seminal Mathematica software program, available for free on the Internet. Link (via /.)


 http://devhawk.net/PermaLink.aspx?guid=70beeb67-a27d-4958-90ab-f3aa3f46cfd2  |  Comments

Again, I'm late to the story but I think it's ultra-cool that MS Research released the source code to Allegiance . At 511 MB, it's almost thirty times bigger than Rotor + Gyro, which is a significant code release in itself, though honestly, only about 5% of the Allegiance archive is code, the 95% is in the "Artwork" subdirectory. That still leaves about 25MB of compressed code.

I'd love to see a port to MC++, a la Quake II.NET. Is anyone working on it?

 


 http://devhawk.net/PermaLink.aspx?guid=15eb3822-519c-458e-9086-2999ce666d44  |  Comments

patterns & practices has published a new App Block: Authorization and Profile.

This block is a reusable code component that builds on the capabilities of the Microsoft .NET Framework to help you perform authorization and access profile information.

You can read it online or download it.

 


http://devhawk.net/PermaLink.aspx?guid=ef315d5b-f0b5-4e94-b066-243c4c3f695c  |  Comments

My teammate Simon has posted details of his managed SDK for Outlook codenamed Niobe. He's also created a GDN workspace for it. Coolness.

 


http://weblog.infoworld.com/udell/2004/02/17.html#a918

....This column touches on two third-rail issues: personality and gender....


Interview with Intel's C++ Compiler Team 

After all the CLR posts, here's a real compiler story.


 Key Events in Microsoft History

Timeline of important Microsoft dates and events.


 http://www.russellbeattie.com/notebook/1006221.html  |  Comments

I'm here with my company WaveMarket at DEMO and this morning - after a few days of last minute rush - we launched our suite of Location Based Services, including my baby WaveBlog. Yay! What a push. And whew! Now I can talk about what I'm doing! ....


 Why Don't .NET Developers Grok Scalable Distributed Computing?

I have had this essay gnawing in my head for at least three months and have been trying to phrase it, think through it, agonizing over it. ....


Wednesday, February 18, 2004 1:59:34 AM (Hawaiian Standard Time, UTC-10:00) |  Disqus link  | Knowing#
Tuesday, February 17, 2004
Tuesday, February 17, 2004 10:40:36 PM (Hawaiian Standard Time, UTC-10:00) |  Disqus link  | Knowing#

I like Jeff's suggestions for a Service Oriented Lanugage  via [DevHawk]

My latest SD Times article  discusses the passing of Object-Orientation and the rise of Service-Orientation.

Tuesday, February 17, 2004 10:39:48 PM (Hawaiian Standard Time, UTC-10:00) |  Disqus link  | Knowing#

Doug Seven has a list of 26 ideas that shouldn't be done with SQL. You can vote for the top 10. via [Christian Nagel's OneNotes]

Naturally, the comments section immediately debates whether stored procedures are inherently evil...

Tuesday, February 17, 2004 10:35:32 PM (Hawaiian Standard Time, UTC-10:00) |  Disqus link  | Knowing#

Reshaper, a C# refactoring plug-in for Visual Studio .NET 2003, is now available for early access. This is from JetBrains, nee IntelliJ, makers of the IDEA Java IDE.

http://www.jetbrains.net/resharper

User name: eapuser

Password: eapuser

Tuesday, February 17, 2004 10:17:54 PM (Hawaiian Standard Time, UTC-10:00) |  Disqus link  | Knowing#
Monday, February 16, 2004

Microsoft launched .NET two years ago last Friday. My short take: CLR and C# are unqualified successes; Managed C++ was a failure, but they'll turn that around with C++/CLI; and that the jury's still out on VB.NET. The most disappointing thing to me is the relative dearth of third-party languages for .NET.

What do you think?