Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.c

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 03-05-2012, 12:21 PM
John Coleman
Guest
 
Posts: n/a
Default Recommendation for a text

Greetings,

I teach math and computer science (though mostly math) at a small liberal arts college. Because of our smallness we don't have a huge course offering.To compensate, we have a grab-bag "special topics course" where we cover different topics each semester based on student's and/or professor's interests.

Next fall I will be running a special topics course with the title "Modern C Programming". The motivation for the course is that currently our CS students are exposed to C++, Java and a smattering of other languages (e.g. Lisp in an elective AI course) but no C per se. While in principle they learn some C naturally in the course of learning C++ they really don't learn all that much about things like pointers, malloc, and the safe handling of C-style strings and they definitely don't learn anything about C99. The proposed class is intended to give a serious introduction to C to students who have a working knowledge of either C++ or Java. This will allow me to blow through the basic syntax of expressions, loops, etc. in a couple of weeks and to spend the bulk of the semester on aspects of C which are different from Java and even C++.

My question is - what would a good text be? My first tentative choice was King's "C programming: a modern approach", but I have also been looking at Kochan's book "Programming in C". More recently I have been toying with the idea of using K&R. On the one hand that seems on the face of it like a poorchoice for a course called *Modern* C programming. On the other hand - it *is* a classic and seems to hit the right level of difficulty (a course forstudents who already know at least one programming language). My main question is - does the merits of K&R outweigh the disadvantages of the lack of coverage of C99? I could of course supplement K&R by e.g. O'Reilly's "C Pocket Reference" which covers the C99 material. Where I'm at right now is that my heart says to go with K&R but my head says go with King (or Kochan). The bookstore wants a decision on my part sooner rather than later.

Also - I am open to ideas about projects for the students to work on. One idea that I had was to concentrate on the Mandelbrot Set. Towards the beginning of the semester they could have a program which just prints to the command line e.g. with '*' for points in the set. Later on they could write it to a portable bit map text file. Even later they could write it to a .bmp file in which they have to get the header and the byte-alignment correct. Finally, I could have them rewrite it in C99 with e.g. the complex-number type and variable-length arrays so they don't have to hard-wire in the size of the bitmap. This topic of course reflects my interest as a mathematician.I have less ideas when it comes to straight computer-science applications (although Jacob Navia's idea about a hex-dump utility for pedagogical purposes caught my eye).

Thanks in advance for any suggestions

-John Coleman
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 03-05-2012, 01:27 PM
jacob navia
Guest
 
Posts: n/a
Default Re: Recommendation for a text

Le 05/03/12 14:21, John Coleman a écrit :
>

You can use my compiler system and its associated text book:
"An introduction to C programming using lcc-win".

It has several advantages:

o It is free of charge (the compiler AND the introduction)
o It starts from the ground up, but covers sophisticated topics
like in-depth floating point analysis, memory allocation strategies
and many others.

o It is geared to lcc-win but all extensions of lcc-win are clearly
marked as extensions.

I am sure many people in this group will start complaining about it
and propose you gcc or some variant. Just ignore them :-)

You can judge yourself by downloading it from

http://www.cs.virginia.edu/~lcc-win32

To download the introduction only, click on the "Tutorial" button.

Jacob

Reply With Quote
  #3 (permalink)  
Old 03-05-2012, 01:35 PM
Stefan Ram
Guest
 
Posts: n/a
Default Re: Recommendation for a text

John Coleman <jcoleman@franciscan.edu> writes:
>I will be running a special topics course with the title
>"Modern C Programming"


What does »modern« suggest in this context?

>pointers, malloc, and the safe handling of C-style strings


This is classic, traditional C.

>C99


This is obsolete (canceled and replaced by ISO/IEC 9899:2011).

>One idea that I had was to concentrate on the Mandelbrot Set.


That was the height of fashion some decades ago. There is nothing
wrong with that. But why then, of all things, you choose »modern«
to title your class?

