Today on Blogcritics
Home » Books » Book Reviews » Book Review: Learn to Program by Chris Pine

Book Review: Learn to Program by Chris Pine

Please Share...Print this pageTweet about this on Twitter0Share on Facebook0Share on Google+0Pin on Pinterest0Share on TumblrShare on StumbleUpon0Share on Reddit0Email this to someone

Learn to Program by Chris Pine is a concise introduction to the world of programming using an interpreted scripting language called Ruby. An initial “cool point” goes to Pine for writing Learn to Program around Ruby, which is totally free to use, copy, modify, and distribute. The examples start from the basics of getting Ruby correctly installed and configured for your particular operating system. Although Ruby is mostly used to develop applications on Linux, it is a cross-platform language that is supported on many types of UNIX, DOS, Windows 95/98/Me/NT/2000/XP, MacOS, BeOS, and OS/2. I ran the examples on my Windows XP laptop without any problems, using a simple, free text editor called Textpad for some of the examples and the command line to round out my experience. The best part of it all: all of the programming tools were free! Gotta love it.

Pine aptly starts out with the essentials for most newbies to programming: data types, arithmetic operations, variables, and variable assignments. I found the overall approach and programming examples to be fun, detailed, and loaded with little tidbits of information, which gave great insight into the “how” and “why” of things. Pine’s examples and explanations throughout Learn to Program were great at illustrating the power of Ruby and programming in general, without having the overtly silly and annoying tone typically found in the Dummies series of books.

Learn to Program progressively and painlessly takes the reader through increasingly complex (for most newbies) programming concepts such as methods, classes, objects, recursion, and flow control. To reinforce the concepts in each chapter there are sections called “A Few Things to Try”, which were both interesting and amusing. One of the more interesting topics involved writing simple programs to read, write, save, and load files using YAML. (YAML is a format for representing objects as strings).

It’s always fun to learn how to dig around in various files to extract and manipulate information. This should also come in handy when managing log files on several OpenVMS servers I manage. Yes, there is a tested version of Ruby (version X1.8-1X014) for OpenVMS Alpha V7.3-1 and V7.3-2! The final chapter of Learn to Program tied all of the concepts together and introduced the use of blocks and procs as a step beyond using custom methods. The proc examples were an eloquent introduction into the more conceptually challenging topic of passing objects into methods and returning objects from methods. I remember learning the power of passing objects to and from methods in a college Java course (years ago), only after we were taken through the paces of writing programs the “dumb” way without knowing how to do this. I wish I had read this book before I took that class.

Learn to Program is an excellent book for anyone who has an interest in learning to program. It is written for true beginners, who have little or no programming experience. Surprisingly enough, Pine magically manages to go from “What is an integer?” to full-blown object-oriented programming in less than 200 pages. Another bonus is that you will be learning Ruby, one of the newer, (in my opinion) sexier programming languages currently in circulation (i.e. COBOL=not sexy, Ruby=sexy). Decide for yourself:

“Hello World” Program Examples:

COBOL
————————————————-

000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. HELLOWORLD.
000300
000400*
000500 ENVIRONMENT DIVISION.
000600 CONFIGURATION SECTION.
000700 SOURCE-COMPUTER. RM-COBOL.
000800 OBJECT-COMPUTER. RM-COBOL.
000900

001000 DATA DIVISION.
001100 FILE SECTION.
001200
100000 PROCEDURE DIVISION.
100100
100200 MAIN-LOGIC SECTION.
100300 BEGIN.
100400 DISPLAY ” ” LINE 1 POSITION 1 ERASE EOS.
100500 DISPLAY “Hello world!” LINE 15 POSITION 10.
100600 STOP RUN.
100700 MAIN-LOGIC-EXIT.
100800 EXIT.

Ruby
————————————————-
puts ‘Hello World!’

Learn to Program is thoroughly engaging and informative and manages to painlessly convey some pretty sophisticated programming concepts that can benefit both novice and more experienced programmers. If you want to learn to program or want a great introduction to Ruby, Learn to Program belongs on your bookshelf.

The Matt Largo's Cerebral Vortex
Edited: [GH]

Powered by

About Matt Largo

  • http://desicritics.org Aaman

    Your comparison of COBOL and Ruby is flawed. Try executing 20000 transactions a minute on an AS/400 with full transactional support using Ruby.

  • http://www.mattlargo.com Matt Largo

    Hello Aaman,

    My comparison of COBOL to Ruby is not flawed. I’m not comparing speed. I have run speed trials of COBOL against other languages and realize that COBOL kicks other languages’ asses hands down 99.999% of the time. I am comparing COBOL and Ruby on the basis of lines of code to accomplish the same result. 20+ lines of COBOL versus 1 line of Ruby. Purely aesthetic. I realize that COBOL is still very vital in the IT world. Interestingly enough I live in a state that probably houses and runs the greatest number of lines of COBOL code in the U.S. I also realize that programming languages are like tools in your tool box. I would no more use Ruby for every programming need, than I would use a screwdriver for all of my remodeling needs.

    FYI…I thought that I should correct a comment you made pertaining to a earlier comment of mine that caught my attention, but I didn’t want to correct you at the time.

    Believe it or not, you can count to two in binary. You will not see a decimal number ‘2’ in the binary system, but computers have been counting to two (10) and beyond for years. Your comment about not being able to count to two, is like saying that we cannot count to ’10’ in decimal.

  • Bliffle

    Sounds like another poor language that will produce awkward unreliable programs in the hands of poor programmers recruited from other fields.

    Why another superficial language? We already have enough. We’re cursed with “C” (intrinsically flawed because of the authors ignorance of PLI Based Variables and the Fortran Pass-By-Reference problem which is easily solved with memory protection), which even in this day, with all the years of development, still has defective compiler implementations with inconsistent semantics for syntax constructs. There are plenty of other myopic languages that solve only the one problem that the naieve inventor is obsessed with and leaves undone the advances of 50 years of development since John Backus created the first Fortran on the IBM 650. It’s easy to make any language look good compared to COBOL, but how does it stack up against REXX, which is an excellent scripting language?

    We don’t need more bad programmers unleashing bad sprawling programs on the world. Usually these messes get thrust upon some poor programmer to ‘finish’ with claims that it is 99% finished and just needs a tiny bit of work. In other words, we’re not going to pay you much and we expect it to be done tomorrow.

  • http://www.mattlargo.com Matt Largo

    Biffle,

    I don’t know much about REXX, but you make a good point. I can see where a lot of the new languages potentially fall in the hands of bad programmers only to gift everyone with substandard programs plagued with problems. I think that the main purpose of the book was to teach programming concepts with an open source language. I think the book serves this purpose well.

%d bloggers like this: