Tag Archives: CLR

Dynamic Languages on the CLR

Jim Hugunin and John Lam

Jim created Jython and IronPython.  John is working on Ruby for the CLR, but has only recently transitioned to working for Microsoft.  I get the impression that Ruby for the CLR will be released Really Soon Now.

Just as I was getting grumpy about not having an interactive conversation, Jim and John came on to do the Dynamic Languages on the CLR talk. They turned it into a completely interactive conversation with no Powerpoint. They even turned some of the questions around to the audience, asking for our input. This was SO much more interesting for me, at least, and for the speakers as well, I expect.

The guys took questions:

1.Ruby or Python: Which sucks less? Use the language that fits your mind best. Some people work well in Python. Others have that same experience with Ruby. It’s not necessarily a fundamental difference in languages, but rather a difference in minds. Not a huge argument that one is superior to another. But comparing either to Javascsript is a different question. That language is impoverished. Doing DSL tricks is easy in Ruby and allows people to write closer to the problem domain.

2.How are you going to lock us into your platform? IronPython has always been about being completely compliant implementation of Python and completely integrated with .NET. To do both is a lot of work. So, in Python “strip()” removes whitespace, but in .NET “Trim()” removes whitespace but is illegal in Python. But if you import clr, then for that file ONLY it is allowed to run s.Trim(). So the parts of your code that are doing pure data structures or pure algorithms can ignore whether you’re working in IronPython. Being up front about wanting people to lock into .NET. By providing really cool libraries, they will lock programmers into .NET? Strength is that you can write Mac-specific or .NET-specific code. Pure Python code works everywhere. Python has a huge wealth of pre-existing modules. Those written in Python will work (or it’s a bug in IronPython). Those that are written in C are more problematic. FePy project is a community based project that includes a lot of modules that fill in these gaps.

3.What is the plan for PHP? Would PHP running on .NET, would that be convincing to switch. Not really, so it doesn’t really look like there’s interest. Microsoft is doing dynamic languages because it’s interesting to a group of developers.

4.What is it going to take for Rails to run on top of .NET? Imagine it happens. Is it a good idea? Deployment is a pain in Rails. Want to sell into .NET companies in the enterprise. What it’s going to take is a good business reason to want to use it. Developers need to want it.

5.When is the veil of silence going to be limited? Jim went dark for 8 months after coming to work at Microsoft. IronPython is being run as an open source project with an open mailing list. IronPython 1.1 was just released. Incremental releases were driven by user bug reports in an open, interactive way. Python 2.0 more modules, end of year. John’s only been at Microsoft for 2 months, so he will start becoming more open soon.

6.Why dynamic languages? There are millions of programmers who clearly love dynamic languages. It works for them. Let them program in a way that they enjoy and can be productive. More expressive. First refactoring tool written for Smalltalk. First unit testing framework written for Smalltalk. Good ideas have come out of the dynamic language community.

7.Do we want to run the CLR in IE? Killer fast Javascript and Ruby in the browser would be compelling. Performance is the big thing. Testing, running javascript on IE. As we create more sophisticated apps, there’s no visibility in the CLR. But, would you put it in Firefox too?

8.Mono? Mono doesn’t work well. Winforms and GTK# and supposedly it’s compatible. Some say it runs beautifully and some say it doesn’t run at all. Mono regularly runs IronPython.

9.Should dynamic languages be an Intro CS100 language? Yes, dramatically lower barrier to entry. Number of things you need to know to write a program in a static language: classes, methods, static method calls. In dynamic languages only need a function call or statement to write Hello World. If you want to talk about the essence of programming, it’s about control flow and data structures, not types. But the lower concept count means that people with less programming experience can write in dynamic languages. Means that it might have an impact in terms of nonprogrammers writing code. Introducing patterns on top of the language adds a different level of complexity. Malleable syntax in Ruby allows for custom languages like Rails DSL. The ability to create DSLs in Ruby is interesting.

