Re: OT: Programming in C

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Apr 7, 2008 at 12:48 PM, Les <hlhowell@xxxxxxxxxxx> wrote:
>
> On Mon, 2008-04-07 at 12:25 -0400, max bianco wrote:
>  > I want to learn C and I know there are quite a few programmers on this
>  > list.  I am looking for a couple of good books on learning C. I am not
>  > exactly a beginner but I am no expert and i would like to start going
>  > over everything from scratch.  So if I could get some referrals to a
>  > couple of books I would greatly appreciate it. I am looking for a good
>  > thorough beginners guide to C and also something for the intermediate
>  > programmer as I expect to get through the former in fairly short
>  > order. I ultimately will be directing my efforts at kernel hacking. As
>  > always , any advice and or opinion is gratefully received.
>  >
>  > Max
>  >
>  Hi, Max,
>         There are several good books out there for C.  The base language
>  reference is
>  The C Programming Language by Kernigan and Ritchie.  C is a very compact
>  language, and this book shows the real underlying structure.  However
>  most C programming is done by calling Library routines.  A book that a
>  lot of colleges use is Teach Yourself C or Teach Yourself C++.
>

I have seen some of these, most notably the Teach Yourself C in 24
hours, I am avoiding this one as I think it highly unlikely that C can
be taught in so short a time . I tend to leery of any book that claims
to teach anything in so short a time frame but perhaps they are aiming
at the advanced programmer with that one.

>         The thing to remember is that C is a functional language, where you
>  have to design the data structures, and C++ is object oriented, so while
>  the underlying code operations are the same, the manner in which they
>  are accessed is different.  Most programs today are written in C++
>  because the object orientation removes some of the arduous tasks from
>  programming, that is managing data structures separately from code, and
>  keeping the code coherent with the data structure.  With objects the
>  data structure is the object, and the code is assigned to the object, so
>  for example if the object is car, then the function call for turning the
>  car might be car.turn(left) in object code.
>  In functional code there would be a structure for the car with various
>  attributes, one of which might be direction.  So to get the car to turn,
>  the operation might look like car.direction+=LEFT  Where direction would
>  be a property of the car structure, and LEFT would be some angle which
>  would be added to the current value of direction.  Note that in the
>  object portion, you would also have to define left and what the
>  direction might look like, and the function turn would adjust the
>  direction by the value of left.  They both do the same operation,
>  however the object version is less direct in coding, and more obtuse
>  because you may not be able to even see the function or the direction
>  value if they were controlled by the program as private data.  This is a
>  bit off what you asked, but is important that you get the correct
>  information.  C is one language and C++ is a different language because
>  of this structural difference.
>

A good point to note as I am more familiar with C++ but it has been
sometime since I have done anything with it. Hopefully this previous
knowledge will help more than it hurts.


>         Along with the correct book, there are some books referred to as
>  primers.  One of my favorites is the C Primer +.
>
>         Reading code will help you to see what constitutes good practice vs bad
>  practice.  Essentially if you can follow the code, and it is well
>  commented and follows the comments well, that is good coding.  You will
>  see lots of other varieties from OK to horrible as you read pages.
>  Worst in my book are tutorials with a page of code with no comments
>  other than the text.  Even the most trivial algorithm should always have
>  a comment telling what its input is, what its output should be and
>  preferably illustrating how that result is obtained.  But many authors
>  don't bother, and we tend to follow what we learn, so there are reams
>  and reams of programs out there with few or no comments at all.  May you
>  never have to debug one of them.

I have heard this complaint quite often. That's part of the reason,
along with the fact that what few skills i possess as a programmer are
extremely rusty, that I am taking a "from scratch approach" to C. As
someone who has suffered because the provided documentation was so
poor I hope to spare anyone the same pain and suffering I have had to
endure when researching some vaguely documented feature or method.
>
>  Others here will suggest other books.  Check them all out on line or at
>  libraries to see what you think will help you.  Pick one and read it
>  through first before trying to code.  It is dry reading, but once you go
>  all the way through it, it will make more sense why the exercises lead
>  you to new understanding.
>

Its the subjects that many consider dry that I usually find
fascinating. It isn't dry if your interested in the subject matter but
I see what you are getting at, these books often take time to read as
you have to be paying attention to all the details. I've enjoyed
reading C.G. Jung collected works, Tao of Physics, and the like so
"dry" subject matter is no obstacle, though I tend to read fewer of
these kinds of books in general because they require so much attention
to detail.

Thanks,

Max


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux