Slashdot Mirror


Linux Programming by Example

Simon P. Chappell writes "Linux programming is the C Programming Language. Elaborating a little, Linux programming is C, with the GLIBC library and the POSIX standard API. Even a language as powerful as C needs libraries and to get the Holy Grail of cross-platform portability, it's necessary to have them standardised. The POSIX API is that standardisation and Linux adheres to it very well (opinions from those litigious folks in Utah aside). For those of us who already know C, Linux Programming by Example sets out to teach you the rest in a step by step, helpful, relaxed and incremental manner." Linux Programming by Example author Arnold Robbins pages 687 (21 page index) publisher Prentice Hall rating 10 reviewer Simon P. Chappell ISBN 0131429647 summary An exellent tutorial for real-world Linux software development

What's To Like There are many things to like about this book (over and above the fact that page 118 has my all-time favourite UserFriendly cartoon on it :-). Linux Programming by Example (LinuxPbE hereafter) takes a steady, incremental path through the concepts required to write software that can effectively interact with the Linux environment.

It is a truism many of us have proven multiple times in our lives that one of the finest learning tools available to programmers is to read and grok good, working code, written in the language that we are learning. LinuxPbE takes this philosophy and walks you through actual example code from various Unixes and Linux. The first part of the book, specifically chapters one through six, covers all of the aspects of Linux programming necessary to understand the Unix V7 ls program in its full glory in chapter seven. I feel that this approach works very well.

Part two dives into processes, walking us through creating them, managing them, communicating with them by using pipes and sending them signals. A few other general topics are included for completeness. Part three then covers the art and tools of debugging in fairly substantial detail.

All the code in the book is very well laid out, with line numbers provided to the left, and comments (in a small sans-serif font) on the right-hand side of the code. This is a very readable combination that is enhanced further by the fact that at each logical division, an explanation is given of the design and implementation used by that section.

I can't resist admiring the addition of the essay "Teach Yourself Programming in Ten Years" by Peter Norvig. This is a classic exploration of the effort needed to attain mastery of any skill, concluding that the minimum length of time required is ten years. The inclusion of this article, to me, speaks well of the author and his understanding of the learning process. One can only hope that those learning from this book will come to the same understanding and realise that the book is the start of their journey to mastering Linux programming.

What's To Consider

Nothing notable.

Summary If you want to learn how to do this stuff for real, then this book will get you started. As "Teach Yourself Programming in Ten Years" explains, no book is going to cause you to become an expert in 24 hours, 24 days or even, perhaps, 24 months. That said, this book will be useful for many of those ten years, so run or surf to your favourite bookstore and purchase it now.

You can purchase Linux Programming by Example from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

15 of 119 comments (clear)

  1. I do most of my coding by example by Anonymous Coward · · Score: 3, Funny

    Cutting and pasting makes things really easy.

    1. Re:I do most of my coding by example by Anonymous Coward · · Score: 5, Funny

      That's what Linus taught me when we met. He had that huge CD library from SCO Developer Network and he showed me how easy it was to copy-paste.

  2. Finally. by KimiDalamori · · Score: 5, Funny

    Now all we need is a "Linux Documentation Writing by Example" Then we could tell people WTFM instead of RTFM. =)

    --
    Lagito ergo expectabo
    1. Re:Finally. by Anonymous Coward · · Score: 0, Funny

      what good is excellent documentation for a deceased OS?

  3. Re:Linux routines by boisepunk · · Score: 1, Funny

    no, it's like this:

    #!/usr/bin/python
    while DarlsWallet:
    DarlsWallet -= 699
    Lawyer += 699
    raise SystemExit, "we're out of money!"

    --
    main(0)
  4. What Linux needs is VB by Anonymous Coward · · Score: 0, Funny

    Hi, I'm a VB programmer, and the problem I'd have with writing software for Linux is that there's no version of Microsoft Visual Studio for Linux.

    If Linus Torvaldes had written Linux in VB I think that there would be more commercial applications for Linux today. We don't need more books on C/C++; we need more tools to get modern languages like VB to work on Linux.

    1. Re:What Linux needs is VB by slash-tard · · Score: 4, Funny

      I agree. I tried to import the 2.6 kernel into a VB project and couldnt get it to compile despites hours of trying to tweak the code.

      I did manage to get it to compile with C# but I got some weird errors when running it with the .NET runtime.

  5. Litigious folks? by Fjord · · Score: 3, Funny

    I thought the appropriate google bomb was litigious bastards.

    --
    -no broken link
  6. IP violation by Anonymous Coward · · Score: 4, Funny

    This is Darth McBide here - I don't often make it a habit of stopping by Slashdot and I have promised myself to take a shower wafter posting this message.

    To the point, I would like to bring it to your attention that any "Linux Programming by Example" would unavoidably be a violation of our broad reaching IP. For reasons that are quite beyond anyone here we cannot tell you the exact contents of our IP so how the heck are you going to know when your examples are going to tread on our property? So please take my advice and refrain from publishing anything that could trigger another lawsuit...

  7. The Power of C? by Animats · · Score: 2, Funny
    even a language as powerful as C.

    Can we mod the original article as +1, Funny?

    1. Re:The Power of C? by prockcore · · Score: 2, Funny


      double the_power_of_C = pow(x,299792458);

  8. Re:automake, autoconf, .src.rpm, ... by TomorrowPlusX · · Score: 3, Funny

    Notice however, that in the grand style of old: it even includes a mail reader.

    --

    lorem ipsum, dolor sit amet
  9. example code by gandalf013 · · Score: 2, Funny
    I haven't seen the book, but I checked some examples from the book.

    I can see the following "problems" with some of them (if I am wrong, someone please correct me):

    ch02-printenv.c:

    #include <stdio.h>

    extern char **environ;

    Shouldn't there be a #include <unistd.h> after the #include <stdio.h>? The extern variable environ is available only if unistd.h has been included. While I am talking about this example, it could have used int main(void) instead of ...(int argc, char **argv) (like he does in ch03-getline.c).

    ch03-getline.c:

    printf("(%lu) %s", size, line);

    size is declared size_t, so it should be printed with %z (C99 only, IIRC), or it sould be cast (unsigned long) size.

    ch03-memaddr.c:

    uses global variables, when simply adding two parameters to afunc will do the job. I know it's a trivial example, but global variables are bad in general, and certainly avoidable in this case.

    casts the result of alloca when there is no need for it. In fact, the cast will remove the warning the compiler might give if someone forgot to #include <alloca.h>.

    I haven't checked other examples.

  10. Re:Wow. by Anonymous Coward · · Score: 1, Funny

    The way people act on Slashdot, you'd think that they all think VB programmers are worthless pieces of junk.

  11. Umm, whats with that user friendly comic. by Ziviyr · · Score: 2, Funny

    DOS-heads gloating to each other in front of an Amiga calendar.

    I find that so incredibly weird, my head might implode...

    --

    Someone set us up the bomb, so shine we are!