10.What about IDE support? Today, for IronPython, Visual Studio SDK shows people how to extend Visual Studio. It includes IronPython integration (all written in C#). Minimal intellisense support, ships as a sample. Left to developers to extend. The lightweight solution to an IDE is a real challenge. Can use the debugger today. The best part of IronPython/.NET integration is availability of the debugger. Profiler works poorly. Infrastructure issue that needs to be solved fairly soon. RubyCLR: John demo’ed an IDE that he worked on before he came to Microsoft. He was running on a Mac, running RubyCLR. He used WPF with Ruby, using Ruby metaprogramming stuff. This enabled him to reduce the number of things he had to type.

Java Posse Roundup: Day 4


Friday, March 9

Friday was the final day for the Java Posse Roundup. We had 2 regularly scheduled sessions followed by a final session which included everyone.

For the first session of the day, I attended a session on JNI, convened by Josh Marinacci of Sun. A major part of the discussion centered around the idea that perhaps JNI is overly complex for what people often use it for these days, and that maybe some assumptions CAN be made about the atomicity of calls made in the JNI (if the programmer says it’s so). Maybe we should have JNI, as it currently exists, and also JNILite.

JNA is also a good replacement for many of the common usages of JNI. Instead of the programmer writing JNI code, annotations are used to access native libraries, all without writing a single line of native code. Interesting perspective arose that there aren’t many Java programmers who actually WRITE C code anymore, and so the availability of something like the JNA is a good thing.

Many comparisons were made to Microsoft’s CLR and unmanaged code.

And, a lot of us remember the old recommendations to AVOID doing things using JNI because it wasn’t “pure Java”. Well, it sounds like we need to get past that, and use the right tools for the job. If it needs to be in native code, write it. Josh did a really cool demo during one of the lightning talks where he wrote a small amount of JNI code (I think he said one line!) to communicate with the motion sensor on his Mac, using that motion to change a display shelf of pictures to move to the next page. VERY cool! And totally impossible if you wanted to avoid JNI code, since the PCs don’t generally have motion sensors. We really need to be able to use the native interface for things like this, and for creating innovative user experiences. Maybe instead of scaring people away from the JNI, we should come up with some recommendations and (dare I say?) best practices for its use.

Next, I went to a discussion of applets, positioned as “Applets: Does Java need an answer to Flex?”. Very quickly, it became apparent that there was agreement that applets have a certain “suck factor”. When the audio of this session becomes available on the Java Posse, this is something that I think both Java programmers and Microsoft programmers will find interesting.

With applets, there’s simply not enough attention paid to detail. Flash, on the other hand, provides a user experience where you can’t really even tell that it’s a Flash app because the plug in was done so well.

The recommendation was made that we change the applet architecture. Perhaps a 2 phase load would make sense. Everyone agreed that a spinning Sun logo, reminding the user that s/he’s waiting on a Sun applet is bad marketing! The slow loading is not in the JVM, but rather in the plugin.

A competitive requirement is that desktop apps can directly connect with web apps. And pretty much all agreed that Flash is winning on web for user interface from a Java perspective. A great amount of stress was generated in the group, centered around how to move forward. Waiting for Java 7, even as Java 5 is still being rolled out into corporate environments, probably means death for Java. The question was ultimately raised, “Is it worth solving this problem?”. I agreed with the group of people in the room who don’t believe in playing catch-up, not with Microsoft, not with Adobe. Pick the sweet spot that Java has and work in interoperating with Flash using Flex. Forge an alliance with Adobe.

IMO, Microsoft would take both paths. They would fix the plugin AND they would forge an alliance with Adobe. I don’t know if Java will take that direction, and that’s OK as long as they don’t continue trying to play catch-up.

This session was ultimately attended by everyone who was still in the building. Little by little, the crowd grew. The energy was amazing. The audio for this session will be incredible, and I would urge anyone to listen to it, both for the ideas and for feeling the energy of an open spaces event.

The last session of the day was the closing session for the conference. We all met together, and went around the room to suggest what improvements could be made. The appreciation for the Open Spaces format was evident the night before, when the Java Posse did a live podcast recording at the house that they were renting. And Camp4Coffee got a big plug too (“second best consistent coffee in the US, according to Pete from Australia).

Anyhow, so instead of asking how people felt about the event, format, etc., the question was asked about what could be improved. This was all recorded, and will be made available through the Java Posse at some point. My suggestions included involving the people at home more. Since the Java Posse podcast has a large audience, of which only a tiny percentage actually attended, I feel like somehow keeping the people who couldn’t come involved would be a great way to build the community and keep events like this populated in the future. As it was, I think that when registration opens for Java Posse 2008, the event will sell out quickly.

For those of us who have attended several of these events, we’re cautious about changing much about the format. It works. Tread lightly so as not to break it. But one thing that a lot of people suggested was ancillary to the conference itself, and more personal in nature. It would be nice to be able to include the spouses and families in a more formal way. Bruce and I have talked extensively about arranging childcare in Crested Butte so that my family could come (without my husband being in a hotel room with 2 kids, staring off at the snowy mountains that he can’t ski). Others echoed this. Even for those who wouldn’t be bringing kids, it would be nice for the spouses to have a parallel board, where they could arrange activities among themselves. That really relieves the pressure on people who are feeling guilty about leaving families at home!

As it was, many of the spouses attended the lightning talks in the evenings. If there had been scheduled spousal activities, people felt that their spouses would have wanted to attend. I’m looking forward to that in the future, even if my spouse ends up being the only male in the group!