Python Programming, news on the Voidspace Python Projects and all things techie.

Silverlight Articles and Examples Updated

emoticon:globepage I've finally updated my IronPython & Silverlight articles and examples for the latest (and final) release of Silverlight 2. All the examples are online and available for download:

There are five articles and 6 different projects online and to download - plus a couple of C# projects that are download only.

One of the C# examples demonstrates embedding IronPython in a Silverlight application: Embedding IronPython in a C# Silverlight App.

Even better, my IronPython Web IDE is the featured project on the Silverlight Community Gallery.

A hybrid JavaScript and Silverlight application that allows you to edit and create IronPython code and then execute it in Silverlight. You have full access to the Silverlight control and the HTML DOM, making it useful for experimenting with the Silverlight APIs. It comes preloaded with examples illustrating accessing the browser DOM, loading XAML, threading, making network requests, and using controls.

The latest version has a new example - creating an animation from code using the StoryBoard class. This never used to work when run from inside the Web IDE; a bug that has been fixed in the final release of Silverlight 2.

Like this post? Digg it or it.

Posted by Fuzzyman on 2009-01-22 22:23:40 | |

Categories: , Tags: ,

PyCon 2009: Testing GUI Applications and IronPython Tutorial

emoticon:html The list of PyCon 2009 Talks is now up. Mine is first, one of the advantages of submitting early [1]. Smile

The tutorial schedule is also up: Tutorial Day Schedule.

There's a fantastic selection, but of course I'm going to talk about my talks. The list only has a summary, and the detailed information you give to the talk reviewers doesn't get published. I'll be giving a talk on the Functional Testing of Desktop Applications, and on the Wednesday before the conference starts Jonathan Tartley and myself will be giving a tutorial on Application Development with IronPython.

Functional Testing of Desktop Applications

Testing GUI applications is difficult, but not only is it possible - it can be an important part of improving your development processes.

This talk will cover principles and techniques for the 'functional' testing of desktop GUI applications. This means driving the application from the outside (from the point of view of the user) and testing that the application actually works!

Unlike unit testing, which tests your code units in isolation, functional testing exercises the wiring together of your components and tests that your features work as specified.

Part of functional testing is the writing of good "user stories" (a human readable specification) for your features, and then turning this specification into executable test code. In this way, as well as testing the application your user stories together act as developer documentation and specification.

Some people think GUI testing is so hard that it isn't worth the effort. This hasn't been my experience. This talk is based on my experience of testing a spreadsheet application with Resolver Systems.

The talk will explore the processes and techniques of functionally testing a desktop application, including:

  • Why test functionally (including some unexpected benefits)

    • Why test at all?
    • What is functional testing?
    • Is it even possible for GUI applications?
  • The processes and infrastructure around automated tests

    • Test Driven Development
    • User stories
    • An automated build
    • Continuous Integration
  • How to functionally test - general principles and specific examples

    • Functional test as specification
    • Test framework as Domain Specific Language
    • Starting the application under test
    • Application specific hooks
    • Interacting with the application
    • Performing blocking actions
  • Difficulties and fragilities - and how to minimize them

    • Adapting to change through abstractions
    • Timing related issues (wait for condition pattern rather than voodoo sleeps)
    • Hard to test components / specs (printing & UI aesthetics for example)
    • Alternative testing tools

The specific technologies used for the examples are IronPython and Windows Forms, but they aren't the focus of the talk. Far more important are the general techniques (which are applicable to other GUI toolkits) and how a test driven approach with iterative development means that you create a testable application (with application specific hooks to make functional testing possible).

Different approaches to functional testing are discussed (driving the application as an external process with OS hooks, or my preferred approach of driving it in process through the GUI toolkit). Some GUI frameworks (PyGTK for example) make this harder than it should be by making it difficult to invoke actions onto the event loop thread from another thread. Possible ways round this will be mentioned but not explored in depth.

Various different patterns (wait for condition, async executor) useful for functional testing and not tied to any particular platform will be discussed.

Application Development with IronPython

A tutorial on "Developing with IronPython": Python for .NET and Mono. The Common Language Runtime is very different to CPython, with a powerful JIT compiler, and different garbage collection and threading model. More importantly, .NET's huge range of libraries can now be used from Python.

Various aspects of developing with IronPython will be covered and attendees will put this into practice by extending an example application. Topics include:

  • Differences between IronPython and CPython, including "Why Use IronPython?"
  • Introduction to the .NET framework - a dynamic language on a statically typed framework
  • GUIs with Windows Forms
  • Databases
  • Network requests and web services
  • Handling XML
  • Threading

Come with laptop - running Linux, Windows or Mac OS X - and ready to code!

You can find full details of the tutorial, including the areas we will cover and the attendee requirements, on the Application Development with IronPython Page [2].

Many thanks to Resolver Systems who are sponsoring Jonathan and I travelling to PyCon 2009, hope to see you there!

[1]Of course, not everyone thinks this is a good thing. Wink
[2]New versions of Mono have been released since the tutorial proposal was submitted. I need to update the page, but Mono 2.2 is the best version to use.

Like this post? Digg it or it.

Posted by Fuzzyman on 2009-01-22 21:17:09 | |

Categories: , Tags: , , ,

Resolver One Spreadsheet Challenge: First Round Winner

emoticon:objects Resolver Systems is running a competition (The Spreadsheet Challenge), for the most innovative use of Resolver One.

Each month up until May the best spreadsheet application created with Resolver One will win its creator $2000. The best overall will win an additional $15000.

The first round is over, and we had some really interesting entries. The winner of the first round is Siamak Faridani:

Siamak is a PhD student at the University of California, Berkeley, whose spreadsheet to estimate the electrostatic field around Micro Electro Mechanical Systems wowed the judges with its integrated use of the grid and programming, and in particular with the beautiful graphs it generates using gnuplot.

The spreadsheet itself says:

This worksheet can solve Poisson partial differential equations (PDE). In order to solve this PDE, an iterative method is used instead of a Gaussian elimination. The following problems can be easily solved and visualized using this spreadsheet:

  • Electrostatic analysis of micro chips
  • Seepage underneath a dam
  • Thermodynamics problem and heat conduction

Here's a screenshot of his spreadsheet (click-through for a larger version of the image):

Screenshot of the Poisson partial differential equation solving spreadsheet

His spreadsheet has an interesting UI, with buttons for loading and saving the model data and for generating the images. Once it has created the 2D or 3D plots it pops up modal forms to display them. Nice. Siamak reckons that this kind of electrostatic analysis of a microchip would normally require software costing $20,000!

You can download his spreadsheet and have a play with it:

The functionality is implemented in Python in the user code (IronPython of course), so as well as playing with it you can see how it performs its magic.

We will make other competition entries from the first round available for download shortly. The second round is now underway...

Hosted by Webfaction