Posts Tagged ‘.Net’

State of alternative languages on the CLR?

lördag, maj 1st, 2004

A big selling point in the initial marketing of the .Net platform was that it was supposed to enable code written in different language to interoperate smoothly. I always looked at that claim with a fair amount of suspicion, probably since I remember what it was like to develop classic ASP with Perl. If you remember, ASP was supposed to be usable with any language that supported Active Scripting, and ActiveState brought out a Win32 version of Perl that did. However, I never got it to run as smoothly as with VBScript (If I recall correctly, I had the most problems with getting ADO calls to work right), and since it was a “unsupported” language, I couldn’t find much help on the net. I was hoping that this time around, Microsoft would try harder to make programming in third-party languages a reality.

Now, while the CLR is designed to run IL code which is language-agnostic in theory, it’s seems obvious to me that the CTS was designed for imperative, object oriented language with strong(-ish) typing, and in particular the C# language. It do not lend itself readily to typeless,dynamic, functional and/or logical languages. Articles like Dynamic languages and virtual machines by Jon Udell and “Ignoring the Scripts” by Larry O’Brien state that noone is using dynamic languages on the .Net platform to any large degree.

However, while I was researching Smalltalk for the IDG.se column, I stumbled across #Smalltalk that seem to be a fairly useful Smalltalk implementation that compiles to IL code. Also of interest is S#.Net, a dialect of Smalltalk-98 that also runs on the CLR.

Some of the other languages that have been made to run on the CLR are:

All these languages are pretty far from being strongly-typed imperative languages, so it seems that it is indeed possible to use more dynamic languages on the .Net platform. Indeed, Jim Hugunin, the author of IronPython (and Jython, the Python-on-JVM implementation) notes that while his initial intention was to write an article titled “Why .NET is a terrible platform for dynamic languages”, he ended up with the conclusion that the CLR is indeed a good platform for dynamic languages. My question is: Is anyone using these languages on the .Net platform in real projects? I’d be very interested to hear any success stories.

Keith Brown on managed code security

torsdag, mars 25th, 2004

This is an interesting article about code security in the CLR, and how little teeth the declarative security features in the CLR have when it’s running fully trusted code. I did know that some naughty things (like calling private methods) was possible using reflection, but I was under the assumption that IStackWalk.Deny() trumphed most anything. In the article, Keith shows how to malicious code can get around that and also AppDomain separation — if the assembly it’s in is marked as FullTrust.

Fully trusted code can get around all of the CLR’s built-in security features. That’s why it’s called fully trusted - it must be trusted to do the right thing.

Abstract UserControls and VS.Net designer wierdness

onsdag, mars 17th, 2004

I’m writing a bunch of user controls that each acts as a “page” in a wizard-style application. The setup, teardown and state management in each user control class are similar. I’d like to have an abstract base class (let’s call it AbstractPageBase), that inherits from System.Windows.Forms.UserControl and rovides a implementation of the setup and teardown stuff, with calls to abstract methods (eg GetPageStateFromDatabase) that the derived classes override to plug in their custom initialization code.

And it works fine. The stuff compiles and works as expected. The problem is when I want to look at a derived component (let’s call it MyDerivedPage) using the VS.Net form designer. I get an error message stating that the designer must create an instance of PageBase, but fails since it’s abstract.

If I make PageBase non-abstract (changing all the abstract methods to virtual), the designer can show derived controls. But that’s annoying, since I’m not guaranteed to override all the methods I need to override. Furthermore, I cannot understand why the designer needs to create an instance of the base class of the control I want to edit. Why doesn’t it create an instance of the actual control instead?

Update: Jacob Grass explains why this is, and how to work around it.

Today’s .Net framework lesson

måndag, mars 15th, 2004
System.Enum.Parse (and it’s logical counterpart, System.Enum.Format) rocks. That’s all for today.

Circles, Triangles and Rectangles

onsdag, januari 21st, 2004

It seems that Microsoft is working with Cambridge university on a extension to C# called “Xen“, aimed at simplifying access to XML and RDBMS data by making advanced data access a first-class member of the language itself, rather than using libraries, and going way beyond simple extensions like typed datasets and JAXB.

While I do like small, powerful languages like scheme, I actually think that these ideas have their merits. I remember how differently I would approach a problem in Perl, due to its first-class inclusion of associative arrays, regexps and data binding (the tie() system), and in this article from ExtremeTech, I get the feeling that I would be able to tackle more complex relational data in totally new ways.

I’d recommend reading the article first, then the actualpapers. So far, I’ve only skimmed the papers, but I think that if they get this right, it could be pretty powerful. And innovative.

Also, as pun-inviting as the name Xen may be, I am thankful that they dropped the original name: X#…

I actually do some programming every now and then

fredag, januari 16th, 2004

It seems that J2EE oriented developer site TheServerSide has opened up a sister site oriented around the .NET platform, naturally called TheServerSide.NET. Not being a J2EE developer, I haven’t read much from TheServerSide, but I do recall there being some controversy about their involvement in a .NET adaption and benchmarking of Suns “best practices” example “Pet Shop”. However, I do believe they had fairly good reputation up till that point at least.

The new site looks interesting, and has a RSS feed, so I’ll be keeping an eye on it. Already I’ve found this interesting article linked from it, about how to keep control over the design of your URL’s in the ASP.NET framework. I like it when people care about how their URLs look.

Speaking of URLs, the ones provided by this blog look pretty ugly. The BlogX software I’m running seem to have been superceded by dasBlog, and I was thinking about upgrading to that, but then I got to read Martin Fowlers WhatIsABliki, and decided that it would be so more much worthwile to think about what could be done with a Wiki-style approach to publishing. Ideally, I would like to have something that I post to like it was a blog, but where posts that deal with the same subject gets aggregated into Wiki-style articles over time.

In fact, that is what I wanted to do with The swedish punk/hardcore archive (SPHA) (Now I’m gonna get soooooo many google hits from people looking for “swedish hardcore”), like eight years ago, only neither blogs or wiki was established at that time. I am such a visionary.