Saturday, August 12, 2006

Mynx and Java Classloader "DLL Hell" or Beware What Programming Language Features You Wish to Have -- You Might Use Them

An opinion-piece or "rant" by Mike Vanier entitled "Scalability of Programming Languages" one interesting point was that of Java's classloaders in the statement "On the other hand, my colleague Donnie Pinkston, who has forgotten more about Java than I'll ever know, has pointed out that it's very easy to get into classloader hell for projects that define their own classloaders (which apparently is often necessary), so it's not all a bed of roses"

Coming from the C++ world (and DLL hell in Visual C++ for Win32) its an interesting comment, one that as a Java developer seems to be akin to saying the automobile with internal combustion engine is a "bomb on wheels so is unsafe"...theoretically possible, but in practice not so. It seems that using classloaders to create "DLL hell" is exploited on a J2EE server to load the class in its own virtual space, so multiple classloaders can load the same Java class without interference. Echidna which runs multiple Java classes (creating a multiprocess JVM) without problems does this as explained in "Understanding the Java Classloader" article.

The Java classloader is exploited on a J2EE server to achieve multiprocess functionality--but the Java classloader (if you read original articles about it) was not originally intended for that purpose -- it was to load class files off the internet, from URL's via HTTP, etc. Creating "DLL hell" seems to be the side-effect of using a feature for a property or effect...and one that Java seems to have avoided as compared to C++ DLL hell.

Since Mynx compiles into high-level language (HLL) Java/C#/C++ code...does that mean a Mynx developer will have access to a Mynx classloader? No, Mynx, as it is intended to also compile into HLL C# (and perhaps C++ code) will not export features of the implementing process language. A Mynx developer could if so motivated really write an implied method and class to get into the lower level details of the JVM, so Mynx will not stop a developer, but it will not make it a language feature. If you really want to get into the sub-language, you can, but the Mynx programming language does not mirror HLL features explicitly.

Java was originally designed as a language to create apps for smart consumer electronics devices (remember FirstPerson?) then later when this market failed to emerge, the Internet or networked computers. Mynx is a high-level application language but not for a consumer electronic device (although many programming languages wind up in use in areas where they were not originally intended...Java being a case in point), and not especially for Internet/network computers...although it is possible using the underlying Java language and JVM.

Mynx's goals and applications are outlined in the Mynx Programming Language -- the Mynx tome for the language.

A class loading mechanism seems "cool" and neat, but any feature in a programming language can open up a Pandora's box...if Java's horrific (not!) DLL hell is any example of using a feature not intended for...that change in a feature can be good or ill for a language. But at the "big picture" perspective, Mynx is simply not designed to be a Java (or even C#) replacement, so does not need to be a fun-house mirror of distorted sub-set of features. A developer "can" get into the Java underneath (another important principle is to enable a developer and programmer to do there job...a straight-jacket language is more harm than good) but the language does not make it a feature for easy use. So unless a programmer or developer "really" wants to, they will not by an easy quick-and-dirty feature in the language. C++ allows you to overload and redefine the new and delete operators, but it does not make it so easy to be quick-and-dirty...so if you want to you can, but it is not something easily done without specific intention. Intent is what programming is all about, not only what a class or method does, but how it does it.

Labels: , ,

Website Spy Software