AirPair is hosting a panel discussion entitled Developer Writing Tips & Tricks as part of AirConf on August 25. I’ll be one of the panelists.
The AirConf events will be broadcast via G+ hangouts.
AirPair is hosting a panel discussion entitled Developer Writing Tips & Tricks as part of AirConf on August 25. I’ll be one of the panelists.
The AirConf events will be broadcast via G+ hangouts.
Aaron Evans condensed a good deal of software engineering experience down to less than 140 characters:
It’s amazing how much cleaner your code looks the third time writing it. First time, hack; Second over-engineer; Third = goldilocks.
Michael Fogus posted on Twitter this morning
Computing: the only industry that becomes less mature as more time passes.
The immaturity of computing is used to excuse every ignorance. There’s an enormous body of existing wisdom but we don’t care.
I don’t know whether computing is becoming less mature, though it may very well be on average, even if individual developers become more mature.
One reason is that computing is a growing profession, so people are entering the field faster than they are leaving. That lowers average maturity.
Another reason is chronological snobbery, alluded to in Fogus’s second tweet. Chronological snobbery is pervasive in contemporary culture, but especially in computing. Tremendous hardware advances give the illusion that software development has advanced more than it has. What could I possibly learn from someone who programmed back when computers were 100x slower? Maybe a lot.
The classical education model is based on the trivium of grammar, logic, and rhetoric. See, for example, Dorothy Sayers’ essay The Lost Tools of Learning.
The grammar stage of the trivium could be literal language grammar, but it also applies more generally to absorbing the basics of any subject and often involves rote learning.
The logic stage is more analytic, examining the relationships between the pieces gathered in the grammar stage. Students learn to construct sound arguments.
The rhetoric stage is focused on eloquent and persuasive expression. It is more outwardly focused than the previous stages, more considerate of others. Students learn to create arguments that are not only logically correct, but also memorable, enjoyable, and effective.
It would be interesting to see a classical approach to teaching programming. Programmers often don’t get past the logic stage, writing code that works (as far as they can tell). The rhetoric stage would train programmers to look for solutions that are not just probably correct, but so clear that they are persuasively correct. The goal would be to write code that is testable, maintainable, and even occasionally eloquent.
Parthenon replica in Nashville, TN.
This morning Aycan Gulez shared on Twitter this quote from Peopleware:
For the majority of the bankrupt projects we studied, there was not a single technological issue to explain the failure.
Gerald Weinberg said something similar in his Second Law of Consulting:
No matter how it looks at first, it’s always a people problem.
The other day Travis Oliphant pointed out an interesting paper: A Comparison of Programming Languages in Economics. The paper benchmarks several programming languages on a computational problem in economics.
All the usual disclaimers about benchmarks apply, your mileage may vary, etc. See the paper for details.
Here I give my summary of their summary of their results. The authors ran separate benchmarks on Mac and Windows. The results were qualitatively the same, so I just report the Windows results here.
Times in the table below are relative to the fastest C++ run.
| Language | Time |
|---|---|
| C++ | 1.00 |
| Java | 2.10 |
| Julia | 2.70 |
| CPython | 155.31 |
| Python with Numba | 1.57 |
| R | 505.09 |
| R using compiler package | 243.38 |
The most striking result is that the authors were able to run their Python code 100x faster, achieving performance comparable to C++, by using Numba.
Comment by Simon Peyton Jones in an interview:
People often dislike static type systems because they’ve only met weak ones. A weak or not very expressive type system gets in your way all the time. It prevents you from writing functions you want to write that you know are fine. … The solution is not to abandon the type system but to make the type system more expressive.
In particular, he mentions Haskell’s polymorphic types and type inference as ways to make strong static typing convenient to use.
Haskell uses a lot of ideas from category theory, but the correspondence between Haskell and category theory can be a little hard to see at times.
One difficulty is that although Haskell articles use terms like functor and monad from category theory, they seldom actually talk about categories per se. If we’ve got functors, where are the categories? (This reminds me of Darth Vader asking “If this is a consular ship, where is the ambassador?”)
In Haskell literature, everything implicitly lives Hask, the category of Haskell types, or in some subcategory of Hask. This means that the category itself is not the focus of attention. In category theory, functors often operate between very different classes of objects, such as topological spaces and their fundamental groups, and so it’s more important to state what category something lives in.
Another potential stumbling block is to think of Haskell types as categories and values as objects. That would be reasonable, since in computer science an “object” is an instance of a type. But the right correspondence is to think of Haskell types as categorical objects. Instances of types are below the level of abstraction we’re working at. This is analogous to how category theory treats objects as black boxes with no way to talk about what’s inside.
Finally, Haskell monads look a little different from categorical monads. Haskell’s return corresponds directly to unit, usually written as η, in category theory. But Haskell monads have a bind operator >>= while mathematical monads have a join operator μ. These are not equivalent, though you can implement each in terms of the other:
join :: Monad m => m (m a) -> m a join x = x >>= id (>>=) :: Monad m => m a -> (a -> m b) -> m b x >>= f = join (fmap f x)
To read more along these lines, see the Wikibooks article on Haskell and Category theory.
Update: Stephen Diehl suggested I mention the differences between the idealized category Hask and the implementation of the Haskell language. These are discussed here.
Related: Applied category theory
Look-behind is one of those advanced/obscure regular expression features that I don’t use frequently enough to remember the syntax, but just frequently enough that I wish I could remember it.
Look-behind can be positive or negative. Look-behind says “match this position only if the preceding text matches (does not match) the following pattern.”
The syntax in Perl and similar regular expression implementations is (?<= … ) for positive look-behind and (?<! … ) for negative look-behind. For the longest time I couldn’t remember whether the next symbol after ? was the direction (i.e. < for behind) or the polarity (= for positive, ! for negative). I was more likely to guess wrong unless I’d used the syntax recently.
The reason I was tempted to get these wrong is that I thought “positive look-behind” and “negative look-behind.” That’s how these patterns are described. But this means the words and symbols come in a different order. If you think look-behind positive and look-behind negative then the words and the symbols come in the same order:
| look | (? |
| behind | < |
| positive | = |
| negative | ! |
Maybe this syntax comes more naturally to people who speak French and other languages where adjectives follow the thing they describe. English word order was tripping me up.
By the way, the syntax for look-ahead patterns is simpler: just leave out the <. The default direction for look-around patterns is forward. You don’t have to remember whether the symbol for direction or parity comes first because there is no symbol for direction.
In the context of programming languages, “magic” is often a pejorative term for code that does something other than what it appears to do.
Programmers seem to have a love/hate relationship with magic. Even people who say that don’t like magic (e.g. because it’s hard to debug) end up using it. The Haskell community prides itself on having a transparent language with no magic, and yet monads are slightly magical. The whole purpose of a monad is to hide explicit data flow, though in a principled way. Haskell’s do notation is more magical, and templates are even more magical still. (However, I do hear some Haskellers express disdain for templates.)
People who like magic tend to use the word “automagic” instead. It means about the same thing as “magic” but with a positive connotation.
To conclude with a couple sweeping generalizations, magic fans tend to be tool-oriented (such as Microsoft developers) while magic detractors tend to be language-oriented (such as Haskell developers ).
Update: Someone asked me on Twitter about the difference between abstraction and magic. I’d say abstraction hides details, but magic is actively misleading or ironic.