Posts Tagged ‘Angry’

Don Quixote vs. the Bookstore

There’s nothing like eight hours in various airports to make you want to try to change the world. Here’s an email I just sent to Gary McBrayer of the Hudson Group. I will post any replies I receive.

DivX Sux

Look –

I am an end user of DivX. I could not possibly care less about how great the DivX codec is. To be honest, my discerning eye cannot tell the difference between a DivX-encoded movie and an animated GIF. I do not encode my own movies.

So given all of that, explain to me why in the hell I would want this notification icon.

The DivX notification icon makes me want to die

Even if you MUST create a notification icon, I still expect it to hide correctly. Instead, for some reason, it shows and hides itself about once a second while I am watching, say, a Channel 9 video.

This resizes everything on my taskbar. It is absurdly distracting, and makes it more difficult to concentrate on the video. If for no other reason, this makes DivX automatically the worst possible codec with which to record a movie.

DivX, you are not the coolest most amazing program ever written in the history of mankind. You are a stupid video format and you should operate behind the scenes where you belong.

A pox on you and your family.

Welcome to the Ass-End of the Enlightenment

According to this article, the word debate seems to be sorely in need of redefinition.

President George W. Bush stirred the debate on the teaching of evolution in schools when he said this week that he supported the teaching of alternative viewpoints - such as the theory of Intelligent Design - to help students "understand what the debate is about" [emphasis mine].

Please do not trouble yourself - I have already suggested a number of alternatives to the archaic meaning (“to engage in argument by discussing opposing points.“) to the custodians of Dictionary.com.

  1. Impassioned and reasoned logic countered with childish misrepresentations and/or outright lies.
  2. Deliberately creating confusion between the Scientific Process and a Scientifically-Conducted Gallup Poll.

If you are not looking forward to another unreasoning dark age, except this time with nuclear bombs, might I suggest taking this opportunity to donate to these charities:

  1. The Council for Secular Humanism
  2. Americans United

Does ANYONE Comprehend ASP.NET Web Projects?

Once every few weeks I find myself wrestling with these foul beasts. And each time, I find the following phrase echoing in the empty space between my ears.

Mit der Dummheit kämpfen Götter selbst vergebens.

I have been making every attempt to avoid dealing with them. For the most part, a series of NAnt scripts have insulated me. But now and then I need to get one working for the sake of helping one of the many lost souls who depend on them.

Last time, I took screenshots.

The first step was to try to add the project to a solution.

Creating an ASP.NET web project - Step 1

It wants me to enter the URL of the project, so far so good…

Creating an ASP.NET web project - Step 2

Now we have the first sign of trouble. The URL bit appears to have punted to a standard file open dialog.

Creating an ASP.NET web project - Step 3

I faithfully yet skeptically select the file, but I have the sinking feeling of having been here before.

Creating an ASP.NET web project - Step 4

Ah yes, I remember now.

Creating an ASP.NET web project - Step 5

So there you have it: web projects are an ouroboros; they are a maddening riddle, answered only by another question.

A Macroeconomic Theory of Texas Holdem

I am having a banner day as an intellectual, it being no coincidence that my television is currently broken. I could take this excellent opportunity for creative output to bemoan yet another unfathomably stupid government-funded “power of prayer” study, but I opted for a more lighthearted subject.

To be completely candid, I started doing just that, but I depressed myself too much to finish it.

Therefore, I will regale you, the reader, with a dissertation on another utterly important subject. Namely, gambling.

Trading emails with a friend the other day, I described the poker craze that is gripping the nation as “the pet rock of this era.” I was immediately taken to task and told to defend this statement.

The argument I was given went about like this.

If one is an expert at poker, one can expect to win consistently. That’s much more than you can hope to get from other games of chance like blackjack or craps, so why would anyone lose interest in poker, given the unwavering popularity of those games?

Forget that it’s on television; once you’re into poker, I think you are hooked for life.

First let me say that I am not backing my response with any hard data. This is purely an academic exercise.

Poker suffers from an important handicap: it is necessarily worse than a zero-sum game. The winners are few, and in large tournaments or online walk away with somewhat less than what the losers have given up.

The idea that an adroit player can consistently come out the better appears to be all-too-true. But rather than being an asset, this is the very reason why poker will not continue in popularity. For every player that wins consistently, there are players who lose just as consistently.

These players plainly will not be interested indefinitely. They have sprouted like reeds from the Nile-esque deluge of ESPN coverage for the time being; in fact, this is making it significantly easier to be one of the lucky few who leave with chips.

