Archive for July, 2011

Agile 2011 Event: Tango, the Stance of Reaction, and Pair Programming

In the Agile2011 fringe, I’ll be doing a session with that title. Here’s my blurb:

One of the characteristics of Agile is that it favors the reactive over the proactive. For example, you grow the program in response to new feature requests rather than needing to know all the features in advance. Programmers regularly talk of reacting to “code smells” or paying attention to “what the code’s telling us”.

Being appropriately reactive is a skill. You’re not born knowing how to attend to subtle details, or how to react in a graceful, helpful way.

Skills can be taught. All over the world, people are learning the complementary skills of leading and following in tango, an incredibly improvisational and reactive dance. I believe the learning techniques tango instructors use can be adapted to learning other kinds of reaction—like the reactions of pair programmers to each other and to the code.

In the first part of this session, I’ll teach you some simple tango moves. We’ll concentrate both on learning the moves and also on how we’re learning the moves.

In the second part of the session, we’ll break out computers and write programs or tests (or collaborate on some other task of your choice). Will you be able to react more appropriately to your pair? Will you give off better signals? Will consciously practicing the skill of pairing help you be better at it? We’ll see!

Important note: In my experience, most people are more comfortable learning to dance with someone of the opposite sex. I’ve also noticed that there are a lot more male programmers than female programmers. I worry the title will attract only programmers, leading to a big imbalance. So I encourage everyone to encourage women at the conference to attend at least the first half of the session. They’ll get something out of it (beyond an introduction to tango).

Functional Programming for the Object-Oriented Programmer

Here is a draft blurb for a course I’d like to teach, possibly in Valladolid, Spain, in September. I’d like to see if enough people are interested in it, either there or somewhere else. (There’s a link to a survey after the description.)

Short version

  • Target audience: Programmers who know Java, C#, C++, or another object-oriented language. Those who know languages like Ruby, Python, or JavaScript will already know some—but not all!—of the material.

  • The goal: To make you a better object-oriented programmer by giving you hands-on experience with the ideas behind functional languages. The course will use Clojure and JavaScript for its examples. You’ll learn enough of Clojure to work through exercises, but this is not a “Learn Clojure” course.

  • After the course: I expect you to return to your job programming in Java or Ruby or whatever, not to switch to Clojure. To help put the ideas into practice, you’ll get a copy of Dean Wampler’s Functional Programming for Java Developers.

Syllabus

  • Just enough Clojure
  • Multimethods as a generalization of methods attached to objects
  • Protocols as a different approach to interfaces
  • Functions as objects, objects as functions
  • Mapping and folding in contrast to iteration
  • Functions that create functions
  • Laziness and infinite sequences
  • Time as a sequence of events
  • Generic datatypes with many functions versus many small classes
  • Immutable data structures and programs as truth-statements about functions
Interested?

Longer version

Many, many of the legendary programmers know many programming languages. What they know from one language helps them write better code in another one. But it’s not really the language that matters: adding knowledge of C# to your knowledge of Java doesn’t make you much better. The languages are too similar—they encourage you to look at problems in pretty much the same way. You need to know languages that conceptualize problems and solutions in substantially different ways.

Once upon a time, object-oriented programming was a radical departure from what most programmers knew. So learning it was both hard and mind-expanding. Nowadays, the OO style is the dominant one, so ambitious people need to proactively seek out different styles.

