IronPython in Action

I recently received a copy of IronPython in Action by Michael Foord and Christian Muirhead from Manning so I could review it so here it is [:)].

So why am I interested in a book about IronPython? Well I used to do some Python programming a number of years ago and found the language kind of nice to work with. Working with dynamic languages like IronPython relieves you from a lot of the code you have to write just to keep the compiler happy. Admittedly the compiler complains for good reason, to make you think about your code, but often you just add casts and that is all. Now I am not suggesting we dump C# and VB and all start coding all our applications in IronPython but a mix of dynamic and static certainly makes sense to me.

But more about the book.

Part 1 is about getting started with IronPython

The first few chapters provide an overview of how IronPython and Python itself came to be and the basic syntax. The basic syntax of IronPython is not difficult to learn for C# or VB developers as Python is also an object oriented language. One things that tends to freak out people when they start is that the indentation of code matters. As Michael and Christian explain this is not a bad thing but quite brilliant as everyone does so anyway for readability purposes.

Chapter 3 is quite interesting as that explains the interoperability between IronPython and regular complied .NET objects. This is an important chapter as IronPython by itself would not be very interesting, it’s the combination with the full .NET framework and all the embedded functionality and the ease of working of IronPython where the sweet sport is.

Part 2 is about the code development techniques

Chapter 4 covers the basics of creating applications in IronPython. This covers design patterns like the Model View Controller (MVC) and how they apply to IronPython. Chapter 5 covers Python functions and how you can use some of the dynamic Python function features to read an XML document. In this chapter we get to see some of the using a dynamic language as compared to a static language like C#.

Chapter 6 is about working with properties. IronPython properties are somewhat different that C# or VB properties. Chapter 7 is about unit testing IronPython code. With a dynamic language like Python unit testing is even more important that with regular .NET code. Even though Python is a dynamic language it turns out that mock objects and dependency injection are still as much a part of IronPython unit testing as they are with regular .NET code. The chapter close of with a part about higher order testing and how to test the user interface.

Chapter 8 is about all the magic functions like __init__(self) that Python uses as a naming convention just like we use  interfaces in C#. Again some of the concepts might seem a little unusual but once you get used to them it is really quite easy.

 

Part 3 is about some of the more advanced concepts of using IronPython.

Chapter 9 covers programming Windows Presentation Foundation (WPF) with IronPython. With chapter 10 we are introduced into system administration using IronPython. This is an area where scripting languages are frequently used and IronPython is a perfect candidate. One popular choice for administration scripts is PowerShell and there is a whole section devoted to using PowerShell from within IronPython.

Chapter 11 is about ASP.NET and IronPython. Another interesting place to use IronPython is databases and web services, something covered in chapter 12.

Of course the DLR is part of Silverlight so IronPython is a prima candidate to use with Silverlight development as well. This subject is covered in chapter 13.

 

Part 4 is about about interoperability between IronPython by embedding the IronPython runtime inside our own .NET applications and extending IronPython with C# or Visual Basic code.

 

Conclusion

This book is a good read for all .NET developers who want to know about the new trend towards the dynamic languages and IronPython in particular. You get a good explanation what IronPython can do for you and how to go about solving every day programming problems. With the current push towards dynamic behavior, even in languages like C#, every experienced .NET developer should read this book!

Enjoy.

8 thoughts on “IronPython in Action

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>