Multiple Paradigms

I\’ve got a few things floating around in my brain, making some odd connections. I recently watched Richard Dawkins\’ The Root of All Evil? where he discusses many of the problems with religion. And today I had a discussion with someone at work who didn\’t see why I would do a project in Lisp. We discussed a few different reasons, but there\’s one in particular I want to focus on, and I think it ties in with \”the religion problem\”.

The discussion turned to having other people work on the project, and why I felt people who knew Lisp would be better to attract than people who knew, say, Java. Now, this isn\’t meant to be an assault on Java — its popularity is what makes my point, not its quality. Because of its popularity, a lot of educational programs focus almost exclusively on Java. Plenty of people looking for a job have never written more than a hundred lines of code in a different language. And that hundred lines (probably for some Programming Languages course) was them wondering why it was so hard to get it to do what Java does.

They basically think in Java (apologies to Bruce Eckel). Why is it bad to think in Java? Well, it\’s not necessarily. It\’s just bad when that\’s the only thing you can think in. You end up with a very narrow approach to problems. And this is where it gets back to religion. It\’s that narrow view. I\’m not saying knowing only one language means you\’re a zealot about it, but that you don\’t realize there\’s another way to think about the issue. Religion actively discourages exercising your critical faculties, and being part of popular groupthink can often do the same thing. It\’s when you start to question that this is the only or best way that you begin to really learn.

And really, when I say \”multiple languages\”, I mean languages that encourage different paradigms. If you know Java and C++, that still only counts as one. Alright, so you know Lisp is different, but what else is there? How about Haskell, Oz, Smalltalk, Prolog, Forth — each of these is very different from the others and has had a significant influence on other systems. Writing a handful of code in one of them won\’t get you anywhere, you have to dedicate some real time to studying them.

If you know C++ and you learn Java, it happens very quickly. You pick up the differences in a week or so of real work. If you pick up a language that encourages a different paradigm, it\’s harder. It\’s like learning to program all over again. This is because the ideas are different. If you\’ve started learning something like Lisp and just gave up, I recommend you try again. It\’s supposed to feel that way. It\’s not that you\’re dumb, or that the language is difficult, it\’s just that it\’s causing you to think in new ways. And it\’s well worth it.

Now, most languages are to some extent multi-paradigm, but each gives more emphasis to one paradigm or another. Odds are that the patterns you pick up from a new exploration can be utilized in your language of choice. Java may not have closures, but Scheme might help you find some novel uses for inner classes.

So, how does this tie back into wanting to attract Lispers rather than Java-ers? (ok, what\’s the agent form of \”Java\”? Is \”Java\” even acceptable as a verb? If not, what\’s the verb form?) People who know Lisp are likely to have explored a lot of different languages, and picked up a number of different approaches along the way. I think this makes them more likely to be better programmers.

Now, Paul Graham talked about why Google hires for Python and I think the learning for enjoyment part is a very valid point, but these days people who pick up Python and Ruby are like those who picked up Perl in the past, often hobbyists with little or no formal training looking for something that allows them to write code quickly, and where they can find lots of code available for free. This is great for them scratching their itches, but I think Python has reached the point where it too is a popular \”only language\”.

Do I think that Lisp could also become a popular only language? Yeah, I do (although it hasn\’t in the past fifty years). Would I still say I\’d rather attract Lispers than anyone else at that point? Yeah, I think so. See, it takes more than just not being a popular first language to make it bait for Good Developers. Another quality that makes Lisp stand out is that people who have learned a number of different languages tend to fall in love with Lisp. It\’s one thing to hear people talk about how much they love the only language they know, but when they\’ve covered the gamut and then say, \”this one, this language is the one I really liked,\” well, that\’s something different. Hence, not only do Good Developers know it, but Good Developers prefer to use it.

So, to recap, learning multiple languages makes you a better developer, and people who have become better developers like to develop in Lisp. Why do better developers like Lisp? Well, that\’s another post …

5 Responses to “Multiple Paradigms”

  1. Sacrificial Rabbit Says:

    Greg on (computer) languages and religion Greg, who always has interesting stuff to say has written this well thought out post on Programming Languages and Religion. If you aren’t a code geek, don’t be scared off. Just think of it as an allegorical story.

    Go read it right now. I’ll wa…

  2. Greg Pfeil Says:

    Reading Jonnay’s trackback, I figure I should clarify on the issue of Scheme. Scheme totally falls under the heading of “Lisp” in my post. I write Common Lisp, but I think I write it Schemier than most. It’s all about family here, and the Lisps are a pretty sweet family.

  3. Jonnay Says:

    Whute! I’m in the club! ;)

  4. Divya B Says:

    Lots of really good points. You say: “If you pick up a language that encourages a different paradigm, it?s harder. It?s like learning to program all over again. This is because the ideas are different.” I think that might depend on which way you’re going. If you learn LISP first, C++/Java is a breeze to pick up. Maybe because they don’t “enforce” a different paradigm, but rather, allow more paradigms….some of which might be more attractive to the people who only use Java. So i guess what i’m saying, is that some languages force you to think in a certain way (LISP), others simply allow you to (java). But I agree that its sometimes nice to be forced, and not be tempted by comfort/laziness.

  5. Greg Pfeil Says:

    I would disagree about the Lisp/Java thing … Java is more the one that forces you. You gotta use OO, you can’t do functional or declarative styles, etc.

    Lisp gives you the option of using OO where you want it, using plain old functions otherwise. Also, it doesn’t enforce the functional paradigm (unlike, say, ML and Haskell).

    Lisp, IMO, is the least style-restrictive language I can think of. In fact, you can even modify the reader so that it uses a different syntax. I wonder if anyone’s written a collection of reader macros to make a C-looking language, just to show off Lisp’s flexibility.

    Also, I picking up Java after Lisp might be easier than the reverse, but it’s because Lisp gives you more flexibility from the get-go, rather than forcing you into a particular style. Also, it would still be fairly difficult, I believe, learning to work without MAP and REDUCE, for example, let alone macros.

Leave a Reply