83

I hear about C, C++, Java every day whenever people starting talking about computer science, but in my first computer science class we are asked to write in Scheme (DrRacket).

Why is that?

What differences will this make to my future understanding of programming?

UPDATE: I have finished my first term, but not completely done with Scheme. In my second term (which is now) we got in to C programming. It was frustrated to learn pointers at first, but now I feel much better.

There's not much more to say than that. I'm trying to teach myself Java (or C++?) for the OOP part which I'm missing. So far, I still like functional programming best. Lambda is just fascinating. :)

Thijs van Dien
  • 1,071
  • 1
  • 7
  • 13
Erica Xu
  • 1,131
  • 1
  • 8
  • 12
  • 150
    Congratulations, it sounds (to me) like you may be going to one of the few schools left that actually tries to teach computer science. Learning Scheme as a first language is (IMO) a very good thing. No, it's not as commercial as many others, but it's an excellent language for learning the real essence of computer science. – Jerry Coffin Oct 20 '11 at 03:32
  • 22
    C, C++ and Java are industry byproducts of computer science. Scheme's entire roots are in computer science. The languages in commercial use have as much to do with computer science as McDonalds has to do with cuisine. – JasonTrue Oct 20 '11 at 05:30
  • 36
    These guys are correct; you are confusing *computer programming* with *computer science* -- as Dijkstra said, that's like confusing telescope construction with astronomy. Scheme is about the best language there is for learning basic concepts in *computer science*. If you're expecting that taking a computer science degree is about learning how to write line-of-business apps in Java, you might be enrolled in the wrong program. – Eric Lippert Oct 20 '11 at 07:40
  • 31
    For the same reason that zoology courses teach evolutionary biology, anatomy and animal behaviour rather than how to muck out an elephant stall – jk. Oct 20 '11 at 07:58
  • 5
    Once you have your feet under you with understanding the basis syntax of Scheme, try reading "The Little Schemer". It is a thin book, but if you can understand everything in it you'll have a really solid grasp on the fundamentals of functional programming languages. – Eric Lippert Oct 20 '11 at 15:58
  • 1
    I would have to say that it is a strange choice. However, if you specialize in CS, expect lots of abstract concepts and courses you will not make any money with (unless you sell books about it!) :) – NoChance Oct 20 '11 at 17:24
  • 2
    If you know Scheme, you'll have a lot more appreciation for JavaScript than somebody who mostly only hit Java and C# through comp sci courses. – Erik Reppen Jul 10 '13 at 03:57
  • 2
    The same reason you don't study Britney Spears when going to music school. One might hear it every day, but what is pop doesn't mean it is good. It might even be misleading and corrupt your brain making it unable to recognize good ideas if you try to learn it. Such is the case of C, C++ and Java. – Thiago Silva Nov 25 '13 at 15:42

11 Answers11

93

Sounds like a great school! Lisp dialects follow the mathematical paradigm of algorithms much more closely. They force programmers to learn recursion and the functional style. This is excellent experience. Your school is in the ranks with MIT, which still uses Abelson and Sussman for the required CS 6.001.

You might find this article encouraging and helpful in understanding the issue.

Jonathan Henson
  • 5,039
  • 3
  • 26
  • 33
  • 7
    "Force" is probably not a good word to use. How about "train"? – Barry Brown Oct 20 '11 at 04:04
  • 5
    Actually, there have been sweeping changes in MIT's EECS curriculum over the past couple of years. Their intro course is split over two courses now (see http://mit.edu/6.01/mercurial/fall11/www/index.html for the first half), and the majority of the language instruction is in Python. – jonsca Oct 20 '11 at 04:29
  • 5
    I agree that Scheme is a great language and it's a good idea to learn it. However, let's face it; almost every real-world programming job employs an imperative language; most really serious programming jobs require C++, and C++ programmers usually actively **discourage** you from using all the nice mathematically-based ideas for program design for one reason or another. Recursion won't play a large role in your imperative programs. – Felix Dombek Oct 20 '11 at 10:05
  • 4
    @FelixDombek, are you sure? *All* ideas? Really? An imperative loop is a mathematicall idea too, mind you. – SK-logic Oct 20 '11 at 11:41
  • 1
    @SK-logic: I wrote that with respect to the "Lisp dialects follow the mathematical paradigm of algorithms more closely" answer. This sentence is correct, and what I wrote about C++ basically follows from this. Maybe not *all* mathematical ideas are discouraged in C++, but there are, for instance, some good reasons to use iteration instead of recursion. C++ makes it entirely possible to write a program in the same manner as you would write a basic Lisp program; in practice, this is hardly a good idea. – Felix Dombek Oct 20 '11 at 14:45
  • 3
    @FelixDombek, I can only see a reason to use iteration instead of a *tail* recursion in C++. All the other forms of recursion are served exactly the same way as in functional languages implementations. So I can't agree with your remark at all. The more math you put into your C++ coding, the better. I doubt you're going to try implementing, say, red-black trees in C++ without recursion. – SK-logic Oct 20 '11 at 14:59
  • 3
    @SK-logic: So you name one thing where the recursion is hard to eliminate. Big deal. I don't doubt that there are more use cases. In fact, I never learned Lisp, but from my experience with Prolog (which also employs recursion almost exclusively), you don't use the same approach in C++. People don't process linked lists recursively even if that seems logical. People don't do wildcard matching recursively even though you might find it more readable and easier to implement. And so on. De-recursivizing recursive algorithms makes constant memory usage possible, that's why it's important. – Felix Dombek Oct 20 '11 at 15:16
  • 1
    @FelixDombek, you'd be surprised, but you don't use recursion exclusively in Lisp too (for example, many Common Lisp implementations won't guarantee you a proper tail calls optimisation). There is a very little difference between CL and C++ when it comes to manual optimisation. – SK-logic Oct 20 '11 at 15:23
  • 2
    @Felix Dombek - If you simply want to learn programming, MIS courses are sufficient. If you want to learn Computer Science, then you need a more formal understanding of computing. A real understanding of Computer Science (usually) makes you a better programmer. Only occasionally does being a better programmer help you better understand Computer Science. – Wayne Werner Oct 20 '11 at 18:48
  • @FelixDombek - I would say that the *really serious* web application and WinForms coders around here that work in Java or C# (or PHP, Perl, Obj-C, etc) would take some umbrage with your display of purism. Just because we play in sandboxes doesn't mean we don't make some seriously awesome sandcastles. I started with C++, but haven't touched it since my college freshman year. – KeithS Jul 10 '13 at 02:01
  • @FelixDombek: "almost every real-world programming job employs an imperative language": This is indeed true and sad at the same time. – Giorgio Dec 30 '14 at 09:43
39

Congratulations, you're now being turned into the equivalent of a vegan in the computer world, and in two years you won't be able to end up any discussion without informing people about the higher moral ground you stand up onto. ;)

Anyway you landed a very good school. Schools that are not industry-whipped are good.
As someone else said, they teach you the science, from which you derive the craft.

Many bad code-monkey-farms teach you the craft, and then you may happen to infer the science from it, but it's not guaranteed. (and you may end with pretty weird misconceptions about it)

Anyway, as an honored member of the functional crowd, when you get out of there, you'll always feel misunderstood and under-appreciated.

Which, let's admit it, for the average computer wiz is nothing new.

You're in now for an high risk of:

  • trying to wrap up in an academic career,
  • embark in the pursuit of a PHD,
  • ...emacs.

You will also probably like open source, but you will never find enough collaborators for your functional projects.

ZJR
  • 6,301
  • 28
  • 36
  • 2
    Sorry, to necro-comment, but why emacs? I'm curious. I'm in the same boat as OP was (starting college freshman this fall) and we're going to use Racket (similar to Scheme). – Kevin Johnson Jul 01 '15 at 01:15
  • 3
    @KevinJohnson emacs is frequently referred as **an operating system written in LISP that accidentally helps lots of people edit code**. If you do functional paradigms and *(are taught to)* like the obscenities of LISP-like syntaxes, it will likely grow on you as your preferred text editor. – ZJR Jul 01 '15 at 17:19
  • 2
    "teach you the science, from which you derive the craft": +1 – Giorgio Oct 04 '16 at 19:22
