.NET to be more like JavaScript
This was an interesting read I found today: New “Orcas” Language Feature: Extension Methods. The point of the post is to discuss a new upcoming feature for .NET languages in which developers can add their own methods to objects without touching the class definition. Essentially, at any point you can add a method to any class such that all instances will have it. This is just like JavaScript, and it works for all .NET languages!
The ironic thing is that it allows you to do what I always tell people to avoid: you can’t modify objects you don’t own. While it’s possible in JavaScript, and fun to do as a hobby (most of my hobby scripts modify some object or another), it’s not a good idea to do in production code. There’s already too much stuff going on in a developer’s head to make them figure out whether a method is native or not. I know they’re trying to make .NET as extensible as possible, but whatever happened to creating a subclass or using the behavior pattern? :: sigh ::