Extreme Programming is a discipline of software development based on values of simplicity, communication, feedback, and courage. It works by bringing the whole team together in the presence of simple practices, with enough feedback to enable the team to see where they are and to tune the practices to their unique situation.
Let's see how Python fares in light of the 4 core XP values: simplicity, communication, feedback and courage.
1. Python fosters simplicity
- Clean and simple syntax reads like pseudo-code
- Built-in high level data types (strings, lists, tuples, dictionaries) make it possible to pack a lot of functionality in very few lines of code, without sacrificing readability
- As an exercise, try to port Java code to Jython: you will see a significant reduction in line count (as much as 40% in my experience)
- Powerful yet simple idioms enable developers to clearly communicate their intentions through code
- Python just lets you code and doesn't get in your way -- see ESR's classic "Why Python?" article
- Standard coding style enforced by significant whitespace enables people to better read code, maintain it, and communicate about it
- Modules such as doctest provide "executable documentation"
- Dynamic, interpreted nature of the language shortens development cycle and closes feedback loop more quickly
- Interactive shell session provides instantaneous feedback
- Various unit test frameworks (unittest, doctest, py.test) are available for feedback via frequent unit testing
- This really stems from the other 3 values: if you can write code that is simple, provides quick feedback and can be easily understood by your peers, then you have the courage to "go confidently in the direction of your dreams", to quote Thoreau
- Courage in the XP sense also means having the guts to throw away code that doesn't work and start afresh; since the simple act of coding in Python produces pure pleasure, it follows that throwing code away and starting to code anew will be felt not as a chore, but as a chance to improve and, why not, attain enlightenment
8 comments:
Could not agree more. My only hope is that the community restrains its desire to add funky new features (the ongoing discussion around types) without first considering what can be done with what is already available.
For example, here's a snippet using a "spec" provided by pure python functionality in the the "Dulcinea" compliment to Quixote, a web development tool kit.
subject_is = any(str, sequence(SubjectClass))
... and later in some code doing a test for validity before doing some useful work, a simple:
require(subject, subject_is)
dulcinea.spec, which makes something like that this less than mind-bending and without litering the code with a bunch of isclass/isinstance tests makes it possible to write classes which can easily be adapted to fit a wide range of requirements, often by just overriding a single "spec" line rather than whole methods.
Neat and useful contraints in what I think is a pretty readable manner - or at least readable to anyone wiht passing python familiarity. What's more, I don't have to be a C or OO uber-programmer in order to find use from this - touching on your courage comment.
Clean and readable syntax is the key from which all things flow.
PS:
http://www.mems-exchange.org/software/dulcinea/ - the "spec" component is not specific to Quixote or web programming. Under 550 lines of code and no dependencies.
Cool! Thanks for the comment and for the link. I wanted to start playing with Quixote and this may be the kick in the rear that I needed.
subject_is = any(str, sequence(SubjectClass))
???
It is correct?
Jordan, I can surely point you to a Python Interest Group, since I am the organizer of the SoCal Piggies, i.e. the Southern California Python Interest Group.
You can find the group's home page at http://socal-piggies.org/scp.
You'll see there a link to a mailing list you can join and use to post your message.
Hope this helps,
Grig
Vista, it is correct.
BTW, nice blog.
Mike.
Pete, in my opinion vista is not correct. But blog is very usefull. I'm still reading...
what's the secret to great writings? rewrite
rewrite is not the same thing as edit
and python promotes rewrite ... so does lisp ... because it's so cheap to develop; there's little 'risk' on 'investment'
Post a Comment