Posts Tagged ‘book’

Coders at Work

Friday, November 6th, 2009

There’s been a lot of talk about Peter Seibel’s new book, Coders at Work, recently, so I decided to
read it as well. I’m definitely glad I did; It’s a very readable book, with some very good programmers and designers’ views on debugging, programing, and other technical topics. Among those interviewed are jwz, Peter Norvig, and of course Donald Knuth, among others. This book seems inspired by another one I’m reading, Masterminds of Programming, but I enjoyed this one a lot more.

The book consists of 17 interviews with different programmers in a wide variety of domains. There’s a lot to absorb, and it’s pretty instructive to see how many of these coders don’t rely on modern tools such as debuggers or IDEs. While the interviews are pretty organic and aren’t exactly alike, Siebel does ask all of them some of the same questions, and it’s nice to see that different approaches can work equally well. Each programmers approach to API design is another one of the big ones he tends to ask, which is what I’d consider one of the most important parts of being a programmer.

I’d definitely recommend reading this book - there is a lot of useful information to absorb from it. It’s hard to pinpoint specific lessons, but it should at least make you think about your methods and techniques. It’s a very readable book, enjoyable to read and easy to understand. I’m with Joel on this - you should definitely read this book.



Programming Clojure

Saturday, October 31st, 2009

I read Programming Clojure a few months ago; I meant to write a review of it then, but I was busy and then forgot. Better late than never, though, so I’m going to do it now. Clojure, as you may know, is a Lisp dialect that runs on the JVM. It is a very modern Lisp - Clojure 1.0 celebrated it’s first anniversary recently. It can integrate with Java libraries, nullifying the complaints that Lisp doesn’t have enough libraries, and has very good concurrency support.

Programming Clojure was a very good book for helping to get started with Clojure. I had already done a few small projects with it, but hadn’t used it in any substantial way. This book covered all of the features of Clojure, including all of the neat concurrency stuff that I probably wouldn’t have run into on my own for a while. This book provides a good overview of all the features of Clojure, as well as simple examples of how to use them. I still refer to it when writing Clojure code.

In addition to talking about the language features in isolation, there is an overarching project throughout the book that is used to show the features in a real application. This is pretty interesting, even though you’d probably never have to write a build system in real life. This project starts simpler, and then gradually uses more of the concepts you learn in each chapter, making it a great way to follow along and ensure you actually understood what you read in the book. It’s fairly short; I recommend everyone who reads the book should make sure they understand the project.

I’d highly recommend this book if you are interested in learning or getting better at Clojure. It will help you understand how to use Clojure to create real projects. It explains how to use clojure, some of the issues you may initially have with them (printing in lazy sequences, for example), and how to overcome them.



Learning GNU Emacs

Friday, August 21st, 2009

I recently read a copy of O’Reilly’s Learning GNU Emacs. While fairly out-of-date(I read the 2nd edition, making it worse), it was still a valuable book for emacs beginners. Pretty much all of the items in the book are still around; the book may miss newer stuff than came in versions 20, but it covers the basics quite well. I didn’t learn a huge amount of useful things from it, since most of it I either already knew or didn’t care about, but it did tell me about some things I hadn’t known and was a great refresher. I think it would be great if you were just learning how to use emacs and wanted to get more proficient at it.

The book covers a wide range of topics, starting with basic editing tasks. It covers moving around the buffer, buffer and window management, and searching. These tasks are what Emacs novices need to know to start using Emacs, and the book does a very good job of introducing them. Even I learned about a few things, such as the various different kinds of searches and recursive edits. The book then quickly gets into more topics: file and directory management, as well as using a shell inside Emacs. Since I use Emacs almost exclusively for shell use, it’s nice to know other people thought this was rather important as well.

The next few chapters focused on a few things I don’t use Emacs for - email and browsing the Internet. It covers several different email setups, as well as GNUs. I, however, prefer gmail conversation threading to anything else I’ve used, so I’m going to stick with that. The section on browsing the Web and working remotely was out of date, mentioning ange-ftp and W3 instead of the newer Tramp and W3m. While Tramp is very useful, I actually haven’t liked web browsing with emadcs due to how slow it is. Until Emacs gets a faster browser, I’m going to have to stick with Firefox.

The section with more advanced text editing techniques unfortunately doesn’t cover some of the newer additions to Emacs, obviously. For example, the section on rectangle-editing does not cover the not-yet-developed(or at least included) cua-mode, which has the best rectangle implementation so far. There is also a chapter about various markup language modes, such as troff and noff. While these are probably not used much today(I hadn’t even heard of them before), the chapter also covers latex and html editing, which are still widely used. If you need to edit these types of documents, you should probably read the sections on them; otherwise, they aren’t going to contain any information you need.

The next few chapters got into the real meat of Emacs. Keyboard macros were covered extensively, including some tricks I didn’t know about. Since macros are essential to efficient use of Emacs, I’m very happy that they were covered so thoroughly. Customizing emacs is also covered, and some common customization options are discussed. For more advanced customizations, there is also a chapter on elisp that covers developing your own modes. The elisp chapter also covers elisp as a language, and while not complete is a good introduction to developing in elisp.

The next section covered programming modes, such as cc-mode and fortran. While Fortran isn’t used too much anymore, c and c++ definitely are, and the tutorial for cc-mode is pretty good. The chapter not only covers the modes, but how to integrate compiling into emacs, which is often quite useful. There is also a chapter on using Emacs in X, which is usually set up for you in modern emacs distributions

The chapter on version control showed the book’s age a bit, but was still very useful. I don’t use version control from emacs as much as I should, usually just opening up a shell buffer and executing commands from that, so this chapter was quite useful in explaining how to execute these commands using keyboard shortcuts. The three VC systems that emacs was said to support were SCCS, RCS, and CVS - not exactly in widespread use today. However, the commands that the book mentioned still work with the newer VCS’s that emacs comes with nowadays, so this section is still relevant with newer VCS’s like SVN and Git, the two I mainly use.

The book ends with a chapter on emac’s help commands, like describe-variable, describe-key, and apropos. I already knew about these options, but for a new user this section would be great - It gives them all the resources they need in order to get help on any new modes or problems they encounter. I’m not sure it should be at the end, as it is one of Emacs’ most important features, but at least it’s in the book.

All in all, this is a good book that is unfortunately rather dated. I wish it was updated to cover newer versions of emacs; as it is, it’s probably mostly useful only for newer users of emacs who need a introduction to the basic features that are in every release.

Book Review: The Seasoned Schemer

Monday, July 27th, 2009

The Seasoned Schemer and it’s predecessor The Little Schemer, by Daniel Friedman and Matthias Fellstein, are two of the best books for learning Scheme and functional programming out there. These books are not like any other technical books you have ever read; the format is downright weird. The book is more of a conversation between an instructor and student about a set of problems than anything else, with the instructor on the left half of the page and student on the right. This is the same format that the rest of the books in this series have, such as The Little Schemer, The Reasoned Schemer, and A Little Java, A Few Patterns.

Like The Little Schemer, The Seasoned Schemer starts out easy and quickly advances the difficulty. You are expected to remember the things from The Little Schemer, so you should probably read that book first, even if you have some Scheme experience. The book starts of with introducing new variables with let and letrec, and went on the explain closures, modify state (with set!), and call-cc. The last chapter involves writing a Scheme interpreter without using data structures, just functions. +1

While the answers to all the questions asked in the book are right there, you do want to take your time and solve them yourself. Some of the things covered in this book are quite complicated and hard to understand if you only read the solutions and not find them yourself, like the derivation of the applicative-order imperative Y combinator. The book isn’t too long, so it should only take you a week or so to finish it anyway, and working through the exercises really helps your understanding. This series is actually one of my favourites for learning scheme; I would highly recommend reading it, even if you aren’t going to be doing much Scheme programming, just to expand your horizons.

Book Review: Beautiful Code

Thursday, July 23rd, 2009




I just finished reading Beautiful Code, from O’Reilly. It isn’t like most technical books; like the others in the ‘Beautiful’ series, it’s more a collection of essays on a topic than a book. This is probably a better format than a book for these types of issues - there isn’t really one way for code to be beautiful, and so O’Reilly figured that the best way to transmit what beautiful code is was to get a wide range of opinions.