When the plebeian interest wanes, the game’s talent bar will steadily rise. Ultimately, nearly all of those who currently style themselves as among the upper echelons will look around only to see that they are in free fall.

This kind of analysis is not difficult to derive; why is it that so few take the trouble to do it?

John Dvorak Benefits from the Public Stupidity he Decries

Something has been bothering me about John C. Dvorak’s site for the last few days. This post in particular drove me to write about it. Here is a screenshot of the post. I would like to point out two things.

John Dvorak promotes pseudoscience

Figure (1) is John Dvorak complaining about public ignorance and stupidity. For this, I would normally applaud him. Figure (2) is John Dvorak profiting from public ignorance and stupidity.

Perhaps Dvorak isn’t in control of the content of that ad. If that’s the case, hopefully he’ll stop using that particular vendor. If he doesn’t, I don’t think there’s anything you can call this behavior other than every gadfly’s favorite insult, hypocrisy.

Some of the comments to his post are seriously pretty scary. Somehow, these people are allowed to procreate.

There is a slight parallel here to My God Problem, which is a thought-provoking article by Natalie Angier that appeared in Free Inquiry magazine. Simply put, the point is this: you cannot turn a blind eye to certain (popular) superstitions and still bemoan the public’s inexplicable distaste for evolution.

Four Irritating Lines of Code

At many places in the framework, you’ll see properties of types named for the enumerations or types they receive. I was indifferent to that until just now.

I just wrote these four lines of code. It took much longer than it needed to.

BinaryFormatter f = new BinaryFormatter();
f.FilterLevel = TypeFilterLevel.Low;
f.TypeFormat = FormatterTypeStyle.TypesWhenNeeded;
f.AssemblyFormat = FormatterAssemblyStyle.Simple;

Consider the last three lines. None of the enumeration names are even close to the corresponding property on the formatter.

For all three of these, I typed out something like this:

f.FilterLevel = FilterLevel.

[No Intellisense, there’s a problem]

[Backspace repeatedly]

f.

[Intellisense shows up; oh, it’s “TypeFilterLevel”]

f.FilterLevel = TypeFilterLevel.Low;

Maybe the usability studies didn’t make it to System.Runtime.

WTF

This Daily WTF reminded me of a guy I used to work with who would use this pattern in every single function he wrote.

Public Const cSTRINGFOO As String = "foo"

Public Function Foo() As Boolean
    Dim ret As Boolean = False
    Try
        Console.WriteLine(cSTRINGFOO)
        ret = True
    Catch ex As Exception
        ret = False
        Throw New Exception("", ex)
    End Try
    Foo = ret
    Exit Function
End Function

I’m not sure what he was expecting to happen here, but there were some clues:

  • Every function he wrote returned true or false to indicate that it had successfully completed without an exception.
  • Every exception was wrapped in another, except where he forgot and swallowed the exceptions.
  • He would always use constants for string literals, even if he only used the literal once (like above), and even if the constant was much longer than the literal.

Mind you, I discovered this self-imposed standard a while after he quit, so I never really got to the bottom of it.

No True Object Programmer, Part Deux

Edit (2/28): What I have to say about raising an event asynchronously in VB is very incorrect. If you got here by googling “raise event async VB“ (or thereabouts), do not listen to me. Read Bill McCarthy's comment about it.


Well, Bill loves VB.NET, and knows a lot about it. I am in a slightly different camp, in that I (arguably) know a lot about it because I am forced to use it at work, but I haven’t grown to love it very much.

But as to your difficulty in parsing VB.NET code, well as you said, VB.NET is actually more natural. It is probably more that you need practice reading and writing the code.

I concede that this is probably true. I’ve been staring at C/C++/Java/C# since I was 11 years old, so it’s quite likely that’s the only reason I find it more natural. It doesn’t really help that I switch between VB.NET and C# projects on an almost hourly basis these days. I’ll jump to the VB project and start typing:

StringBuilder sb = …

Whoops. Wrong one. Apparently I can’t make the jump as effortlessly as the woman shouting into a cellphone on the train next to me last week weaved an intricate and impressive unbroken stream of Spanish/English (“Spanglish?”).

So yes. Readability is probably a personal problem.

This started out, I guess, as a discussion about which language was “more OO.” That’s may be a vague metric, so I’ll try to limit the discussion here to which language lets you accomplish the task at hand in the simplest possible way with minimal connectivity and shared knowledge between your objects.

In the case of events, I think that at best, this is a draw. This is an opinion.

VB wins when it comes to a few useful abstractions: the RaiseEvent keyword, and declarative event handling (the WithEvents/Handles keywords).

