How Do You Teach Yourself Programming?

Whatever is on your mind, whether Lisp related or not.

How Do You Teach Yourself Programming?

Postby hmas » Sat Oct 11, 2008 1:29 pm

Hi all,
I never had a formal education in computers, let alone programming. A short while ago I started to teach myself programming through Common Lisp, the first language I’ve ever tried. I know that one of the best ways to teach yourself programming is “simply to do it – pick projects that are personally interesting to you and a language that intrigues you and just go for it,” as one prominent Lisper put it. I’ve tried to follow this advice and largely it’s working. Possibly some of you have successfully taught yourselves programming. What advice would you give to someone who’s trying to follow your path?
hmas
hmas
 
Posts: 8
Joined: Sat Oct 11, 2008 1:19 pm

Re: How Do You Teach Yourself Programming?

Postby schoppenhauer » Sat Oct 11, 2008 3:03 pm

Keep your ambitions low at the beginning, and start to slowly increase them. For example, start with a few simple one-command-applications, and then "generalize".
I myself (and I know others do) tend to have an idea for some Program I want to write. But then, thinking about it, I get more and more Ideas how to extend the possibilities of the Program and how it could be generalized, how to create a generalized API for what it does to make it embeddable and create some kind of Plugin-System or so... But even though every single further Idea would only lead to a few more lines, the whole bunch of Ideas can lead to a Project that is too tall to finish it - which can be frustrating.
Thinking "inductive" is therefore the best way, I think - create something small, make it work, and then, if you still want, extend it.
Sorry for my bad english.
Visit my blog http://blog.uxul.de/
schoppenhauer
 
Posts: 99
Joined: Sat Jul 26, 2008 2:30 pm
Location: Germany

Re: How Do You Teach Yourself Programming?

Postby findinglisp » Mon Oct 13, 2008 10:00 am

IMO, the best way to teach yourself programming is:
  1. Choose a language to learn. I would start off with Lisp or Scheme first. I think you'll be better prepared for all the other languages you may ever meet.
  2. Choose a book that describes the language. If you choose something like Scheme, I'd start with Structure and Interpretation of Computer Programs. You can find an online copy here, http://mitpress.mit.edu/sicp/, or you can buy a paper copy here.
  3. Choose a problem to implement. Make it something small enough that you have a reasonable shot at doing it. The first computer program I ever wrote was a simple craps game that just simulated rolling a couple of dice, and then implementing basic pass-line rules for the game (7 or 11 on the first roll wins; 2, 3 or 12 on the first roll loses; otherwise the number becomes the "point" and you continue rolling until you re-roll the number, at which point you win, or you roll a 7, at which point you lose). I happened to write that program in BASIC on a Commodore PET in a computer store one afternoon in 1979 or thereabouts. And yes, I lost the program as soon as they kicked me out of the store for the evening. I was 12 at the time.
These days, you don't have to hang out in a computer store until they kick you out. :)
Cheers, Dave
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/
findinglisp
 
Posts: 440
Joined: Sat Jun 28, 2008 7:49 am
Location: Austin, TX

Re: How Do You Teach Yourself Programming?

Postby ebie » Sat Jun 13, 2009 2:23 pm

Hello everyone,

I’m also teaching myself how to program without any formal background. I have no clue how to go about doing so, but I’m having a lot of fun.

I started out by getting “Common Lisp: A Gentle Introduction” and “ANSI Common Lisp”. I’ve been doing every exercise in A Gentle Introduction and using ANSI mostly as a reference text. I’ve found that I learn a lot more if I never look up a solution to a problem until I’ve come up with a working program on my own, no matter how crude.

About halfway through Gentle, I took a break to write two simple programs I had thought up myself. I’m glad I did....I learned a lot. When you’re working problems in a textbook, you know that you’ll be using the concept you just learned, so it’s easy. To start with only an idea and figure out how to begin and then follow it through to the end is difficult at first.

I’ll finish A Gentle Introduction soon, and then I figured I’d go through Structure and Interpretation (which I learned about on this post – thanks!). There’s an endless amount of texts and information online if you’re persistent...just keep digging.

I’ve found that the more I program, the less money I spend. So, I don’t have to work as much, and I have more time to program. I wish I had figured that one out ten years ago.
ebie
 
