Gas station without pumps

2012 July 2

A critique of CS textbooks

Filed under: Uncategorized — gasstationwithoutpumps @ 14:56
Tags: , , ,

Abstruse Goose » Arithmetic for Beginners has a cartoon critique of CS textbooks:

Image copied from http://abstrusegoose.com/474, permission assumed based on the Creative Commons license on that page.

I have never had this problem with CS books, but I made the transition from complete novice to experienced programmer over 40 years ago, when there weren’t many CS textbooks in existence. I’m curious what students who have only recently learned programming feel—is the author of the cartoon capturing a common experience, or is his reaction completely idiosyncratic?

17 Comments »

  1. I have encountered programming texts like this. Last year I tried to “fill in the blanks” on a text book that did this. The page number doubled rather quickly. It really helped me understand the difficulty of writing a good tutorial or guided textbook. It is hard to give all the required information in the text and yet not make the text a typing exercise for the reader.

    Comment by gflintGarth — 2012 July 3 @ 09:29 | Reply

  2. I love this! This is so typical of math textbooks!

    However, this is NOT the problem with CS textbooks. The problem with CS textbooks (and I am really talking about Intro to CS books, not books aimed at experienced programmers who simply need to learn language XYZ), is that the authors think they have to cover EVERYTHING about the language, and about computer science in general, in one densely written tome. The print has gotten so small in those books that my 40-something eyes can’t even focus any more. The books cover way more than a CS1 student ever needs to know. I will pick on Java books since I have a bunch of them at my side, but the problem is not confined to Java – I see this in every CS1 textbook, no matter the language. Why do all the Java books feel they need to present increment operators early on when students don’t even understand assignment yet. Why does the chapter on loops degenerate into a laundry list of loop operators, including enhanced for loops before the students have even seen the kinds of collections that they were intended for? Do students seeing conditionals for the first time REALLY need to know about case statements? I could go on and on.

    The other, related problem is that the vocabulary used in most textbooks is way beyond the average college student. And explanations tend to be too terse where it matters, and too wordy where it doesn’t. Do we really need 5 pages on coupling and cohesion? Students at that level have no idea what that means. Also, textbooks do not make nearly enough use of diagrams and repetition of concepts.

    If I had time, I would like to write a new Intro to Java textbook which would be radically different. Each chapter would focus on ONE construct, and include many examples of using that construct. The examples would include test plans, which are mainly absent form current textbooks. The testing strategies would be EXPLAINED. The loop chapter would cover while loops, and only while loops. I could include a little appendix that showed for loops, if people really wanted it. The first couple of chapters would focus completely on the assignment operator, with many, many diagrams of values hopping into shoeboxes. Increment operators would be banished to the appendix. The last two chapters would present object oriented concepts, in a still simple way – we do not have to explain the this keyword, for example, or get into weird constructor interactions. The book, a thin tome by current standards, would use a friendly, conversational tone, similar to the Greenfoot textbook.

    I think people would start loving Java as a teaching language again if my textbook were out there :-)

    Comment by Bonnie — 2012 July 3 @ 10:20 | Reply

    • I think that if you are going to just teach a few topics, it is better to have a small well-designed language rather than trying to subset an enormous one. So Python would be a better choice than Java for that first book.

      I have seen a different problem in one of the biggest of the Python books: Mark Lutz’s Learning Python. After about 200 pages, you still haven’t learned enough to write a program—the book is full of Pythonic propaganda and Mark Lutz being full of himself, and very short on how to write a program in Python. I ended up using it as an over-priced doorstop, since it was useless for anything else. Alex Martelli’s Python in a Nutshell was much more useful, though it is still long (at 656 pages) and not aimed at first-time programmers.

      I was going to teach an intro programming course this year to biologists, and started looking at Mark Johnson’s A concise introduction to programming in Python and Mitchell Model’s Bioinformatics programming using Python, but I did not get very far looking at either one before my teaching assignment changed. So I’ve not evaluated either book really.

      Comment by gasstationwithoutpumps — 2012 July 3 @ 10:57 | Reply

  3. […] this cartoon I found from GasStationsWithoutPumps which is a reference to Abstruse Goose. Yes, CS textbooks do […]

    Pingback by Yup, That’s What CS Textbooks Are Like « Computing Education Blog — 2012 July 4 @ 03:00 | Reply

  4. For CS students I prefer to teach a typed language for a whole host of reasons. I think Python makes sense, though, for people who are in other fields. Though after last semester’s debacle with PHP, I think I prefer to never go near an untyped language again.

    Comment by Bonnie — 2012 July 4 @ 06:19 | Reply

    • Having had C++ as my main programming language for over 25 years, I can understand the attraction of statically typed language. I don’t think that it is the right place to start teaching computer science to novices, though. The advantages of compiler-time type checking are most apparent on big projects and the extra conceptual burden should be added only after students have used and appreciated many different types.

      I find Python’s strong dynamic typing to be a good compromise for beginners, and quite appealing for rapid prototyping of programs. I miss the ability to declare variables though, as it provides an excellent way to catch typos and an obvious place to look for comments describing the meaning of variables. I don’t think Python is really suitable for large multi-person projects, as it does not provide clean interface specification.

      Comment by gasstationwithoutpumps — 2012 July 4 @ 08:45 | Reply

      • See, I teach my students from the very beginning to work with libraries, and to read method signatures. There is useful information in those types. What made PHP so disastrous, in fact, was that the students didn’t have type information, so they would have to read the code that others had written in order to use it. And they made a lot of mistakes, mistakes made far more mysterious by the lack of a compiler. They had bugs that took hours to solve that would have been solvable in minutes with a real compiler. I always tell my students that the compiler is their friend.

        Comment by Bonnie — 2012 July 4 @ 15:09 | Reply

        • Sadly bonnie, that’s where you’re wrong. Python has docstrings which have even MORE useful information than the type information in Java, or Pascal or C#. Secondly python has an interactive mode, whereas these other languages don’t, and so you can “enquire of a thing” how it is to be used, and try calling it, and when you’re comfortable using it, once you have a certain depth of “knowledge of what is idiomatic” you become proficient (IN ANY LANGUAGE THIS IS THE SAME). The difference is that the set of things you need to know to be useful in Python is about 1/25th of what you need to learn to be useful in Java, or C#. Rewarding success is the key pedagogical step that most people who would like to teach programming but who do not grok python, are overlooking. Interactive DYNAMICALLY TYPED languages are not UNTYPED. The type system is dynamic. Everything has a type, and unlike PHP there are no insane type auto-coercions.

          Don’t tar Python with PHP’s brush.

          Warren

          Comment by WarrenP — 2012 July 5 @ 16:31 | Reply

          • I disagree with you, Warren, about one thing: Python docstrings. Good docstrings can be very informative, of course, but there is nothing at all enforcing the existence, much less the quality, of docstrings. Getting students to write good docstrings is even harder than getting them to write good code.

            The interpreter is moderately useful in figuring out how to use an object. “Duck typing” for polymorphism is a very powerful concept, but you have to know what to try before the interpreter is that much help in figuring out an object.

            The key to Python as a good language for beginners, though, is “the set of things you need to know to be useful in Python is about 1/25th of what you need to learn to be useful in Java, or C#.”

            Comment by gasstationwithoutpumps — 2012 July 5 @ 17:08 | Reply

  5. I really like the style of the Greenfoot book, btw, and my students love it too. But it is tied to Greenfoot, of course, and there is only so much we can do with that.
    On the other hand, I tried using HeadFirst Java for a course on Java that we were teaching to people who could already program, but the students hated it. I had high hopes because the book does a lot of what I think is important – lots of diagrams, lots of focus on what is actually happening when references are passed around – but the students thought it was confusing.

    Comment by Bonnie — 2012 July 4 @ 06:22 | Reply

    • I’m curious about what method would be best for learning Java by someone who is already a programmer. There are two people I have in mind: myself and my son. I’ve been a C++ programmer for decades and never had any reason to switch to Java (still don’t really). I’m looking to learn Java syntax and anything that Java does significantly different from C++. The syntax won’t take long, but finding the odd corners of the language that behave quite differently could take a while.

      My son is primarily a Python programmer, but he has a pretty good notion of classes and has done more with GUIs and multithreading than I have (he’s also done Logo, Scratch, C, Scheme, and small amounts of C++). He’s looking to learn data structures (he’s had lists in Scheme and he studied hash table collision algorithms in C for his 7th grade science fair project, but he wants a more complete repertoire) and Java syntax. He is likely to find the odd corners of the language faster than me (he knows more esoteric parts of Python than I do—sometimes this leads to very clean solutions to programming problems, and sometimes to obfuscated Python).

      Comment by gasstationwithoutpumps — 2012 July 4 @ 08:58 | Reply

      • When I started in industry, we were all working in C++, and then management decided (for actually some very good reasons) that we would all switch to Java. And we did, literally in the course of a couple of weeks, with no official “training” or even much work at all. Java is totally simple for a C++ programmer. Just remember that references behave like pointers and you will be fine.

        Comment by Bonnie — 2012 July 4 @ 15:06 | Reply

      • My kid is younger than yours, I believe (he is 12). He is a Scratch fanatic and is ready for more. He is starting to get into Greenfoot, which I think is an appropriate step for him. The scary thing is, he understands it far better than my college students.

        Comment by Bonnie — 2012 July 4 @ 15:11 | Reply

  6. Who reads their textbook at all? I think code academy is on the right track – structured, dynamic tutorials.

    I used to devour c++ books, but these days the internet has every reference, tutorial, and forum. And your ide can often help you, too.

    Comment by Riley Lark — 2012 July 15 @ 16:18 | Reply

  7. […] A critique of CS textbooks […]

    Pingback by 2012 in review « Gas station without pumps — 2012 December 31 @ 11:18 | Reply

  8. […] A critique of CS textbooks […]

    Pingback by Blogoversary 3 | Gas station without pumps — 2013 June 1 @ 20:01 | Reply

  9. […] A critique of CS textbooks […]

    Pingback by Blog year 2015 in review | Gas station without pumps — 2015 December 31 @ 17:07 | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: