Search This Blog

Loading...

Wednesday, February 23, 2011

Advice to a Newbie

Someone wrote to me the other day asking me to teach him Clojure over Skype.

Well, I am sceptical of the feasibility of this scheme, but it is well known that the words "£50/hour" ring pleasantly in my ears, although in fact for this kind of one-hour every so often-type piecework it might be truer to say that the real figure is rather higher, but what the hell, this guy is a beginner interested in lisp, so I can cut him some slack....

However it occurs to me that he doesn't really need me, and as a very wise man once pointed out to me, my clients pay me for my advice, rather than for my typing.

So this is my reply:

I have removed any identifying details from it, I hope, but if the guy in question wishes to out himself here, then that is perfectly fine, and maybe he will find a study partner who lives somewhere in his area.

And if anyone reading this would like to recommend their own route in, or just flame me for being so utterly ignorant and old-fashioned, then feel free to leave long comments, at the risk that I may use them as material for further posts.



Dear .......,

I'm sorry I haven't replied for so long. I've been rushed off my feet, but I was very flattered by your offer.

Clojure's exceedingly cool, but to understand it you need to speak lisp. (Scheme is the purest and easiest lisp to understand).

I'd recommend the route I took into all that sort of thing, the excellent series of lectures given to first years at MIT, and filmed here as given to a load of HP execs by the original lecturers.

http://groups.csail.mit.edu/mac/classes/6.001/abelson-sussman-lectures/

You should get the excellent PLT Racket (which used to be called PLT Scheme),

http://racket-lang.org/

which has a superb beginners' scheme editor and environment, called DrScheme (or these days I presume DrRacket)
and set the required language to Scheme R4RS or R5RS (not modern racket, which is a similar but different language to the one used in the book).

That way you won't have to deal with the incomprehensibly weird emacs at the same time as learning lisp.

When they write anything on the board in the videos, stop the lecture and try it out in DrRacket.

There's also the excellent companion textbook:

http://mitpress.mit.edu/sicp/full-text/book/book.html

which has been used as an introductory CompSci text for many years.

I seriously recommend you to do *all* the exercises in the book. Even the ones that look boring are in fact spectacularly well chosen and interesting once you start, and each one will teach you something new.

Until you've done them all, you won't understand the material well enough to be able to go onto the next chapter.

You will of course ignore this advice. I know I would.

When you are half way through Chapter 2, and a bit bewildered and wondering if you are not clever enough, or why anyone should be interested in this weird and incomprehensible way of doing simple things, remember the advice and go back and do all the exercises in Chapter 1.

Be aware that this is a very long process. Reckon on being able to do one exercise per day, and if you're treating it as a hobby, reckon on taking a year to understand the whole book.

But it's also terrific fun, and you'll get regular rewards of small doses of enlightenment throughout.

I actually did all this. I've never been to any sort of computer training. I learned lisp from that wonderful book, those wonderful lectures, and DrScheme.

It really is the easiest way in. That's where all the smuggest lisp weenies come from, or go eventually.

And once you've learned scheme (or more accurately, once you've learned all the new ways of thinking that Abelson and Sussman demonstrate), you'll look at clojure and think:

'Oh yes, that's nice... I see...'

-----

That said, I am a complete slut, and amongst the things I am prepared to do for £50 an hour is to try to teach someone Clojure over Skype.

But I really think that you'll get on better with the video lectures.

Also, even though I am rather busy at the moment, I am not entirely without public spiritedness.

If you read the first chapter of SICP, and watch the associated lectures, and have an honest go at doing all the exercises in chapter one, then you can skype me and I'll spend a couple of hours leading you through any exercises you had difficulty with for free.

Cheers, John.


P.S. I find that I have just written a fine blog post, which I will publish. I will remove your name.

P.P.S. Hypocrite note. I never did get round to chapter 5 of SICP. I intend to one day.

P.P.P.S. In fact, you can probably get away with just reading the first three before you can understand clojure. But chapter 4 is definitely the best of the first four, so it would be a shame to stop there.
And you won't understand the why of lisp until you've read chapter 4.


