IronPython or IronRuby work well for MVVM pattern in WPF / Silverlight?

I have very happily used the Model-View-ViewModel (MVVM) pattern in WPF and Silverlight applications in combination with C #. Declarative XAML and data binding are invaluable - I just can't live without them. But, this talk by Harry Pearson on dynamic languages ​​made me excited about learning a dynamic language, and I would like to try it on a new project. I love reading IronPython In Action and it contains a few WPF examples, but only with imperative-style code.

What are your thoughts on using IronPython or IronRuby at the ViewModel and Model levels in MVVM applications (versus C #)? What features make them attractive (or unattractive)? I'm interested in fundamental benefits / limitations (like AOP, duck typing, monkey patch, static type limitations, etc.) and practical ones (like performance, no current IronPython Studio for v2 , etc.). Will there be any limitations to improve since C # 4.0?

Thank,

David

+2


source to share


3 answers


Shay is right, but only for Silverlight, and I haven't used Silverlight or IronRuby. You can bind and use commands with pure IronRuby and WPF. I assume this is also the case for IronPython as they both use ICustomTypeDescriptor . there is a caveat, you need a DLR build later than IronRuby 0.9 for events.

To create an IronRuby team, you need to implement events. See this SO question for more Implementation and Interface in IronRuby, which includes CLR events

As far as creating an IronRuby object that can participate in the binding, then the transaction is an attr reader / reader that must be used for the DLR to be seen as a property.

class Bindable
  attr :some_property, true
end

      



I have a few Geists about this. Command example , Simple Bound ViewModel example AND XML-based xaml library used in the examples. They worked for me.

There are limitations. XamlLoader cannot see IronRuby classes from CLR. This means your views are REALLY dumb (code zero) or they are coming from a C # dll. This also means that you cannot create custom or custom controls that have any code without switching to C #.

Until I have a fully baked MVVM application in IronRuby / WPF, I think all the pieces are in place and I get there.

+3


source


I can say that writing WPF with IronRuby is pretty cool and if you spend a little time metaprogramming your environment it can be awesome.

However, there are drawbacks - data binding does not work with IronRuby objects (you must use CLR objects for that - see my blog post for a workaround), but this should improve .Net 4.

Please note that IronRuby is expected in RTM in November only.



Having said all this, I recommend that you check it out. You can fall for it like me :)

Shai.

+2


source


I shared my experiences testing IronPython and MVVM with WPF here . It was surprisingly easy to get started.

+2


source







All Articles