Reply With Quote
  #4 (permalink)  
Old 03-05-2012, 01:52 PM
John Coleman
Guest
 
Posts: n/a
Default Re: Recommendation for a text

On Monday, March 5, 2012 9:35:34 AM UTC-5, Stefan Ram wrote:
> John Coleman <jcoleman@franciscan.edu> writes:
> >I will be running a special topics course with the title
> >"Modern C Programming"

>
> What does »modern« suggest in this context?
>
> >pointers, malloc, and the safe handling of C-style strings

>
> This is classic, traditional C.
>
> >C99

>
> This is obsolete (canceled and replaced by ISO/IEC 9899:2011).
>
> >One idea that I had was to concentrate on the Mandelbrot Set.

>
> That was the height of fashion some decades ago. There is nothing
> wrong with that. But why then, of all things, you choose »modern«
> to title your class?


The choice of the word "modern"

1) The subtitle to King's text.
2) "Advanced" sounded too pretentious
3) I wanted to emphasize to prospective students that C is not some language that was replaced by C++ in the 80s but is rather still heavily used and is furthermore a language which has (incrementally) evolved from the language which was (more-or-less) a subset of C++. Finally, I have as one of my course goals the teaching of methods to prevent buffer overflows, which is more of a concern now than when K&R was written.
4) As I indicated in my post, I was aware that my Mandelbrot set example should either be supplemented or even replaced by other projects which have amore computer-science flavor.
Reply With Quote
  #5 (permalink)  
Old 03-05-2012, 02:36 PM
Stefan Ram
Guest
 
Posts: n/a
Default Re: Recommendation for a text

John Coleman <jcoleman@franciscan.edu> writes:
>I wanted to emphasize to prospective students that
>C is not some language that was replaced by C++


You might show them

http://www.tiobe.com/content/paperinfo/tpci/index.html

. C++ now even has been exceeded by C# in popularity.
C++ is dying.

C++ is still taught today, not because students believe it
replaced C, but because teachers and division chairs believe
it replaced C.

Another source

http://lang-index.sourceforge.net/

gives similar results. See also

http://en.wikipedia.org/wiki/Measuri...age_popularity

Reply With Quote
  #6 (permalink)  
Old 03-05-2012, 04:37 PM
Ben Bacarisse
Guest
 
Posts: n/a
Default Re: Recommendation for a text

John Coleman <jcoleman@franciscan.edu> writes:
<snip>
> Next fall I will be running a special topics course with the title
> "Modern C Programming". The motivation for the course is that
> currently our CS students are exposed to C++, Java and a smattering of
> other languages (e.g. Lisp in an elective AI course) but no C per
> se. While in principle they learn some C naturally in the course of
> learning C++ they really don't learn all that much about things like
> pointers, malloc, and the safe handling of C-style strings and they
> definitely don't learn anything about C99. The proposed class is
> intended to give a serious introduction to C to students who have a
> working knowledge of either C++ or Java. This will allow me to blow
> through the basic syntax of expressions, loops, etc. in a couple of
> weeks and to spend the bulk of the semester on aspects of C which are
> different from Java and even C++.


Be careful to point out why one would use C. Far too often, C is seen
as the "hard stuff" to get hooked on when the C++ high has worn off, but
that does a disservice to the students. C has niche uses: it's small so
there are environments where other languages won't work, and it's a sort
of lowest common denominator that can be useful for writing libraries to
link with almost any other language, but it is rarely the right choice
for a "normal" application. (These are not the only use-cases but the
point should be made that C is hard to use correctly and that must
be justified when choosing it.)

> My question is - what would a good text be? My first tentative choice
> was King's "C programming: a modern approach", but I have also been
> looking at Kochan's book "Programming in C". More recently I have been
> toying with the idea of using K&R. On the one hand that seems on the
> face of it like a poor choice for a course called *Modern* C
> programming. On the other hand - it *is* a classic and seems to hit
> the right level of difficulty (a course for students who already know
> at least one programming language). My main question is - does the
> merits of K&R outweigh the disadvantages of the lack of coverage of
> C99? I could of course supplement K&R by e.g. O'Reilly's "C Pocket
> Reference" which covers the C99 material. Where I'm at right now is
> that my heart says to go with K&R but my head says go with King (or
> Kochan). The bookstore wants a decision on my part sooner rather than
> later.