10 comments:

  1. I've been wondering about the route of learning lisp via another dialect before learning Clojure. It sounds a bit wierd to me. Should we advice a newcomer to Java or Python who does not know object-oriented programming to learn Smalltalk first? If the immediate goal is to learn Clojure, Java or Python, doesn't it make more sense to go directly to Clojure, Java or Python book?

    I do think the book Programming Clojure is an excellent introduction to Clojure as a lisp.

    That being said, of course going through the challenging and rewarding SICP is an excellent way to learn Lisp (or programming abstraction on general.) Mea culpa, I stopped after the first chapter and I am now going through "The Little Schemer," after having learn Clojure. For me,it's a detour before "The joy of Clojure."

    And of course, learning Smalltalk is surely beneficial before (or after!) learning Java or other OO languages (and particularely Ruby or Objective-C.)

    ReplyDelete
  2. Yes, it is weird. What we need is SICP for Clojure, but we need a genius like Sussman or Abelson to write it for us.

    On the other hand, scheme's pretty much a clojure subset, especially since A&S treat it as if it were a functional language until ch3.

    So you might say that the first two chapters are directly relevant to clojure, and the third asks questions to which clojure has some answers.

    And no, we might not advise Smalltalk as a route to Python, but if a man wanted to learn C++ then he'd be well advised to learn Java first to get the hang of the ideas, and only then move onto the accidental complexity of C++.

    I've read some of Joy, and it does seem like good fun. How suitable it is if you don't already know scheme I can't judge, since I do.

    ReplyDelete
  3. @ the careful programmer :

    yeah probably, learning smalltalk or Eiffel first would have made me a better java developer, and sooner.

    Cheers,

    Laurent

    ReplyDelete
  4. Als0 @The Careful Programmer: I concur with Laurent; I think some other OOP languages are a better gateway to Java than Java is, although currently I use Groovy for that purpose to begin breeding familiarity w/ the APIs.

    ReplyDelete
  5. Little Schemer was a real nice intro into the mindset of programming in Lisp land. I think it is a great companion to the items you enumerated in your reply. Little Schemer is a fast read and it really helped me dive in.

    ReplyDelete
  6. To me, this smacks of "you can't get there from here" and makes functional programming more of an elitist mystery than it needs to be. I don't see anything wrong with learning FP via Clojure nor indeed learning Clojure as your first Lisp.

    I do agree that knowing Lisp / Scheme makes it easier to learn Clojure, just as I agree learning Smalltalk makes you a better OO programmer, regardless of language.

    I think Joy of Clojure is a great book but, like you, I can't comment on whether it's a good intro if you don't know FP since I pretty much started with FP 30 years ago before I even saw any OO code... :/

    Overall, I feel very disturbed by your approach (to the newbie) but I can't really put my finger on exactly "why". Perhaps because I'm trying to teach people FP thru Clojure right now without making them read a bunch of stuff they'll think is pretty esoteric and it'll scare them off...?

    ReplyDelete
  7. As far as the SICP lectures go, I thought the content was excellent but the teaching was terrible. These guys are true geniuses but they are teaching as a secondary requirement to being paid to produce brilliant developments in computer science. So despite the fact that the content of SICP is very much at the core of any serious CS student's understanding, I feel like the SICP lectures just scare people off - the only people who will find them familiar and comfortable are people who are truly at home speaking and thinking in the ultra-formal language of mathematics textbooks.

    I don't think that speech style is necessary to teach the ideas exactly as effectively as other methods - sometimes people take complex subject matter and then raise their speech level to be extra-double-intellectual which makes the subject matter seem incomprehensible and impenetrable. I had an introductory neuroscience class where the teacher chose a ridiculously verbose research paper to assign first, which scared off half the class and made them forever afraid of neuroscience, when in fact the use of (excessively) detailed language completely unsuitable for a beggining audience was to blame.

    That whole rant is to explain why I think "Watch the SICP Lectures right away" is bad advice. I think they're unnecessarily scary for beginners.

    Even just trying out the book is probably a better choice, but perhaps after reading some less heady intro material and playing around at the REPL to get some comfortable enjoyment out of their newfound interest.

    When you first had your passion for computer science kindled, were you reading the hyper-formalized math-textbook-like language of SICP, or were you toying around with a Commodore 64 or some other environment appropriate to your age? Every beginner starts with tinkering- that ignites the spark and people go from there. It seems to me that people will have a much better experience being started off gently, rather than setting in stone a requirement that You can not do ANYTHING until you've completed the SICP Lectures!.

    People need to be invited in. I worry this (quite common) recommendation stifles that spark of curiosity by placing a whole mountain in front of the beginner to climb.

    Perhaps we should just say, "Keep SICP in the back of your mind - it's required reading once you get serious about writing real programs."

    ReplyDelete
  8. Oops, I found the lectures accessible and friendly. But I did do a maths degree, so maybe I'm not the one to judge.

    What they aren't is dumbed down.

    And I wasn't recommending SICP to a child or a complete beginner. My letter was to a man who seems very clever and determined to learn clojure, and who has programmed in several languages.

    For bright ten year olds I'd recommend the ZX Spectrum or TRS-80 BASIC manual! Or given the difficulty of getting hold of the hardware, whatever the current equivalent in python is.

    A lot of modern children have told me that their interest stemmed from programming their pocket calculators, which must be a bit like TRS80 BASIC.

    I do think that that's absolutely damning of more modern attempts to make something for children. It's been thirty years and they spend half their lives using computers of various sorts, and yet the thing that gets them interested is the BASIC on their calculator.

    ReplyDelete
  9. Thanks for the response; it's clear you did think things out. With the child reference I was just trying to take you back to what it was like when you were beginning to learn a language.

    If you have a math degree then you would feel at home with them :) And nobody disputes they are exceptional works.

    All I was trying to say was that beginners, even very smart adults, benefit from a period of toying around with the environment and getting some early rewards before diving in to heavy material.

    If the person is already an experienced programmer, and their interest is in understanding what makes lisp exceptional, then what you said is perfect. I made an assumption that this was the kind of person who is already convinced it's worth learning but hasn't yet decided if they want to make a serious long-term investment. These people benefit from tinkering with simple things ("Woah, each set of parentheses return a value. That's neat. Seems flexible"), then going on to learn some of the standard functions and just creating little toy efforts in the repl to get a feel for the magic of the basic structure of lisp.

    I dunno, both strategies are fine. I just think someone with enthusiasm for clojure will find playing with the unique concepts there eye-catching and exciting more quickly than through SICP, at least at first.

    In a way the point about calculators is the same issue I'm raising no matter what age you are - excitement builds through simple tasks in the beginning, then when you need to get serious you move on to serious documents.

    Anyway I agree with you SICP isn't dumbed down, and like I said if you are comfortable with math you would be comfortable with the lectures, but I think it can be another barrier for many people. I guess it boils down to two styles of entering a language: the first is to take someone who is already very serious about investing time in learning and put them through MIT 6.001, revealing all these magical advanced software concepts; the other is to start someone who is not yet sure if they want to make an extended commitment to learning the language, in which case you want to emphasize playfulness and immediacy until they reach a point where they know for sure it's for them. The negative responses you got on here were IMHO related to that concern - that dropping MIT 6.001 on an excited and interested newcomer may deemphasize the playfulness and fun of the language in favor of heavy and often unfamiliar concepts, which must be grappled with at length before you can do things you enjoy. This could push a lot of people away because the enjoyment they believed would be there seems not to be.

    I've said enough but to boil it down, I fundamentally think that with any subject, starting at a simpler higher level overview - equivalent to a Science Channel episode for whatever the subject - sparks excitement and additional interest much more readily than starting them off with a standard brick-by-brick-ignoring-the-overall-picture-for-now textbook approach is able to.

    Really your recommendation seems great for this person - just sharing my thoughts on how to approach presenting Clojure to the larger community of new adopters, for whom Clojure has a lot of interesting new concepts but who haven't yet decided if they want to invest a lot of time learning. Letting them begin to play gets them a lot more interested and hooked than strongly suggesting they start off by climbing a tall staircase in the Ivory Tower. Not that they won't eventually come back to climb it once they're ready to find enlightenment :)

    ReplyDelete
  10. John: 12 years ago or so I was in high school, bored out of my skull in math class that wasn't teaching me anything new. My sole source of entertainment was a TI-89 graphing calculator. Damn straight I got interested in programming! :-P

    ReplyDelete

Followers