Home | Shorter Path | About Me
Home
About Me

Archive

2004

01

02

03

04

05

06

07

08

09

10

11

12

 

2005

01

02

03

04

05

06

07

08

09

10

11

12

 

2006

01

02

03

04

05

06

07

08

09

10

11

12


Archive for 07/2004

Selecting a COM+ server at run time
Monday, July 26, 2004 05:58 PM

I just spent a couple of hours trying to figure this out. A customer of mine has a COM+ object (plain Win32 code, written in Delphi 5). They've started using Delphi 8, and needed to access the old objects from their .NET applications. It's easy enough when the object runs locally, or when a proxy is registered for the object. The problem was trying to select the server name at run time.

In Win32, this is easy: the CoCreateInstanceEx function lets you specify the server name. Searching MSDN Library and the web, however, only gave me information about using Marshal.BindToMoniker to connect to COM+ queued components. Unfortunately, the component in question was not queued.

Of course, the answer turned out to be painfully (literally) simple:

var
  Obj: IMyInterface;
begin
  Obj := Activator.CreateInstance(
    &Type.GetTypeFromProgID('MyDLL.MyInterface', 'ServerName', True));

  Obj.DoSomething;
end;

You still have to register the interface on the client, but the actual instance will run on the selected server.

It's not about the platform
Monday, July 26, 2004 04:09 AM

A question on the Borland newsgroup has caught my eye. It's not the first time the question has been asked, and I expect it won't be the last. A developer was wondering why should we develop for the .NET framework, instead of building a Win32 application. Reading the answers, it seems to me there's a misconception among developers of what .NET is about.

One common answer is simply that .NET is Microsoft's next platform. Microsoft has put its considerable weight behind the framework, and clearly considers .NET its main application-level API in the near future. This is, in fact, a perfectly valid reason to choose .NET as your development platform, and in many cases it is the only reason needed to make such a decision.

But there are also technical considerations. The .NET framework is a platform, but it's not an operating system. Win32 is here to stay, and will be supported for a long time. Why bother with a new platform when your existing tools and skills work just fine?

It turns out the technical answer is even simpler than the "because Microsoft is big" answer: productivity. Or, to be exact, developer productivity. The .NET framework is a development platform, and is targeted at developers, not end users. End users don't care if applications are managed, or garbage-collected, or built on a common type system. Developers, however, should.

As Brad Abrams points out, the whole idea behind the .NET framework, the CLR, Visual Studio .NET, the C# language, visual designers, and other similar tools and technologies is increasing developer productivity. The less time and effort you spend on making sure your program is stable, on managing user interface elements, on memory and object lifetime management - the more time you can spend on what your application actually does.

This focus on developer productivity is what makes the .NET framework attractive for developers. Note that this doesn't mean .NET is always the right choice. Delphi developers, for example, have had a visual RAD tool and a powerful framework for years. It might make more sense to develop a Win32 application in Delphi, saving your users the need to install the .NET framework. On the other hand, the framework is extremely easy to deploy, and is already installed on a lot of machines. The technical merits of the framework (some of which are listed here) may outweigh the inconvenience of the initial deployment.

Inspiration
Monday, July 26, 2004 02:44 AM

From KC LemsonSpamusement is a set of cartoons inspired by spam subject lines. Subscribed.

New blogs
Friday, July 09, 2004 01:50 AM

Wintellect's Jeff Prosise, Jeffrey Richter, and John Robbins are now blogging. And so is Matt Pietrek.

Sidebar updated.

Hindsight isn't that great, either
Sunday, July 04, 2004 12:19 AM

Following my previous post, I've received several comments - online (it's been a while, Ralph), by private e-mail, even by phone - so I thought I'd add a little bit of information.

The text of the ad was hardly the most courageous, or extreme, the 12 men (yes, they were (many of them have since died) all men, and let's not go there right now) whose signatures appear at the bottom have said at the time. It's funny how, to them, the fact that occupation leads to resistance, terrorism, and counter-terrorism was obvious, while a lot of people still don't get it today (well, not "ha ha" funny, but you know what I mean).

In fact, even the wording of the ad was an issue of great debate at the time. The first sentence, the one about Israel's right to defend itself, was the result of that debate. Some thought it was necessary, while others thought it was as relevant as Israel's right to collect taxes from its citizens.

Another thing to consider is the message - "get out of the Occupied Territories." While this was definitely the right thing to do at the time, it can be argued that this is no longer the case. 37 years of occupation, the available Palestinian leaderships, and the inherent non-democratic structure of Israel may all require a different solution. The problems in the area of historic Palestine are far greater than the occupation itself.

One final point: when the ad was published, it referred to all of the territories occupied by Israel in the 1967 war. Although the current focus is on the West Bank and the Gaza Strip (indeed, the term "Occupied Territories" refers to these areas), Israel still occupies the Golan Heights and East Jerusalem (the Sinay peninsula was returned to Egypt). These territories have been officially annexed, but they are still occupied territories.

Copyright 2004 Yorai Aminov