June 2003 - Posts

Patterns Nonsense

So, I'm looking through the patterns stuff on Microsoft's site and I come across the MVC stuff. Man, they do some rediculously lame things when implementing these patterns. The patterns themselves are ok, it is their implementation that is just horrendous. For example:

public class DatabaseGateway
{
   public static DataSet GetRecordings()
   {
      String selectCmd = "select * from Recording";

      SqlConnection myConnection =
         new SqlConnection(
            "server=(local);database=recordings;Trusted_Connection=yes");
      SqlDataAdapter myCommand = new SqlDataAdapter(selectCmd, myConnection);

      DataSet ds = new DataSet();
      myCommand.Fill(ds, "Recording");
      return ds;
   }

   public static DataSet GetTracks(string recordingId)
   {
      String selectCmd =
         String.Format(
         "select * from Track where recordingId = {0} order by id",
         recordingId);

      SqlConnection myConnection =
         new SqlConnection(
            "server=(local);database=recordings;Trusted_Connection=yes");
      SqlDataAdapter myCommand = new SqlDataAdapter(selectCmd, myConnection);

      DataSet ds = new DataSet();
      myCommand.Fill(ds, "Track");
      return ds;
   }

So, first off, whose idea was it not to use a parameterized queries? Even if it was an integer coming in, I would still question their absence, but this is a string based id coming in to this method. Way to go, you just opened up your site to the easiest hack in the book.

Secondly, who on the content team loves static methods? Come on. I thought these examples were supposed to illustrate best practices and such... guess I was mistaken.

Posted by Jesse Ezell with 6 comment(s)

Worthless Information

Ted agrees that Craig Andera is off his rocker, when he suggests that code gen is better than AOP. He promises more discussion to come...

He also has some interesting comments about data persistence:

"No, Dave, that's precisely my point--we're not persisting objects. That would be the case if we were talking about taking data and putting in into an object database (a true OODBMS, that is), but that's not the case going on here. In 99.5% of all enterprise projects, we're putting data into the database--the fact that you as a Java programmer choose to view the data in the form of an object model is entirely your choice."
[Mountain of Worthless Information]

Posted by Jesse Ezell with 1 comment(s)

SCO CEO Speaks Out

"The point about open source that I believe is really cool is this notion that you have thousands of eyes around the world looking at a similar problem, and obviously when you have more people focused on something, you can solve things better."
[CNET News]

This is one of the greatest misassumptions out there. The traditional open source model is horrendously inefficient. As we all know from Brook's great work, adding developers to a project only creates more scheduling problems. Perhaps this is why some open source projects never seem to get out the door, or at least get out the door very late, with less features than their commercial competition. Additionally, without a formal architecture review process, you wind up with all these 13 year old "software architects" running around and making wonderful decisions about how this or that class should work, and how this or that method should run (ever tried to figure out the format of some random linux config file?... heck, we've had a standard config format since INI's Win 3.1). The result is that the old code has to be constantly scrapped and thrown into the garbage pile so that some commercial software company can bring in their own money and their own team to attempt to do things the right way. These kinds of commercial partnerships are becoming more and more the norm for large open source projects, and it makes me really wonder some times. If the open source movement is so great and powerful, why does it need all the extra help?

Posted by Jesse Ezell with 6 comment(s)

Advice for Small Software Companies

"Both of these come from markpasc.org -- Shareware Amateurs vs. Shareware Professionals by Steve Pavlina -- a nice dissertation on the right and wrong ways to figure out what product to build; and Eric Sink's article on product positioning -- the fundamental point being that marketing begins well before you develop your product, not afterwards; and that you better be able to simply articulate what your product is for."
[A Little Ludwig Goes a Long Way]

Posted by Jesse Ezell with 1 comment(s)

IE 6

"Microsoft said Friday that it is halting development of future Macintosh versions of its Internet Explorer browser, citing competition from Apple's Safari browser."
[CNET News]

Seeing that already halted development of the standard Windows version of IE with 6... should this come as a suprise to anyone?

Posted by Jesse Ezell with no comments

Code Gen vs. AOP

Craig Andera seems to think that AOP is doomed as a programming model and Code Gen is the future. His basic argument is this:

"The basic problem here is that services are not generally orthogonal. What that means is that it’s impossible to simply slap a new behavior onto code without understanding all the other behaviors that are already there. Don’t believe me? Then ask yourself why the CLR’s context infrastructure has IsContextOK. This is the method that – when implementing a new service – lets you look around your environment and decide if you’re compatible with all the other services that are already present. This has two basic problems:

1.      How do you know if you’re compatible with a given service that didn’t even exist when you were created?

2.      What do you do if there’s a service that you’re not compatible with, but it doesn’t get added until after IsContextOK gets called? After all, the system has to call them in some order.

The mere fact that IsContextOK even exists is a dead giveaway that the whole thing is hopeless. If services were truly composable, we wouldn’t need it. Sure, some things like logging or security might work like this, but it just doesn’t generalize."

Clemens agrees with the problem, however, he disagrees on how fatal the flaw is:

"I don't think it fundamentally matters much how code gets woven into the call chain. Setting up contexts is just one issue. What's even more difficult is to find a way to deal with errors in the presence of cooperating aspects (or, in more general terms, interception services). What's clear is that there's no way around interception-driven services in a web services world. It's all pipeline-based and, even worse, the pipelines are distributed pipelines of pipelines. It's too simple to say "it's broken, get over it". That doesn't help solving what is an actual problem.

A promising approach is to make aspects/interceptors act like resource managers and coordinate their work using a very lightweight 2PC protocol ("AC" guarantee only; no "ID"). Using 2PC for this approach allows interceptors/aspects to coordinate their work and know about each other before any work actually gets done. I have discussed these issues with a couple of people in depth we put some code together that essentially implements a little, in-memory "DTC" for that purpose. We call it a "WorkSet" instead of a transaction.  There's still some work to be done there, but I think I'll be able to post an example in a little while. Maybe around TechEd Europe time."

I have to agree with Clemens here. AOP is still very young, so it is understandable that it has a few major limitations. But, coordinating aspects is definately not impossible. With an attribute based AOP approach, determining all the available aspects / services at runtime could be as simple as examining the associated attributes of the method call via reflection. Then, you simply need to change your call model, so that it isn't just "Add Dumb Message Sink and Continue" (aka. IContributeObjectSink).

This is not to say that CodeGen is not a useful tool though. I am of the opinion that we need CodeGen support at the compiler level, not just the tool level before CodeGen will ever allow us to produce clean, managable code. Despite their obvious problems, you have to admit that elegantly written C++ macros could save a TON of coding. I know of at least two projects here that would have been far more difficult to develop without them (or at least for more difficult to maintain). We don't have anything similar in any of the .NET languages (not counting managed C++, of course), which is quite a shame. I could see how a more sophisticated code generation model (ie. running actual .NET code during compile time to do the CodeGen, instead of dumb macros), could really do some amazing things. It is a shame that a lot of language developers have given up on them, rather than address their obvious shortcomings, because there are many situations where method calls just don't cut it (ie. those situations where code generation is actually useful).

Posted by Jesse Ezell with no comments

BitTorrent

While downloading the Halo gameplace demo, I came across BitTorrent. Talk about a cool P2P program! I think MSDN really needs to do something like this with their download manager.

For those who don't know what bittorrent is, it is a P2P download app. Basically, you just click to download a file like normal, but then bittorent manages the download and finds other people downloading the same file at the same time and all the peers communicate, downloading random chunks of the file and relaying them to each other, so that you get a significantly higher transfer rate than if you were just downloading from the server. The best part about it is that it only runs for the duration of the download (unlike Kazaa, Napster, etc.) and doesn't install anything but this little download manager (basically just a dialog with a progress bar). Its open source too, so the price is right.

Posted by Jesse Ezell with no comments

Halo 2

Bungie has posted the Halo 2 gameplay video from E3. Its hot.

I can't wait till MDX is inside of X-Box, that will be sweet (rumor has it that the next X-Box will have full CLR support).

Posted by Jesse Ezell with 4 comment(s)

VSM

Supposedly, VSM linked to Chad and I in their latest issue. I have yet to recieve my copy, but I thought I would mention that the you can get a subscription to it's partner (.NET Magazine) free of charge if you fill out this form. VSM used to have a similar offer, not sure where it went though...
Posted by Jesse Ezell with 1 comment(s)

MSDN Search

"We've spent the last few months working hard with the Microsoft.com Search team to improve the experience of searching on MSDN. Our goal is to make it easier and faster for you to find what you need, so you can get back to writing great code"
[MSDN]

This has been a long time coming. Great to see that I might actually be able to use MSDN's search now...

Posted by Jesse Ezell with 5 comment(s)
More Posts « Previous page - Next page »