The Artima Developer Community
Sponsored Link

Weblogs Forum
Designing a Programming Textbook

28 replies on 2 pages. Most recent reply: Oct 23, 2006 3:36 PM by Nathan Robertson

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 28 replies on 2 pages [ 1 2 | » ]
Christopher Diggins

Posts: 1215
Nickname: cdiggins
Registered: Feb, 2004

Designing a Programming Textbook (View in Weblogs)
Posted: Sep 23, 2006 11:42 AM
Reply to this message Reply
Summary
I have started work on an introductory textbook to programming and I am inviting feedback on my choice of languages and layout.
Advertisement
I've started work on a rather ambitious book called Fundamentals of Programming which will be intended as a programming book for people starting at the very beginning. I thought I would invite some feedback about my proposed structure.

I plan on breaking the book up into the following sections, with the primary example language for that section.

  1. Programming Basics - Cat
  2. Pointers and Memory Addressing - C++
  3. Object Oriented Programming - Java
  4. Functional Programming - Scheme
  5. Mixed Paradigm Programming - Scala
  6. Software Design - Cross Language
The language I associated with each section would be by no means exclusive. I would introduce that particular language, familiarize the user with it, and use it for the bulk of the examples.

One reason for using multiple languages is that I want beginners to be exposed to a wide breadth of languages, and ways of thinking. I want people to feel they are getting their money's worth by becoming familiar with several different major languages.

The usage of the Cat language is risky, since no one has heard of it. However, I really like the idea of starting a lesson on programming using the example of postfix calculators. This leads naturally to an interpreted stack based language.

The choice of Scala, is potentially contentious because Scala isn't as mature as Haskell or OCaml. However Scala is chock full of support for advanced programming techniques, it is type safe, and it has a sane syntax.

The final section would introduce the concept of using the appropriate language(s) for the job. As such I would be sure to mention languages like: Perl, PHP, Python, Assembly, TCL, and others.

The order of these sections are not intended as hard and fast rules. I am hoping to design the book such that entire sections can be skipped or moved. For example, Pointers and Memory Addressing can be placed at the end, or left out entirely. Another possibility is that Functional Programming can be placed before Object Oriented Programming.


Tony Alcock

Posts: 2
Nickname: tonya
Registered: Jul, 2005

Re: Designing a Programming Textbook Posted: Sep 23, 2006 1:26 PM
Reply to this message Reply
> intended as a programming book for
> people starting at the very beginning.

Seriously!

> Programming Basics - Cat

Forgive me if I've got this wrong but isn't Cat a new language ? Surely it would be more advisable to use one of the more established languages to teach beginners ? How much documentation is there currently available for Cat ? How many books ?

> Pointers and Memory Addressing - C++

Shurely shome mishtake !

> Object Oriented Programming - Java

???

> Functional Programming - Scheme
> Mixed Paradigm Programming - Scala
> Software Design - Cross Languag

Yeah right. Beginners will really be in a position
to wrestle with these concepts.

Here's the deal. Programming for beginners:

o Type
o Decide
o Loop

You can hevs that for free!

When are you planning to complete this exercise ?

Cleo Saulnier

Posts: 77
Nickname: vorlath
Registered: Dec, 2005

Re: Designing a Programming Textbook Posted: Sep 23, 2006 2:35 PM
Reply to this message Reply
I wrote a set of tutorials for my brother once. Although he wasn't an absolute beginner, there were many concepts he was missing that most programmers don't have. I saw many people who graduated from University, got their degrees and had no concept of how a computer worked.

First, you need a language that is super simple. BASIC is still good because it's line based. That's all you want to explain simple concepts.

Then you need to explain numbers and how computers operate on them. They need to know how bits work and why things are 8,16 and 32 bits. They need to know how to combine bits to form numbers. They need to know that negative and positive numbers are just a matter of interpretation. They need to know two's complement and that negative numbers can also represent positive numbers (interpretation by specifying signed or unsigned). They need to know boolean operations. Shifting, comparisons, etc.

But the main thing for beginners is to explain how this stuff translates to doing something productive. A LOT of beginners get bored or annoyed because they don't understand the leap of faith most programmers do when it comes to programming. Sure, you have a print command. But how does it do this? How can I write my own print command? How can I display graphics? How can I read the keyboard. The point isn't that you want them to hit the hardware. The point is that you need to tell them how a programming language goes from just doing arithmetic to actually reading and writing to devices (without API calls). Using functions and all the arithmetic in the world isn't going to tell them how this is accomplished. I see many people who say we should be programming at a higher level, but that's no excuse for not teaching beginners how the computer works.

They need to understand memory and how writing to memory can do several things. Writing to certain memory just stores data there. But other memory can be attached to physical devices. For example, each pixel on your screen can be mapped to a certain range of bytes. Writing to those bytes will change the color of a certain pixel on the screen. On a PC, there is another kind of memory used ONLY for devices called the I/O bus. This is where you can access all devices like the mouse, keyboard, HD and everything else. The OS takes care of this for you. Then you can go on to explain which functions in the standard library of the particular language you're dealing with does these things for you. Heck, a C64 emulator and using POKE and PEEK to memory addresses would explain this rather quickly. POKE addresses 0400-07E7 hex for showing text on screen. D800-DBE7 for colors (4bits forground/background of each character). D020 and D021 for border and background color.

There needs to be a bridge between a language and the machine. If the student doesn't understand how the language gets the computer to do something, they must take it on faith. That makes a lot of people uncomfortable.

I still know people who think it's the language that makes the computer do things. They don't understand that the computer in HARDWARE is what makes these things possible.

After that, you can move on to other concepts.

Just to bring home my point, I once helped a friend of mine learn a programming language. This guy was used to working with hardware, so he knew that it was the machine that actually did the work. So after a while, he stopped me and said something to this effect, "All this stuff is nice and all. But let's say I have no OS and no library. How do I get the machine to do something? I can call all my own custom functions and do arithmetic all day long, but if I can't show the results on the screen or get user input, no programming language is going to be of any use. There has to be a way to tell the machine directly to do these things. I don't necessarilly care to do them myself. I just want to know how it's done because right now, it's just a bunch of operations with no substance."

And this was from a guy who knew how the machine worked. After explaining the memory map, he thought languages were childish tools. That it should be a LOT more advanced. This was 1986 and not only has the situation not improved, but the computing industry has now deteriorated beyond recognition.

Leandro Oliveira

Posts: 21
Nickname: lao
Registered: Aug, 2003

Re: Designing a Programming Textbook Posted: Sep 23, 2006 7:12 PM
Reply to this message Reply
I think it's an excellent idea. I wish I had that kind of book when I was an undergrad. But maybe then I would not recognize its value. Although a teacher could make (force?) students to learn the right things. For one thing, I regret not giving functional languages some attention during college.
About Cat, I don't think it's risky to use it in your book. You will not tell those beginners to use it to make "real" software, will you? I mean, if it's just a teaching tool, there will be no harm. If it illustrates clearly the concepts, by all means, use it.

Kay Schluehr

Posts: 302
Nickname: schluehk
Registered: Jan, 2005

Re: Designing a Programming Textbook Posted: Sep 24, 2006 1:09 AM
Reply to this message Reply
One reason for using multiple languages is that I want beginners to be exposed to a wide breadth of languages, and ways of thinking. I want people to feel they are getting their money's worth by becoming familiar with several different major languages.

Don't think this is a beginners issue but one of the "prragamtic programmer" and you are weakening the presentation of concepts by inclusion of arbitrary language details and redundencies of their introduction. Maybe a thorough treatment of stack based languages ( Forth, Joy and of course Cat ) will be more valuable than yet another introduction to programming. You have entered a very nice programming language niche. So why don't you exploit it instead of doing the work of CS professors who turn their lectures into books and will continue to do it forever?

Gregor Zeitlinger

Posts: 108
Nickname: gregor
Registered: Aug, 2005

Re: Designing a Programming Textbook Posted: Sep 24, 2006 10:01 AM
Reply to this message Reply
> I've started work on a rather ambitious book called
> <i>Fundamentals of Programming</i> which will be intended
> as a programming book for people starting at the very
> beginning.
This will be a very demanding book, especially if you start with Cat or anything non-imperative.

How if I suggest you make it an advanced book, grad school maybe. Other than that, I like the idea very much.

I would especially like a chapter on language comparison. I just googled and there is no good language comparison (ohter than syntax comparison or OO language comparisons)

> Object Oriented Programming - Java
wouldn't a pure OO language like Ruby be a better fit? Or maybe C# if you want a more popular language.

Do you plan a chapter on declarative programming?
Prolog, SQL, XQuery?

Christopher Diggins

Posts: 1215
Nickname: cdiggins
Registered: Feb, 2004

Re: Designing a Programming Textbook Posted: Sep 24, 2006 10:13 AM
Reply to this message Reply
> One reason for using multiple languages is that I want
> beginners to be exposed to a wide breadth of languages,
> and ways of thinking. I want people to feel they are
> getting their money's worth by becoming familiar with
> several different major languages.

>
> Don't think this is a beginners issue but one of the
> "prragamtic programmer" and you are weakening the
> presentation of concepts by inclusion of arbitrary
> language details and redundencies of their introduction.
> Maybe a thorough treatment of stack based languages (
> Forth, Joy and of course Cat ) will be more valuable than
> yet another introduction to programming. You have entered
> a very nice programming language niche. So why don't you
> exploit it instead of doing the work of CS professors who
> turn their lectures into books and will continue to do it
> forever?

I am dissatisfied with existing introductory texts on programming. However, maybe you are right and I would get lost in syntactic details if I introduce multiple languages. Of course any single language falls short in one respect or another. Cat for example, has no variables, no memory addressing, and no OOP support. Some of this can be simulated though (variables can be simulated using dictionaries).

Kay Schluehr

Posts: 302
Nickname: schluehk
Registered: Jan, 2005

Re: Designing a Programming Textbook Posted: Sep 24, 2006 12:28 PM
Reply to this message Reply
> I am dissatisfied with existing introductory texts on
> programming.

Of course the situation is worse than in more mature disiciplines. I guess I can open an introductory level textbook on Analysis or Linear Algebra I used during my studies in 20 yrs from now and being still connected to contemporary knowledge. But it is highly unlikely that in 20 years people will remember Cat or Scala unless they are programming language historians. Providing "fundamentals" would be a task for some Bourbaki circle that produces dense and formal work to collect and standardize knowledge ( the archetypical work is of course Euclids "Elements" ). As a single indvidual only Donald Knuth may come close among contemporary science writers but he has a slightly different focus. Java and Scheme that are on your list will persist but Scheme has SICP and Java is mainstream and bread and butter for a whole publishing industry.

> However, maybe you are right and I would get
> lost in syntactic details if I introduce multiple
> languages. Of course any single language falls short in
> one respect or another. Cat for example, has no variables,
> no memory addressing, and no OOP support. Some of this can
> be simulated though (variables can be simulated using
> dictionaries).

Narrowing the focus is seldom a bad decision unless you seek a life-task. If you are busy with stack oriented languages than go for it. It's not such a small field regarding that a virtual machine is essentially executing a stack oriented imperative language. Think this could be an interesting field to explore in particular because you are working about stack oriented functional languages.

Mumtaz Shah

Posts: 10
Nickname: mumtaz
Registered: Feb, 2006