Posts: 14
Joined: Thu Jun 11, 2009 11:11 pm

Re: How Do You Teach Yourself Programming?

Postby speech impediment » Wed Jun 17, 2009 6:48 pm

Heh, I'm half way through Touretzky's book as well, but I think you are progressing faster than I am. For reference, I use the Hyperspec. There are some useful chapters from "Practical Common Lisp", but the example programs are pretty advanced though. I think a better book after Touretzky's book is "Paradigms of Artificial Intelligence Programming" by Peter Norvig. Some of the material will be reviews, but hey, it's better to review Lisp in a new book than the same book. :-)
speech impediment
 
Posts: 36
Joined: Mon May 04, 2009 5:19 pm

Re: How Do You Teach Yourself Programming?

Postby ebie » Sat Jun 20, 2009 8:00 am

speech impediment wrote:I think a better book after Touretzky's book is "Paradigms of Artificial Intelligence Programming" by Peter Norvig.


Thanks a lot for the suggestion Speech Impediment. I'll definitely take your advice and choose that as my next text. I could really use a little review as well.

I recently started doing a few of the L-99 Lisp Problems. They're a good change of pace, and go well with Touretzy's text.
ebie
 
Posts: 14
Joined: Thu Jun 11, 2009 11:11 pm

Re: How Do You Teach Yourself Programming?

Postby duncan » Sat Jun 20, 2009 12:13 pm

I've been thinking about this sort of thing a lot recently. Not so much the very basics of learning to program, but.. well, I've been trying to write a series of articles for people who have been programming for a while. maybe even professionally, but have no real background in computing. This turns out to be harder than it sounds because you can't assume anything...