In a comment on Bill’s blog, I referred to these as “leaky abstractions” (to borrow shamelessly from Joel). What I mean by that is, they work beautifully in the simple cases, but in more sophisticated situations they break down and you’re forced to understand what is actually going on. VB may or may not leave you with a way out, once you’ve done the learning bit.

My first example here was raising an event asynchronously. Here is code that accomplishes calling event handlers on another thread in C#.

internal class MyClass
{
    public event EventHandler MyEvent;

    protected virtual void OnMyEvent(EventArgs e)
    {
        this.MyEvent.BeginInvoke(this, e, null, null);
    }
}

Here is code that accomplishes the same task in VB.NET.

Friend Class SomeClass
    Public Event MyEvent As EventHandler
    Private Delegate Sub EventRaiserDelegate(ByVal e As EventArgs)

    Protected Overridable Sub OnMyEvent(ByVal e As EventArgs)
        RaiseEvent MyEvent(Me, e)
    End Sub

    Protected Overridable Sub OnMyEventAsync(ByVal e As EventArgs)
        Dim del As EventRaiserDelegate = AddressOf OnMyEvent
        del.BeginInvoke(e, Nothing, Nothing)
    End Sub
End Class

Bill’s correct, you can raise an event asynchronously in VB.NET, albeit in a roundabout way. Unless there's a radically different method I haven't thought of, I need to write and then call OnMyEventAsync, which calls a traditional event raiser on another thread.

Here is where I think the claim that VB is “more OO” breaks down. The representation of the event as a list of functions (which is what C# gives you) was significantly simpler for us in this case. We got the job done with less code, so in my mind C# wins the OO battle here.

As to events in Vb.NET, I'm sorry but there is no "inadvertant GC rooting". I don't know who told you that, but you/they were sorely mislead.

On serialization, Vb.NET has absolutely no problems with XML serialization. There is however an issue with binary serialization and MarshalByRef classes. The real problem is MarhsalByRef classes, eg a Windows.Form, cannot be binary serialized. If you need to work around that, you can do so in Vb.NET 2005, and more elegantly than C#.

Poor terminology on my part, I guess. What I was referring to with “GC rooting” was the situations where a programmer attempts to dereference an expensive object so that it may be collected. A common mistake is leaving events wired up (and hence, a reference that has a gc root).

Is that any more difficult to deal with in VB than it is in C#? No, not really. Touché. But am I justified in calling an event a “leaky abstraction” if they require a deeper understanding of function pointers and GC in order to keep your program from hogging memory? I think so.

So that leaves the last sitch: serialization. MarshalByRef is actually not what I was thinking about, but it’s closely related. MarshalByRefObjects are at least serializable, and unless you are persisting to a storage medium you will succeed in serializing a graph if your only mistake is having a ObjRef going along for the ride.

Objects that are not [Serializable()] at all are a bit more problematic. You’ll get an exception which will be difficult to track down if you have event handlers wired up to any of these. C#’s got an easy way out (google it; my post is getting really long, dammit). The hacks VB will force you into in some cases is likely to make you cry. I know it made me cry.

So which language is “more OO?” That’s impossible to answer objectively, and it probably makes no sense to even try, but I’ll tender a personal opinion.

My feeling is that VB gives you some keywords that are useful for simple OO. Unfortunately, it obscures some of the underlying nuts and bolts, and this gets in the way of your own attempts at OO abstraction. C#, on the other hand, is a little better at ensuring that the realities of the CLR are quickly accessible if you need them.

In an ideal world, we’d have both in one language. But forced into a choice, I’ll opt for seamless access to the guts. Keeping my own objects as loosely coupled as possible is what I’m most interested in doing.

No True Object Programmer

Did you love the No True Scotsman argument? Well, get ready for the arguments!!

Explicit Interface mapping. This is incredibly cool. Unfortunately a lot of people just don’t get how important this concept is to true OO.

He continues:

As to VB.NET over C#, VB.NET is actually a far more OO language when you look at the actual implementation details.

(did I hear a record scratch?)

Far more?

At the risk of Ad Verecundiam, I’ve actually been on the phone with a Microsoft employee who said these words: “C# is a much better choice if you intend to do object development.”

Bill doesn’t expand on that argument really, other than the appeal of the End keyword. It would be a silly thing to get into an argument about, but my feeling is that End XXX makes VB code less readable. I would like to see more reasons why this could be true.

I apologize for any haughty, dismissive tone. I wrote this while working on a brick of Parmigiano Reggiano and sucking down a bottle of Chianti, so it just kind of came out that way.