Tuesday, 04 July 2006
Have you seen the IronPython integration project in the June VSSDK?   Aaron Marten and Team have done an outstanding job integrating IronPython into the Visual Studio IDE.  I have lived in Visual Studio since 1997, and can say that the IronPython integration is totally pro.
 
In the VSSDK path C:\Program Files\Visual Studio 2005 SDK\2006.06\VisualStudioIntegration\Samples\IronPythonIntegration you can find the IronPython.sln solution file for the IronPython Project System which features include:

 Defines a VSPackage that controls the interaction between Visual Studio and the IronPython compiler.
 Participates in building, deployment, and source code control.
 Includes MSBuild targets and templates.
 Offers debugging support, but no expression evaluator.
 Displays and manages project items in the Solution Explorer.
 Participates in the Open Project and New Project dialog boxes.
 Exposes project and configuration properties, both generic and specific to IronPython, such as the "main" program file.
 References web services, databases, and other resources, but not other IronPython assemblies.
 Supports automation.
 Connects the Windows Form Designer to the IronPython CodeDom.
 Press F5 to build the sample, register it in the experimental hive, and start Visual Studio from the experimental hive.

The last statement is interesting.  For anyone that has used the pioneering DSL Toolkit knows that running this solution will launch another instance of Visual Studio, and in this case, complete with the integrated IronPython project system now running.  If you click on New Project, the following dialog appears:

And sure enough, the PythonPoject is fully integrated into this instance of Visual Studio 2005.  It works just like a C# Project Type, for example.  In other words it is seamless and consistent within the Visual Studio IDE paradigm.  A real testament to Visual Studios pluggable language architecture.

I developed a small IronPython Windows app to try it out.  I wanted to see how the Win Forms Designer generated the IronPython code and what it looked like compared to C# Windows Forms apps.  So I dragged a ListBox onto the Design surface.  Yes, all of the WinForm Designer and toolbox are there.  Then in the Form code, I called System.Reflection to get the Types from Mapack.dll and then add the Types to listBox1.  Currently there is no support for Partial classes so the Designer code and your Form code are in the same file.  One way around this is intelligent use of VS #regions to package code bundles in the same source file.
 
Btw, the Mapack.dll is an excellent example of the type of reusable Assembly I am talking about with respect to software industrialization.  Here is an encapsulated package of Math functions that you can just plug-in to your application.  A good abstraction and packaged at the right level in my mind.
 
My only complaint is that the Mapack.xml code documentation file did not come with the DLL.  I wish the VS IDE came with a compile option to include source code documentation in the Assembly.  As I have mentioned elsewhere, I think having the source code documentation in a separate external file breaks an encapsulation principle in my opinion.  And the first thing to get lost, yes?  Plus if I want to program Assemblies instead of source code files, then it would be nice to be able to retrieve the documentation through System.Reflection as it seems you can do everything else with this namespace.
 
Note the IronPython Visual Studio project is the bottom most Application on the screen.  When that is run, another instance of Visual Studio is created with the IronPython project integrated into the running instance.  Then I opened up a IronPython windows application project called, Browser1.  Running that project launches the small windows app with listBox1 populated with the Mapack.dll Types.  You can see the IronPython code in the Browser1 project to the left of the Windows app and on the far right, you can see the 5 projects that make up the IronPython VS integration project.
 
 
Another cool integration point is the IronPython interactive console that is directly integrated into the Visual Studio environment on one of the tabs:
 
 The console window is a tool window that creates a TextBuffer object and hosts a TextView control that is initialized to use the text buffer.  The interaction between the console window and the IronPython engine is handled by the implementation of the IConsole interface and the definition of the streams used by the engine as standard output and standard error.  The history is implemented using a class called HistoryBuffer that stores the list of commands executed inside the console, sorted by execution order.  Statement completion and colorization are implemented using the same IronPython language service that is used inside the standard editor when editing a py file.  The different behavior of the language service in the editor window and console window is implemented using one functionality exposed by the IronPython language service through its version of the Source class. This object, defined in the MPF, is an abstraction on top of the text buffer and text view.
 
Wow, when I read that I was expecting a super deluxe console window and it is.  Now thats an interactive console window!
 
 
As you browse the source files in the PythonProject you will also notice several XML Overview files, Class Diagrams and test suite metrics for each project.  Nice.
 
If you are a Visual Studio code jockey, do yourself a favor and have a look at the Visual Studio IronPython integration project, its as pro as it gets in our software development world.  Kudos to Aaron and team!
 
If you want to tune in to the IronPython world, I would recommend that you visit CodePlex to get IronPython and sign up to the Listserver.  Dino and crew are extremely helpful in answering any questions that are posted.  The IronPython community is vibrant one with daily action.
 
Finally, if you are a statically typed programmer feeling a bit shackled by a universe that the compiler creates, unshackle yourself and enter a universe that is still dynamic after compile time.  You owe it to yourself to check out the IronPython integration project in the VSSDK.
Tuesday, 04 July 2006 20:35:38 (Pacific Standard Time, UTC-08:00)  #    Comments [0]Trackback
© Copyright 2007 Mitch Barnett - Software Industrialization is the computerization of software design and function.

newtelligence dasBlog 1.9.6264.0  Theme design by Bryan Bell
Feed your aggregator (RSS 2.0)   | Page rendered at Wednesday, 11 July 2007 08:21:37 (Pacific Standard Time, UTC-08:00)