Anyway, I agree that PAIP is a really great book. SICP is also a great book, but it has one flaw, I think (well two, if you count the fact that it's in Scheme rather than CL, but I digress ;) .) It asks for a certain level of mathematical maturity in some of the early chapters. Not a really high level, but the golden section stuff threw me a bit when I first read it (a long time ago now.) I've gotten better at that sort of math since then, partially because SICP convinced me that I ought to (and some of Gerald Sussman's other work was even more persuasive on that front) but I had a hard time with it at the time. That might not be an issue for you. I floundered a fair bit with math involving numbers at one point- I actually never passed a grade of school past 6th so I found myself a bit out of my depth in that respect when I eventually went to Uni.

Beyond that I'd really suggest that you start reading actual code now. There's a lot to be said for fumbling around trying to figure out how to do things like sort a few numbers. I think people do too little of that these days. But there's also a lot to be said for looking at how good programmers do things. Paul Donnely said, in a nother thread, soething I've said many times. People don't learn to play music without ever having listened to music. They don't learn to write without ever having read good writers. Of course programming is a bit different because- well almost everyone winds up with the background knowledge neessary to at least hear music, if not analyze it. The same could be said for writing.

Anyway, I'd suggest that in addition to reading books about CL you start looking at the simpler libraries. You may find that you don't understand everything you see, but that's OK- learning to program is a process of iterative refinement, IMHO. If you come back to the same library in a month or so you'll understand it better. Anyway, just my two cents, make of it what you will.
duncan
 
Posts: 31
Joined: Wed May 27, 2009 9:07 pm

Re: How Do You Teach Yourself Programming?

Postby ebie » Thu Jun 25, 2009 1:43 am

duncan wrote:I'd suggest that in addition to reading books about CL you start looking at the simpler libraries.


Thanks so much for your help. Is there a library in particular you would suggest? I don't mind researching them on my own, but if you could point me in a general direction, that would be great.

Thanks again :)
ebie
 
Posts: 14
Joined: Thu Jun 11, 2009 11:11 pm

Re: How Do You Teach Yourself Programming?

Postby Harnon » Tue Jul 07, 2009 4:39 pm

Which library to pick also depends on what interests you.
Here are some:
Beginner/Intermediate (nice, pretty small libraries)-
(1) anaphora - anaphoric utilities for common lisp. For example,
(aif (getf list 'a) (print it)). The return value of (get lst 'a) is bound to the variable it.
http://common-lisp.net/project/anaphora/

(2) cl-op - a partial application library (check out url and scroll down for example under documentation! It's pretty cool)
Main Page: http://code.google.com/p/cl-op/
Blog/Announcement :http://blarneyfellow.wordpress.com/2009/03/05/announcing-cl-op-a-partial-application-library-for-cl/

Intermediate/Advanced (if you want a real challenge; i.e. probably one would only try to determine how it works if one were attempting to expand library; i.e.
some are quite large) -

(1) cl-store - "CL-STORE is a package written by Sean Ross for serializing and deserializing CL objects from streams" i.e. persistent lisp!
http://common-lisp.net/project/cl-store/

(1) cl-opengl - uses the foreign function interface ability for lisp (allows one to make bindings to c libraries). Binds to the OpenGL graphics library.
http://common-lisp.net/project/cl-opengl/
You'll notice that this library requires darcs to download from repository! Fun! :shock:

(1) cl-mpi - cffi binding to MPICH1.2 and MPICH2 library. Allows utilization of multiple cores by running x lisp programs at once (i.e. sbcl.exe, clisp.exe, etc)
and using the MPI protocol to communicate between each process. Well, sort of anyways.
http://code.google.com/p/cl-mpi/

(2) mudballs - easy loading of lisp libraries from internet (some implementations) and from system files.
http://mudballs.com/

(2) cl-ppcre - " Portable Perl-compatible regular expressions for Common Lisp"
http://weitz.de/cl-ppcre/
Harnon
 
Posts: 78
Joined: Wed Jul 30, 2008 9:59 am

Re: How Do You Teach Yourself Programming?

Postby duncan » Tue Jul 07, 2009 5:12 pm

ebie wrote:
duncan wrote:I'd suggest that in addition to reading books about CL you start looking at the simpler libraries.


Thanks so much for your help. Is there a library in particular you would suggest? I don't mind researching them on my own, but if you could point me in a general direction, that would be great.

Thanks again :)


Well, to begin with you might want to take a look at some of the libraries in cl-utilities. A lot of them are pretty compact, self-contained, and not hard to understand. Split-sequence is written bit differently than I probably would have chosen to write it, but it's nice and short and provides a good introduction to loop ;). Pretty much any library you can find that's both very short and used widely enough that you can be sure it works is probably worth reading at first.

In terms of larger libraries, all of Edi Weitz's libraries that I've looked at have been well coded. Unfortunately a lot of them are too complicated to start with, particularly if you haven't been programming for that long. PPCRE tends to get mentioned as good reading, and it does some very interesting things with closures, but it requires a fair amount of background knowledge. Cl-who is quite short though, and it illustrates a few things quite well. It's worth noting how it uses a bunch of regular functions to build up the facilities necessary for the transformation it implements and then uses a few very short top-level macros to get the convenient syntax that's desired.

Other things about Edi's code that are worth looking at, IMHO, are: A fair bit of what he's written needs to be pretty efficient. He tends to do the right thing here, writing efficient code without doing extreme and marginally useful stuff. He also makes use of special variables in a nice idiomatic way. In a lot of languages global variables are best used very sparingly, but CL's special variables avoid a lot of the problems with globals, and they can make code significantly cleaner when used well. They don't get as much press as, say, macros, but they're a nice feature. And in general what he writes tends to exhibit "good taste." So after you've read some shorter libraries you might want to move onto some longer ones. If you're interested in clients, and servers, and protocols (oh, my!) you might find drakma and hunchentoot interesting.

Metatilities also looks like it has some pretty interesting stuff in it- I haven't read through it, but cl-containers looks as if it might be particularly interesting. One thing about programming in a language that comes with a fair number of useful built-in data structures is that it's pretty easy to not learn how data structures are actually implemented in that language. Since there are a number of good open source CLs largely written in CL you can always go and look at how, say, hash tables are implemented in one of them, but if there's a lot of dependence on internals that can get a bit hairy. Some of the other metatilities utilities are likely to require a fair bit of background though (like a good working knowledge of the MOP.)

I see that while I've been writing this Harnon has also responded, and his (?) suggestions are also good.
duncan
 
Posts: 31
Joined: Wed May 27, 2009 9:07 pm

Next

Return to The Lounge

Who is online

Users browsing this forum: Bing [Bot] and 2 guests

cron