The functional programming style is nicely different from the OO style, but there are many interesting points of comparison between them. This course aims to teach you key elements of the functional style, helping you take them back to your OO language (probably Java or C#).

There’s a bit more, though: although the functional style has been around for many years, it’s recently become trendy, partly because language implementations keep improving, and partly because functional languages are better suited for solving the multicore problem* than are other languages. Some trends with a lot of excitement behind them wither, but others (like object-oriented programming) succeed immensely. If the functional style becomes commonplace, this course will position you to be on the leading edge of that wave.

There are many functional languages. There are arguments for learning the purest of them (Haskell, probably). But it’s also worthwhile to learn a slightly-less-pure language if there are more jobs available for it or more opportunities to fold it into your existing projects. According that standard, Clojure and Scala—both hosted on the JVM—stand out. This course will be taught mainly in Clojure. Where appropriate, I’ll also illustrate the ideas in JavaScript, a language whose good parts were strongly influenced by the functional style.

While this particular course will concentrate on what you can do in Clojure, it’d be unfair to make you do all the work of translating these ideas into your everyday language. To help you with that, every participant will get a copy of Dean Wampler’s Functional Programming for Java Developers, which shows how functional ideas work in Java.

Your instructor

Brian Marick was first exposed to the functional style in 1983, when the accident of knowing a little bit of Lisp tossed him into the job of technical lead on a project to port Common Lisp to a now-defunct computer architecture. That led him to a reading spree about all things Lisp, the language from which the functional style arguably originated. He’s been a language geek ever since, despite making most of his living as a software process consultant. He’s the author of the popular Midje testing library for Clojure and has written two books (Everyday Scripting with Ruby and Programming Cocoa with Ruby).

For examples of Marick’s teaching style, read his explanations of the Zipper and Enlive libraries or watch his videos on Top-down TDD in Clojure and Monads.

Interested?

 

*The multicore problem is that chip manufacturers have hit the wall making single CPUs faster. The days of steadily increasing clock rates are over. Cache sizes are no longer the bottleneck. The big gains from clever hardware tricks have been gotten. So we programmers are getting more cores instead of faster cores, and we have to figure out how to use multiple cores in a single program. That’s a tough problem.

Enlive tutorial

Enlive is a templating library for Clojure. Instead of the usual substitute-into-delimited-text approach, it works by editing node trees selected by CSS selectors. I’ve written a tutorial for it. Comments welcome.

A small note about with-group and hiccup

As novice user of Hiccup, a Clojure HTML-layout format, I wanted to write a form that gathered information about N animals. Each animal had a name, a nickname, etc. I wanted to use Ring’s ring.middleware.nested-params so that I could iterate over new animals.

I had some trouble getting it to work, so perhaps this note will help someone else. Note that this applies to hiccup-0.3.5.

My first attempt was something like this:

This was derived from the description of with-group here. However, this didn’t work. Only the last text-field appears in the HTML page. [Note: I was using Noir to render pages.]

Having written a builder-style renderer like Hiccup before, I thought. “Ah. I must make a vector of the rendered functions”:

That lead to a scary exception:

java.lang.RuntimeException: java.lang.RuntimeException: java.lang.IllegalArgumentException: [:label {:for “animal1-true-name”} “Name: “] is not a valid tag name.

The solution I found was to wrap the sub-form inside another element, in this case a :p:

It’s ironic that I’d do something like that as a matter of course, except that I was exploring the API. Which led me astray.

UPDATE: Chris Granger points out “Hiccup treats any vector as a tag, but any other seq will work. Vectors have semantic meaning, the others don’t.” Instead of wrapping the separate steps in a vector, I should have used a list:

I should have realized that in the beginning (though one could argue that the two uses for a vector are distinguishable so why not make a vector work as well as a list?).

Chris also writes “In my experience the best solution is to wrap the block in (html … ). Then you never worry.” That is:


  • Buy Cheapest buy viagra meds online Now Special Prices For buy viagra meds online! Best Online.
  • Buy Cheap natural alternative to viagra Online Low Prices. Cheap Prescription Drugs.
  • Buy Cheap cheap viagra soft Online Online Prices For cheap viagra soft! Best Prices.
  • Buy Cheap natural alternative to cialis Now Free Viagra Pills! Online Prices For natural alternative to cialis!
  • Buy Cheap cialis prescriptions Now No Prescription Needed For Drugs. Best Prices.
  • Buy Cheap viagra female Now WorldWide Shipping. Cheap Pharmacy Online.
  • Buy Cheap cheap online viagra Online The Largest Internet Pharmacy. Best Online.
  • buy cialis cheap Online Without Prescription Low Prices. Pharmacy Store.
  • Buy Cheapest cialis 30mg Now Best Online. The Largest Internet Pharmacy.
  • cheep daily cialis Online Without Prescription No Prescription Online Pharmacy.
  • Buy Cheap blockers and alpha levitra Now WorldWide Shipping. Discount Online Pharmacy.
  • Buy Cheapest levitra on sale Now WorldWide Shipping. No Prescription Needed.
  • Buy Cheap free sample pack of viagra Now Cheap Pharmacy Online. Online Medical Shop.
  • cialis dosage rate Online Without Prescription Low Prices. Best Drugstore.
  • Buy Cheap levitra sales uk Now All Medications Are Certificated! Best Prices.
  • Buy Cheap soft cialis with mastercard Now Pharmacy Store. Drugs, Health And Beauty.
  • Buy Cheap cialis online Online Best Prices. Online Prices For cialis online!
  • Buy Cheapest levitra and alchol Now Pharmacy Store. Pharmacy At The Best Price!
  • Buy viagra side effect Without Prescription Doctor. Best Internet. Best Prices.
  • Buy Cheapest cialis and levitra viagra online brand Now Low Prices. Internet Prices For cialis and levitra viagra online brand!
  • Buy Cheapest cialis 10 20 mg Online Best Internet. Discount Online Pharmacy.
  • Buy Cheapest levitra for sale Now Cheap Pharmacy Online. WorldWide Shipping.
  • generica cialis Online Without Prescription Best Prices. Best Drugstore.
  • Buy Cheap sildenafil viagra Online Online Medical Shop. 24/Online Pharmacy.
  • Buy Cheap levitra without a prescription Now Cheap Online Pharmacy. Free Viagra Pills!
  • levitra cheapest Online Without Prescription Best Prices. Free Viagra Pills!
  • Buy buy sublingual viagra online Without Prescription Doctor. Low Prices. Best Online.
  • Buy Cheap viagra paypal Now No Prescription Needed. WorldWide Shipping.
  • Buy Cheap viagra propecia propecia xenical xenical celebrex Now Discount Pharmacy Online. Pharmacy Store.
  • Buy Cheap pharmacy viagra Now Online Medical Shop. Cheap Pharmacy Online.
  • Buy Cheapest cialis levitra pharmacy viagra Online Guaranteed Shipping. Best Online.
  • Buy Cheap buy viagra cialis levitra Now Best Online. Top Online Pharmacy Supplier.
  • Buy Cheap mexican generic cialis Now Buy Medications Online. Cheap Pharmacy Online.
  • Buy Cheap who should take cialis 5mg Now Safe And Secure Payment System. Low Prices.
  • Buy Cheapest how viagra works Now 24/Internet)(safe Pharmacy. Best Prices.
  • Buy Cheapest cialis and diazepam overnight delivery possible Online Best Online. Cheap Prescription Drugs.
  • Buy Cheapest viagra levitra cialis apcalis regalis zenegra Now Best Drugstore. Online Medical Shop.
  • Buy Cheapest viagra switzerland Online Best Prices. Cheap Prescription Drugs.
  • Buy Cheapest lowest cialis Now Discount Pharmacy Online. Best Online.
  • Buy Cheap mail order cialis Now Best Online. Order Cheap Meds Without Rx.
  • Buy Cheap buy cheap cialis generic levitra viagra Now Drugs, Health And Beauty. Free Viagra Pills!
  • Buy Cheapest prices cialis 120 Now Low Prices. 100% Satisfaction Guaranteed.
  • Buy Cheap cialis erectile disfunction Now Top Online Pharmacy. 24/Online Pharmacy.
  • Buy Cheap cialis online fda Online Low Prices. Pharmacy At The Best Price!
  • Buy Cheap does levitra allow for good experience Now Buy Medications Online. WorldWide Shipping.
  • Buy Cheap viagra for sex Online Low Prices. Safe And Secure Payment System.
  • Buy Cheapest discount brand viagra by pfizer Now Best Drugstore. Internet Prices For discount brand viagra by pfizer!
  • Buy Cheap buy cheap generic cialis Now Best Prices. All Medications Are Certificated!
  • Buy Cheap buy viagra in england Now Top Online Pharmacy Supplier. Best Prices.
  • Buy Cheapest viagra and cialis cheap Online Best Drugstore. Buy Medications Online.
  • Buy Cheap discount generic viagra Now Low Prices. 100% Satisfaction Guaranteed.
  • Buy Cheapest mail order for viagra tablets Online Best Online. Guaranteed Shipping.
  • Buy Cheapest original cialis Online Top Online Pharmacy. Free Viagra Pills!
  • Buy Cheapest viagra manufacturer Online Best Prices. Drugs, Health And Beauty.
  • Buy Cheapest cialis used for Now Top Online Pharmacy. Free Viagra Pills!
  • Buy Cheapest india generic cialis Now Safe And Secure Payment System. Low Prices.
  • Buy Cheapest cialis buy it online huge discount Online Best Internet. Cheap Pharmacy Online.
  • Buy Cheapest viagra from uk Now Drugs, Health And Beauty. Best Prices.
  • Buy Cheapest risperodol interactions with cialis viagra levitra Now Special Prices For risperodol interactions with cialis viagra levitra! Best Prices.
  • Buy Cheap purchase viagra in australia Now Low Prices. 24/Internet)(safe Pharmacy.
  • Buy Cheapest levitra coupon Online Best Drugstore. Top Online Pharmacy.
  • Buy Cheap cialis cheaply Online WorldWide Shipping. Cheap Pharmacy Online.
  • Buy Cheap what does cialis do Now Order Cheap Meds Without Rx. Best Prices.
  • Buy viagra wholesale Without Prescription Doctor. Best Internet. Low Prices.
  • Buy Cheap what is levitra Now No Prescription Online Pharmacy. Low Prices.
  • Buy Cheap buy cialis online Online Special Prices For buy cialis online! Best Internet.
  • Buy Cheapest cialis softtabs Online Buy Medications Online. Best Online.
  • Buy Cheapest canadian pharmacy levitra Online Pharmacy Store. Free Viagra Pills!
  • Buy Cheap taking half a 20mg cialis Online Guaranteed Shipping. Best Drugstore.
  • Buy Cheapest levitra experiences Online Buy Medications Online. Best Drugstore.
  • Buy Cheap drinking and viagra Online Best Online. Discount Online Pharmacy.
  • Buy Cheap viagra orgasm Online Online Prices For viagra orgasm! Best Drugstore.
  • Buy chinese viagra Online Without Prescription. Best Drugstore. Low Prices.
  • buy canada levitra Online Without Prescription Cheap Meds Without Prescription.
  • Buy Cheapest us pharmacy cialis Now WorldWide Shipping. Cheap Pharmacy Online.
  • Buy Cheap cialis buy on line Online WorldWide Shipping. Online Medical Shop.
  • Buy Cheapest women viagra Now Best Internet. Order Cheap Meds Without Rx.
  • Buy Cheapest viagra cost Now Safe And Secure Payment System. Low Prices.
  • Buy Cheap viagra for sale without a prescription Now 24/Online Pharmacy. Cheap Online Pharmacy.
  • Buy Cheapest viagra sales mexico Online No Prescription Needed. Best Online.
  • Buy Cheapest levitra faq Now Low Prices. Pharmacy At The Best Price!
  • Buy Cheapest cialis us Online Drugs, Health And Beauty. Low Prices.
  • Buy Cheap cialis compare viagra Now Low Prices. Top Online Pharmacy Supplier.
  • Buy Cheapest blood pressure and viagra Now Pharmacy At The Best Price! Low Prices.
  • Buy Cheapest bayer levitra cheapest price online pharmacy Now Best Online. No Prescription Needed.
  • Buy Cheapest pfizer viagra patent Now Best Prices. No Prescription Needed.
  • Buy Cheapest uk cialis supplier Now Low Prices. Pharmacy At The Best Price!
  • Buy Cheap viagra pay by e-check Now Best Prices. 24/Internet)(safe Pharmacy.
  • legal viagra Online Without Prescription Best Prices. Pharmacy Store.
  • Buy Cheap viagra purchase uk Now Guaranteed Shipping. No Prescription Needed.
  • Buy Cheap viagra mail order Online Pharmacy Store. Guaranteed Shipping.
  • Buy Cheap buying viagra online uk Now No Prescription Needed. Cheap Online Pharmacy.
  • Buy Cheap free levitra sample Now Pharmacy At The Best Price! Free Viagra Pills!
  • Buy viagra cheap prescription Online Without Prescription. Best Prices. Best Online.
  • Buy Cheap levitra or viagra Now Cheap Online Pharmacy. Guaranteed Shipping.
  • Buy Cheapest levitra prescription drugs Now Pharmacy Store. Online Prices For levitra prescription drugs!
  • Buy Cheap cialis dosage and uses Now 100% Satisfaction Guaranteed. Low Prices.
  • Buy Cheapest viagra half price pharmacy Online Low Prices. Drugs, Health And Beauty.
  • Buy Cheap viagra levitra Now The Largest Internet Pharmacy. Best Prices.
  • Buy substitute for viagra Without Prescription Doctor. Low Prices. Best Drugstore.