38

No one expects that as a freshman you'll be proficient enough in any language to get a real job, so why not start with one that's easy to learn? Expecting novices to learn programming by using a professional language in a professional IDE is kind of like giving a scalpel to a first-year med student and having them work on live bodies.

Don't worry; you'll eventually learn Java/C/C++, probably starting your second year. If you started learning Java 6 now, by the time you graduate Java 8 will be out. Or it will have been replaced by Python. Or some other language that hasn't been invented yet but takes the industry by storm. Better to put off learning the "popular" stuff as long as possible so it's not obsolete when you get out in the workforce.

Scheme/Racket will help you focus on the important concepts: algorithm design, data structures, and information manipulation. You know, the stuff that's common to all languages.

Barry Brown
  • 4,095
  • 4
  • 25
  • 27
23

What differences will this make to my future understanding of programming?

That's a little like asking how reading Shakespeare will help you write term papers. Programming (in any language) is just a means for expressing your ideas in executable form. Computer science provides the conceptual building blocks that will give you something interesting to say. Scheme syntax is relatively simple, so you can get to interesting ideas quickly and without running into a lot of compiler errors, standard libraries, etc.

Pay close attention in class -- you're going to learn a lot of interesting stuff this semester.

Caleb
  • 38,959
  • 8
  • 94
  • 152
15

It seems like you are very new to programming having no prior experience in it at all. So here are some clarifications:

Why Scheme and not C/C++/Java...?

When learning a programming language (an analogy could be made with the English language) you learn the syntax you need to follow so that your code is gramatically correct. However a language won't teach you the logic behind solving problems. In order to learn that logic, you learn different programming paradigms.

Each language can implement (more or less accurately) one or more paradigms. A paradigm is a way to structure your logic, and the paradigm implemented by Scheme is called Functional Programming(FP).

So the real question you're asking is: Why FP?

As you mentionned, C, C++ and Java (who don't implement FP) are far more popular. As a matter of facts, (and for various reasons, everyone have their opinion) FP is not very popular in the industry.

On the other hand, FP is very highly regarded in academic circles. It is closer to the common mathematical approach, focuses more on provability and optimization of algorithms, and most people will agree that it would make you a better programmer in general.

It's similar to schools that teach Latin in order to study English litterature.

rahmu
  • 1,026
  • 6
  • 16
  • 1
    Scheme doesn't have to be used functionally, although it's more likely that you will do so than in C, C++ and Java. – Ricky Clarkson Mar 09 '12 at 12:50
  • "It's similar to schools that teach Latin in order to study English literature.": Or to operating systems classes that teach a Unix-like OS instead of other, more wide-spread OSs. – Giorgio Feb 20 '17 at 06:34
11

You're supposed to learn how programming is being done and what the basic concepts are. The everyday languages used in most businesses might be well suited for producing the software needed today, but aren't necessarily best suited for teaching you the basiscs of programming.

Once you have grasped the concepts, it's easy to apply them to other languages.

Christian Seifert
  • 2,096
  • 12
  • 19
  • 4
    "The everyday languages used in most businesses might be well suited for producing the software needed today" -- Considering the typical cost, quality, and success rates, that's a rather optimistic statement :-) – Jörg W Mittag Oct 20 '11 at 10:58
  • That's definitely true! That's why I wrote "might" instead of "are" :-) – Christian Seifert Oct 20 '11 at 11:26
  • 1
    "Once you have grasped the concepts, it's easy to apply them to other languages." - This statement is all too true. I suspect it would take me about a week to pick up the syntax in just about any new language, and be proficient. I was taught C/C++ and Assembly in school, but I taught myself Python on the side and Lisp for a research project. Without the fundamental understanding I gained from Python, Lisp, and Assembly, I doubt I would be nearly the programmer I am today. – Wayne Werner Oct 20 '11 at 18:55
9

If you're learning with DrRacket, I'll bet you're also using the How to Design Programs curriculum.

Here's what one of the (admittedly biased) authors of HtDP has to say about the how teaching Scheme has prepared undergraduates at Northeastern University for the cooperative education program ("co-op": students alternate semesters of academic study with semesters of full-time employment).

Prior to my arrival, Northeastern had been using a standard curriculum for two decades: three terms of the currently fashionable language (Pascal, C++, Java), using a set of extremely graphics-rich exercises intertwined with lessons on practical applications. The curriculum was widely published in SIGCSE and related communities, but it didn’t work. At the height of the web bubble, only around one third of the students got programming co-ops; most others ended up as “techies” as they called themselves: moving computers, running scripts, setting up routers and networks, etc. And all of this education cost $150,000 tuition.

After a year at Northeastern, our dean asked me to take over the first course. The first instance was a success—contrary to predictions from some local faculty. Even though it had been considered a trial, we switched to the TeachScheme! curriculum permanently; the dean suggested that I design a bridge course to connect the HtDP course to the rest of the curriculum; this started my collaboration on HtDC with Viera Proulx. See the postscript below. Within a couple of years, I started hearing from our co-op faculty that the share of programming positions was going up. By 2007—the last time I was involved with the course—I was told that the ratio of programming on the first co-op went up to two thirds and higher. In the meantime, all TeachScheme! courses have been taught by numerous faculty members with rather different teaching styles and personalities than my own. The ratio of programming co-op has risen to three quarters and more, and all the downstream faculty are happy about the students’ programming skills.

Edit: for those very interested in the rational behind the curriculum, here's the main architect's explanation - http://www.youtube.com/watch?v=m3be1PHW5X0

pidge
  • 191
  • 3
6

My school started with Scheme also. One reason that was mentioned was this helped leveled the playing field. Most 1st yr Comp Sci might have some, or a lot, of exposure to more common languages. It was less likely that anyone person had a lot of knowledge of Scheme.

dark fader
  • 254
  • 2
  • 5
  • 4
    I agree; I started CS knowing Pascal, C, Basic, x86 Assembler, while others had experiences in different languages or none at all. We were introduced to ML which not only no one had any prior experience with but which had a paradigm so foreign that it was like starting over even for the most experienced among us. Later, I think ML (the functional paradigm) is the most useful thing I learned at CS. – KaptajnKold Oct 20 '11 at 07:39
6

Actually, as Lisp (Scheme being a dialect) is the Grande Dame of functional languages (think of F#, Groovy, Clojure, Haskell etc), then this training does not leave you at any sort of commercial disadvantage either, as this is the hottest topic on the development block right now.

adrianmcmenamin
  • 678
  • 3
  • 14
4

Scheme will help you get good and think in the proper way to use functional programming languages. Scala for example is a Functional/OO hybrid that is quite brilliant, although a bit dense. Languages like this though mark the future - hopefully.

Lisp-like languages though have a purity and simplicity to their design that make them a bit easier for teaching. The nice benefit though is that you'll have a much easier time learning something like Scala afterward.

egervari
  • 397
  • 1
  • 2
  • 7
3

We completed Scheme in the first and first-half of the second semester. It was not until we actually got down to working with C that I began to realize the power of Scheme.

As to your question, why Scheme is chosen: the answer is that it is one of the simplest languages out there and it allows you to do alot (especially when we start playing with lazy lists later on). Moreover :

  1. For people who have no programming experience, it is easier to learn. There aren't many technical details and just a few special forms.
  2. It allows for higher level abstraction. A good course can focus on teaching programmers how to think instead of focusing on the technical details which allows students to become better programmers.
  3. The lists are amazing. There is so much that you can do with them. Car and cdr prove to be powerful tools and it is only when you start working with pointers that you realize that Scheme was amazing at handling lists.
BЈовић
  • 13,981
  • 8
  • 61
  • 81
Avian78
  • 43
  • 1
  • 7