I can't help much here, but do you have to pick only one? The bookshop
might be able to stock both on a sale-or-return basis and you can then
explain the merits of each and the students can decide.

> Also - I am open to ideas about projects for the students to work
> on. One idea that I had was to concentrate on the Mandelbrot
> Set. Towards the beginning of the semester they could have a program
> which just prints to the command line e.g. with '*' for points in the
> set. Later on they could write it to a portable bit map text
> file. Even later they could write it to a .bmp file in which they have
> to get the header and the byte-alignment correct. Finally, I could
> have them rewrite it in C99 with e.g. the complex-number type and
> variable-length arrays so they don't have to hard-wire in the size of
> the bitmap. This topic of course reflects my interest as a
> mathematician. I have less ideas when it comes to straight
> computer-science applications (although Jacob Navia's idea about a
> hex-dump utility for pedagogical purposes caught my eye).


So many... Regexp matching is fun and can be posed as a simple exercise
with lots of optional extras for those who like to do more. I.e. write
Unix's grep command.

I've had fun with poker hand exercises:

$ choose-winner 2h4s5c7d8d kskh3c3d3s 4h5h6h7h8h
4h5h6h7h8h

You can make it harder by using a "hold 'em" format and/or getting into
probabilities with partial hands.

A small language interpreter can also be good fun. Two very simple ones
are SKI combinators and a cut down lambda calculus (essentially a micro
Lisp). Depending on the student's background you can sometimes get as
far as a very simple compiler for a C subset. You pretty much have to
provide an interpreter for an invented machine to which they must
compile the code, so there's quite a setup cost for you.

Image processing can also be very enjoyable. I like to pick an easy to
read and write format like PPM (at least to start with). You can then
have a whole range of exercises like contrast enhancement, rotation or
even steganography. There a very rich vein there.

One of the key determining factors will be the students. If they are
all art majors, SKI combinators will just bomb!

--
Ben.
Reply With Quote
  #7 (permalink)  
Old 03-05-2012, 04:38 PM
Keith Thompson
Guest
 
Posts: n/a
Default Re: Recommendation for a text

ram@zedat.fu-berlin.de (Stefan Ram) writes:
> John Coleman <jcoleman@franciscan.edu> writes:
>>I will be running a special topics course with the title
>>"Modern C Programming"

>
> What does »modern« suggest in this context?
>
>>pointers, malloc, and the safe handling of C-style strings

>
> This is classic, traditional C.
>
>>C99

>
> This is obsolete (canceled and replaced by ISO/IEC 9899:2011).


Officially, yes, but if you have a C11 compiler lying around I'd like to
know about it.

C99 is as modern as you can get these days -- and even that is *too*
modern if you want to compile your code with Microsoft's compiler.

--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Will write code for food.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Reply With Quote
  #8 (permalink)  
Old 03-05-2012, 04:43 PM
Keith Thompson
Guest
 
Posts: n/a
Default Re: Recommendation for a text

John Coleman <jcoleman@franciscan.edu> writes:
> I teach math and computer science (though mostly math) at a small liberal arts college. Because of our smallness we don't have a huge course offering. To compensate, we have a grab-bag "special topics course" where we cover different topics each semester based on student's and/or professor's interests.

[...]

It's helpful to add line breaks so your lines are no longer than
80 columns, preferably 72. Some Usenet clients deal with very long
lines just fine, but others don't. (Mine, for example, wraps long
lines, but not at word boundaries.

--
Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
Will write code for food.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Reply With Quote
  #9 (permalink)  
Old 03-05-2012, 04:44 PM
Stefan Ram
Guest
 
Posts: n/a
Default Re: Recommendation for a text

Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>link with almost any other language, but it is rarely the right choice
>for a "normal" application. (These are not the only use-cases but the
>point should be made that C is hard to use correctly and that must
>be justified when choosing it.)


But what do you use for a »normal application«?

I would like to say »Java«, but the Java people say that Java is
disappearing from the desktops and has moved on to web servers.

(Also, I am not sure what defines a »normal application«.
To a young student, it's an »app«? So learn Objective-C for iOS?)

Reply With Quote
  #10 (permalink)  
Old 03-05-2012, 05:15 PM
Ben Bacarisse
Guest
 
Posts: n/a
Default Re: Recommendation for a text

ram@zedat.fu-berlin.de (Stefan Ram) writes:

> Ben Bacarisse <ben.usenet@bsb.me.uk> writes:
>>link with almost any other language, but it is rarely the right choice
>>for a "normal" application. (These are not the only use-cases but the
>>point should be made that C is hard to use correctly and that must
>>be justified when choosing it.)

>
> But what do you use for a »normal application«?


That would depend on the context. A GTK Linux application? I'd use
Vala. A .NET application in Windows? C# probably. Something that must
run on all sorts of systems? C++ would be a starting point worth
considering.

> I would like to say »Java«, but the Java people say that Java is
> disappearing from the desktops and has moved on to web servers.
>
> (Also, I am not sure what defines a »normal application«.
> To a young student, it's an »app«? So learn Objective-C for iOS?)


I agree that definitions are a problem and that I could have been
clearer. Maybe this is better: too many people struggle to write some
program or other in C, simply because of a misconception that C is what
the really advanced people use.

--
Ben.
Reply With Quote
  #11 (permalink)  
Old 03-05-2012, 06:15 PM
Nomen Nescio
Guest
 
Posts: n/a
Default Re: Recommendation for a text

I've been noticing the English is reprehensible in K&R II. The first edition
wasn't great but the errors in the 2nd edition are indeed egregious and now
I find it difficult to read because of the glaring errors. Has anyone else
noticed this or did somebody butcher the copy I ripped off from the 'net
(serves me right for not paying?) I do have a paid copy of the first
edition, well worn btw. Was just too lazy to go looking for the 2nd so
ripped one off from the comfort of my easy chair.

> but it is rarely the right choice for a "normal" application.


This should be at the front of every C textbook but it's far, far too late
for that...

Reply With Quote
  #12 (permalink)  
Old 03-05-2012, 07:09 PM
Kleuske
Guest
 
Posts: n/a
Default Re: Recommendation for a text

On Mon, 05 Mar 2012 15:27:43 +0100, jacob navia saw fit to publish the
following:

> Le 05/03/12 14:21, John Coleman a écrit :
>>

> You can use my compiler system and its associated text book: "An
> introduction to C programming using lcc-win".
>
> It has several advantages:
>
> o It is free of charge (the compiler AND the introduction) o It starts
> from the ground up, but covers sophisticated topics
> like in-depth floating point analysis, memory allocation strategies
> and many others.
>
> o It is geared to lcc-win but all extensions of lcc-win are clearly
> marked as extensions.
>
> I am sure many people in this group will start complaining about it and
> propose you gcc or some variant. Just ignore them :-)
>
> You can judge yourself by downloading it from
>
> http://www.cs.virginia.edu/~lcc-win32
>
> To download the introduction only, click on the "Tutorial" button.
>
> Jacob



Shamelessly promoting your own stuff isn't exactly "advice".


--
Fascinating is a word I use for the unexpected.
-- Spock, "The Squire of Gothos", stardate 2124.5
Reply With Quote
  #13 (permalink)  
Old 03-05-2012, 07:29 PM
John Coleman
Guest
 
Posts: n/a
Default Re: Recommendation for a text

On Monday, March 5, 2012 3:09:19 PM UTC-5, Kleuske wrote:
> On Mon, 05 Mar 2012 15:27:43 +0100, jacob navia saw fit to publish the
> following:
>
> > Le 05/03/12 14:21, John Coleman a écrit :
> >>

> > You can use my compiler system and its associated text book: "An
> > introduction to C programming using lcc-win".
> >
> > It has several advantages:
> >
> > o It is free of charge (the compiler AND the introduction) o It starts
> > from the ground up, but covers sophisticated topics
> > like in-depth floating point analysis, memory allocation strategies
> > and many others.
> >
> > o It is geared to lcc-win but all extensions of lcc-win are clearly
> > marked as extensions.
> >
> > I am sure many people in this group will start complaining about it and
> > propose you gcc or some variant. Just ignore them :-)
> >
> > You can judge yourself by downloading it from
> >
> > http://www.cs.virginia.edu/~lcc-win32
> >
> > To download the introduction only, click on the "Tutorial" button.
> >
> > Jacob

>
>
> Shamelessly promoting your own stuff isn't exactly "advice".
>
>
> --
> Fascinating is a word I use for the unexpected.
> -- Spock, "The Squire of Gothos", stardate 2124.5


What is "shameless" about promoting something that you are justly proud of,
especially when it is on-topic? Also - note that I specifically mentioned Jacob
by name in my original post since I thought an idea he had discussed (last fall?) was a promising idea for teaching. That made the mention of his text
quite natural in his reply.
Reply With Quote
  #14 (permalink)  
Old 03-05-2012, 07:37 PM
John Coleman
Guest
 
Posts: n/a
Default Re: Recommendation for a text

On Monday, March 5, 2012 9:27:43 AM UTC-5, jacob navia wrote:
> Le 05/03/12 14:21, John Coleman a écrit :
> >

> You can use my compiler system and its associated text book:
> "An introduction to C programming using lcc-win".
>
> It has several advantages:
>
> o It is free of charge (the compiler AND the introduction)
> o It starts from the ground up, but covers sophisticated topics
> like in-depth floating point analysis, memory allocation strategies
> and many others.
>
> o It is geared to lcc-win but all extensions of lcc-win are clearly
> marked as extensions.
>
> I am sure many people in this group will start complaining about it
> and propose you gcc or some variant. Just ignore them :-)
>
> You can judge yourself by downloading it from
>
> http://www.cs.virginia.edu/~lcc-win32
>
> To download the introduction only, click on the "Tutorial" button.
>
> Jacob


Thanks for the offer but I tend to use Textpad + gcc (via MinGW) for my
own programming and don't want to spend time learning a different environment
between now and then. Also - the fact that lcc-win32 has an IDE is a bit ofa
drawback from my perspective since as a side-purpose of the class I think that
it is good that the students get more exposure to command-line tools.

-John
Reply With Quote
  #15 (permalink)  
Old 03-05-2012, 07:41 PM
John Coleman
Guest
 
Posts: n/a
Default Re: Recommendation for a text

Than

On Monday, March 5, 2012 12:43:30 PM UTC-5, Keith Thompson wrote:
> John Coleman <jcoleman@franciscan.edu> writes:
> > I teach math and computer science (though mostly math) at a small liberal arts college. Because of our smallness we don't have a huge course offering. To compensate, we have a grab-bag "special topics course" where we cover different topics each semester based on student's and/or professor's interests.

> [...]
>
> It's helpful to add line breaks so your lines are no longer than
> 80 columns, preferably 72. Some Usenet clients deal with very long
> lines just fine, but others don't. (Mine, for example, wraps long
> lines, but not at word boundaries.
>
> --
> Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst>
> Will write code for food.
> "We must do something. This is something. Therefore, we must do this."
> -- Antony Jay and Jonathan Lynn, "Yes Minister"


Thanks for the tip - I'll try to keep it in mind, though it might be somewhat
hard when posting via an editor that has a small window size and automatic
word wrap. Hard - but not that hard I guess.

Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 11:50 PM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.