Pro IronPython: Explore the combination of the poppular Python language with the powerful Dot NET framework
Download
Introduction
Is This for Me?
IronPython and the .NET framework are very approachable to new developers. The tools
are free, and there is an overabundance of both documentation and skilled developers
who are happily sharing their knowledge with the world. The barrier to entry is supremely
low these days.
If this is your first programming book, so be it! Come along for the ride. You’ll see
both sides of the programming fence, for you’ll find examples here in IronPython and
C# as well as an entire chapter devoted to getting the two to play happily and nicely with
one another. I also cover many basic programming fundamentals as well as the advanced
stuff. You’ll get exposed to multiple languages and the .NET framework by the time we’re
through.
If you’re already versed in Python but not in .NET, you might just find that you can
get your programming tasks done a lot more easily with the tested and powerful .NET
framework behind you.
If you already know both IronPython and .NET, this book should make for a good reference
of various tricks and techniques, particularly in the realms of language integration
and web development.
An Overview of This Book
Being an IronPython developer can mean a lot of things. You could write software to be
run via the command line, as a Windows Forms application, or as a web application. That
means we have a lot of ground to cover. We need both to address IronPython syntax as
well as to look at how it fits into the larger .NET framework.
Chapter 1: Introduction to IronPython
The introductory chapter provides you with a little background on Python and
IronPython as well as on the .NET framework itself. We’ll look at what constitutes a
dynamic language and contrast it with a static one. Then we’ll get ourselves a copy of
IronPython and immediately try our hand at a sample and see how the language works.
Chapter 2: IronPython Syntax
IronPython has a rich but straightforward syntax and many built-in functions that
make your life easier as a developer and ensure you don’t have to reinvent the wheel.
This chapter looks at that syntax but does not yet cover interaction with the larger .NET
framework. In fact, it will become apparent that you can actually write entire IronPython
applications that don’t really make use of the framework at all, allowing Python developers
to ease into the .NET world quite easily and gradually.
Chapter 3: Advanced IronPython
As with most programming languages, you can use the simplest syntax to express the
most complicated ideas. In this chapter we’ll expand what we know and look at more
complex data constructs, base classes, and object-oriented design principles.
Chapter 4: IronPython Studio
This chapter focuses on IronPython Studio and how you can use it to speed your development
process. Up until this chapter the code has been entered entirely using the
command-line IronPython interpreter. It’s time to kick things up a notch and begin
working with the Integrated Development Environment and also to begin working with
Windows Forms applications.
Chapter 5: Mixing and Mingling with the CLR
It’s difficult to really know and understand a language until you’ve built something with
it, hit some walls, and learned how to take an application from design to implementation.
In this chapter we’ll begin making heavy use of the .NET framework and build the distant
cousin of a very familiar application from the ground up. We’ll pay special attention to
points where the .NET framework can save us time and energy, especially when coupled
with the IronPython Studio IDE.
Chapter 6: Advanced Development
One of the coolest things about IronPython is how easily it can be used with other .NET
languages. This chapter is all about how to employ IronPython as a scripted plug-in manager
in a C# application. The plug-in system is designed to be straightforward and simple,
and it should prove to be a good starting point for your own improvements and customizations.
It can really save you endless hours of work if the need arises for extensibility
in an existing application (or if you just want to add something neat like that at the very
beginning).
Chapter 7: Data Manipulation
This chapter covers communicating with SQL Server and how to use Structure Query
Language (SQL) to work with the database via IronPython code. I’ve also provided advice
on how to protect yourself and your users against malicious entities who might try to use
specially crafted SQL to circumvent your security
Chapter 8: Caught in a Web
If you’re interested in web development, search engine optimization, and standards compliance,
this chapter will be of special interest because it provides insight into all these
areas and how IronPython helps you achieve the results you want. You’ll find useful tips
like how to do cross-page PostBacks, how to prevent arbitrary code injection, and more.
Chapter 9: IronPython Recipes
This final chapter provides a lot of varied snippets for many aspects of console, desktop,
and web development, ranging from design patterns to search engine optimization tips,
along with a final message for readers who kindly explored IronPython with me.