Re: Designing a Programming Textbook Posted: Sep 24, 2006 12:54 PM
Reply to this message Reply
> I've started work on a rather ambitious book called
> <i>Fundamentals of Programming</i> which will be intended
> as a programming book for people starting at the very
> beginning. I thought I would invite some feedback about my
> proposed structure.
> <p/>
> I plan on breaking the book up into the following
> sections, with the primary example language for that
> section.
>
> <ol>
> <li>Programming Basics - Cat</li>
> <li>Pointers and Memory Addressing - C++</li>
> <li>Object Oriented Programming - Java</li>
> <li>Functional Programming - Scheme</li>
> <li>Mixed Paradigm Programming - Scala</li>
> <li>Software Design - Cross Language</li>
> </ol>
>
> The language I associated with each section would be by no
> means exclusive. I would introduce that particular
> language, familiarize the user with it, and use it for the
> bulk of the examples.
> <p/>
> One reason for using multiple languages is that I want
> beginners to be exposed to a wide breadth of languages,
> and ways of thinking. I want people to feel they are
> getting their money's worth by becoming familiar with
> several different major languages.
> <p/>
> The usage of the Cat language is risky, since no one has
> heard of it. However, I really like the idea of starting a
> lesson on programming using the example of postfix
> calculators. This leads naturally to an interpreted stack
> based language.
> <p/>
> The choice of Scala, is potentially contentious because
> Scala isn't as mature as Haskell or OCaml. However Scala
> is chock full of support for advanced programming
> techniques, it is type safe, and it has a sane syntax.
> <p/>
> The final section would introduce the concept of using the
> appropriate language(s) for the job. As such I would be
> sure to mention languages like: Perl, PHP, Python,
> Assembly, TCL, and others.
> <p/>
> The order of these sections are not intended as hard and
> fast rules. I am hoping to design the book such that
> entire sections can be skipped or moved. For example,
> Pointers and Memory Addressing can be placed at the end,
> or left out entirely. Another possibility is that
> Functional Programming can be placed before Object
> Oriented Programming.

I would have done it this way:

0. Basics of a computer
1. Programming Basics ... BASIC !
2. Pointers and Memory Addressing... C
3. Object Oriented Programming...C# (OO features)
4. Functional Programming ... C# ( functional features )
5. Generic programming..... C# ( generics )
6. Declarative Programming ... C# ( linq )
7. Mixed Paradigm Programming ... C# ( all put together )
8. Software Design...I dont know.

When you are trying to teach fundamental concepts and semantics of computer programming...the syntax should NOT be changing at the SAME time. You cant confuse the beginner more...and no single programming language, in my opinion, is as cleanly designed, multiparadigm, tool supported, marked valued, etc etc as C#. I am surprised how often its NOT mentioned in discussions like these.

Gregor Zeitlinger

Posts: 108
Nickname: gregor
Registered: Aug, 2005

Re: Designing a Programming Textbook Posted: Sep 24, 2006 1:24 PM
Reply to this message Reply
> I am surprised
> how often C# is NOT mentioned in discussions like these.
This may be because a significant part of those multi-paradigm features will only be introduced next year with C# 3.0/.NET 3.5, espically the functional and declarative ones.

I have pointed out some of the features though: LINQ in general and method additions (vs. Scalas implicits) in particular.

But I am surprised that Diggins hasn't talked about them, given that he might have talked about programming languages with this collegues at MS.

Roland Pibinger

Posts: 93
Nickname: rp123
Registered: Jan, 2006

Re: Designing a Programming Textbook Posted: Sep 24, 2006 2:37 PM
Reply to this message Reply
> <ol>
> <li>Programming Basics - Cat</li>
> <li>Pointers and Memory Addressing - C++</li>
> <li>Object Oriented Programming - Java</li>
> <li>Functional Programming - Scheme</li>
> <li>Mixed Paradigm Programming - Scala</li>
> <li>Software Design - Cross Language</li>
> </ol>
>
> One reason for using multiple languages is that I want
> beginners to be exposed to a wide breadth of languages,
> and ways of thinking. I want people to feel they are
> getting their money's worth by becoming familiar with
> several different major languages.