Beautiful Code has 33 essays by different - and very talented - software developers. Some of the more famous ones are Brian Kernighan, Matz, andd Greg Kroah-Hartman. Whether you read the essays in order or sporadically doesn’t matter - There is no dependence on previous chapters in any of the essays. Essays are on average less than 20 pages long, making them easily readable in short sittings. The overarching topic is code, not architecture, although some of that makes it in the book as well, so almost every chapter has code fragments that are being discussed.

Not all of the essays are going to be interesting to every person, although I still read all of them. For example, I didn’t particularly enjoy the essays on code written in bioinformatics packages. I do suspect that every person will like a different subset of the essays, and enough of them are incredibly good to make the book well worth reading.

My favourite essays in the book would have to be Brain Kernighan’s ‘A Regular Expression Matcher’, Andrew Kuchling’s chapter on Python’s dictionary implementation, and Andreas Zeller’s essay on delta debugging. These were very informative and gave very good examples of what beautiful code is, as well as in the last case a very cool idea for automated debugging. There were no more than five essays I was really not interested in, leading to a very interesting read.

All in all, Beautiful Code is well worth reading. It has contributions from the C, Lisp, Emacs, Haskell, Perl, and Python communities, as well as others. It gives a wide range of things to consider when making code beautiful, and many of the chapters explain very interesting concepts, such as implementing scheme’s hygienic macros, instead of small code samples that aren’t used anywhere outside the book. I’m glad I read it.



The Craft of Text Editing

Sunday, April 26th, 2009

I spent the last few days reading The Craft of Text Editing, a book on the design of text editors. It focuses mainly on editors based on Emacs, but many of the principles apply to all other text editors as While old, many of the topics it covers would appear to still be relevant to anyone designing an editor today, which is admittedly roughly nobody.

The book starts off talking about the different types of users, and the different types of input. The section on input types is quite dated - having more than one button on a mouse is bad design? and not really relevant today. It then covers the requirements you need for the language you are programming the editor in - not surprisingly for a book focusing on emacs-type editors, the recommended choices are C and Lisp.

Once it finishes those sections, the book gets to the interesting part: how to actually represent the text and structure your editor. The first part in this section talks about the possible editing models: Text as an array of characters, a 2D array of characters, a list of lines, and a few other options.

Next, several different file formats that you may need to handle are discussed. While not all of them will be applicable to every editor, ones that aspire to be as general as possible must handle them. This section also discusses how extra information not represented in the text of the file may be represented and stored - for example, typesetting information.

The implementation of the actual editor is then discussed. The main ways of representing buffers is talked about - essentially, the two most common ways are a linked list of characters and a ‘buffer gap’ system, which is what emacs uses. The efficiency of each of these implementations is discussed in several categories, including crash recovery. In general, the buffer gap system is found to be better than the other systems.

Redisplay algorithms are covered next - how to display the changes a user makes with as little interruption to the user as possible. This section doesn’t seem as important as it did back when this book was written - we have faster connections and processors, leading to it mattering a lot less whether five commands are issued per redisplay or four. Still quite interesting, though.

The next section deals with user commands. It discusses multilevel commands (such as C-x C-c), arguments, key rebinding, and modes. While the focus is on Emacs, all text editors share this command loop: for example, vim has suffix arguments corresponding to the range to delete when you press ‘d’. How to deal with Undo and Redo are then described, and various methods of implementing them and whether they are even necessary.

The next chapter deals with the design of the command set, or what exactly you are able to do with the editor. It talks about what you should strive for in a command set; responsiveness, consistency, permissiveness, progress, simplicity, uniformity, and extensibility. It discusses a few special types of editing certain types of syntax and how to enhance support for these. For some commands that have multiple interpretations, like forward-word, each implementation is discussed.

All in all, this was a very interesting book, well worth reading. Since most people spend a large portion of their time inside of their text editor, I believe it is important to understand the basics of how it works. While it probably won’t help in everyday use, having an idea of what is happening behind the scenes of your editor is important if anything goes wrong with it.