Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Recommendation for a text

Reply
Thread Tools

Recommendation for a text

 
 
John Coleman
Guest
Posts: n/a
 
      03-05-2012
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
 
 
 
 
jacob navia
Guest
Posts: n/a
 
      03-05-2012
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
 
 
 
 
Stefan Ram
Guest
Posts: n/a
 
      03-05-2012
John Coleman <> 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
 
John Coleman
Guest
Posts: n/a
 
      03-05-2012
On Monday, March 5, 2012 9:35:34 AM UTC-5, Stefan Ram wrote:
> John Coleman <> 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
 
Stefan Ram
Guest
Posts: n/a
 
      03-05-2012
John Coleman <> 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
 
Ben Bacarisse
Guest
Posts: n/a
 
      03-05-2012
John Coleman <> 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
 
Keith Thompson
Guest
Posts: n/a
 
      03-05-2012
(Stefan Ram) writes:
> John Coleman <> 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- <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
 
Keith Thompson
Guest
Posts: n/a
 
      03-05-2012
John Coleman <> 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- <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
 
Stefan Ram
Guest
Posts: n/a
 
      03-05-2012
Ben Bacarisse <> 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
 
Ben Bacarisse
Guest
Posts: n/a
 
      03-05-2012
(Stefan Ram) writes:

> Ben Bacarisse <> 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
 
 
 
Reply

Thread Tools

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 On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Controlling text in a Text Area or Text leo ASP General 1 12-05-2005 01:13 AM
Looking for a WPA bridge recommendation msnews.microsoft.com Wireless Networking 0 05-28-2005 03:11 PM
Wireless router recommendation... Fritz Wireless Networking 0 09-23-2004 07:50 PM
Product recommendation please. -keevill- Wireless Networking 1 09-03-2004 04:37 AM
Re: Need NAS recommendation =?Utf-8?B?TmV0d3Jrd29tYW4=?= Wireless Networking 0 07-24-2004 05:39 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57