You may be intersted in Peter Grogono's book:
http://www.ulb.ac.be/di/rwuyts/INFO020_2003/grogono-evolution.pdf

Eivind Eklund

Posts: 49
Nickname: eeklund2
Registered: Jan, 2006

Re: Designing a Programming Textbook Posted: Sep 25, 2006 4:34 AM
Reply to this message Reply
I am guessing C# is not mentioned because C# is (effectively) Windows only and thus irrelevant for most of those that are interested in languages.

For this particular case, I think Christopher is overlooking dynamic OO languages (introduce Ruby, Python or possibly Smalltalk), and that the use of C++ to introduce pointers is a mistake. Use C or assembler instead.

Max Lybbert

Posts: 314
Nickname: mlybbert
Registered: Apr, 2005

Re: Designing a Programming Textbook Posted: Sep 25, 2006 7:50 AM
Reply to this message Reply
I know many big-name schools teach (or used to teach) Scheme for introductory programming on the theory that the language was so simple it didn't get in the way of teaching the concepts ( http://www.joelonsoftware.com/articles/ThePerilsofJavaSchools.html ).

I like the general concept you've laid out. I'd highly discourage using C for teaching about pointers, because vanilla C is not as type-safe as C++. I would also recomend teaching how to use libraries etc. first, then how to write them. IOW, an introductory "you write in a programming language; your compiler turns that into something for the computer to understand" chapter, followed by "given an object with the following methods, how would you do this?"

Then go into free functions (and recursion), then go into object design ("several of our previous functions were related, and always required a Vehicle* as a parameter, let's show that through a Vehicle class, ..."). I learned C++ through Computing Concepts with C++ Essentials (now Big C++ -- http://horstmann.com/bigcpp.html ), which teaches object use before teaching object design. You see the same pattern in Accelerated C++, and it make a lot of sense. It's very easy to understand that
obj.method()
calls a method, and there's no need to go into details right away about how to design that method, or how that method has access to data inside
obj
.

Then cover functional programming (as you're doing now), and make the point that some problems lend themsleves to different approaches, which segues into mixed-paradigm languages and cross language development.

Max Lybbert

Posts: 314
Nickname: mlybbert
Registered: Apr, 2005

Re: Designing a Programming Textbook Posted: Sep 25, 2006 7:52 AM
Reply to this message Reply
Aargh. I have to remember the "pre" tag isn't for inline code. Sorry about the bad formatting.

Malte Finsterwalder

Posts: 20
Nickname: jufoda
Registered: Aug, 2003

Re: Designing a Programming Textbook Posted: Sep 25, 2006 8:57 AM
Reply to this message Reply
> <ol>
> <li>Programming Basics - Cat</li>
> <li>Pointers and Memory Addressing - C++</li>
> <li>Object Oriented Programming - Java</li>
> <li>Functional Programming - Scheme</li>
> <li>Mixed Paradigm Programming - Scala</li>
> <li>Software Design - Cross Language</li>
> </ol>

I'm also concerned, that you are using too many languages.
Too much clutter by syntax with too little value for the user.

Some of the languages are also "unusual". To be of value to a newbie, he needs to have access to the language and need to be able to install and programm it at home.

Otherwise you are into pure theoretical discussions and then you might as well design your own syntax (as you see fit).
Not a good idea, I think.

You might know, but you should really think hard about: Who exactly is your audience? What do they know. What can they already do? What exactly do you want to teach?
You are doing a giant truckload full of stuff. That way over the head for most real newbies, I suppose. It may be the right stuff for C or even Java Programmers who don't know anything else?

Flat View: This topic has 28 replies on 2 pages [ 1  2 | » ]
Topic: Designing a Programming Textbook Previous Topic   Next Topic Topic: Python For Dummies

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use