juil. 02

 Beautiful Code

Leading Programmers Explain How They Think

By Andy Oram and Greg Wilson


Find it on Amazon

Summary of the editor

This unique and insightful book is a collection of master classes in software design.
In each chapter, today's leading programmers walk through elegant solutions to hard problems, and explain what make those solutions so appealing.

This is not simply another design patterns book, or another software engineering treatise on the right and wrong ways to do things. Instead, it gives you the chance to look over the shoulder of some superb software designers and see the world through their eyes.

Thirty-eight master coders think aloud as they work through a project's architecture, the tradeoffs made in its construction, and those moments when it was important to break rules.

My criticsm and comments

This book is an interesting reading to do, but to me, a bit inegal. Some chapters are very good and interesting and let's say I was less sensitive to other ones. What i will do here, is just giving a word about some chapters I found among the ones of best added values.

Chapter 2 : "Subversion's delta-editor interface as ontology" by Karl Fogel

This chapter will show a concrete example of how a classical problem can be solve : tree comparison. It uses as example one core API of Subversion, written in 2000 and still unchanged until now. The main interesting part is showing how you can do the choice of implementing a restrictive API to force users to use it in a given manner. As a consequence, all the future code becomes very predictible and the current porgram is much more robust.

Chapter 7 : "Beautiful tests" by Alberto Savoia

I'm working in TDD for years now and this chapter just bring some testing approach to you. It starts with a very simple code example : the dichotomic search. This algorithm seem to be very simple but 12 years have been necessary to provide the first implementation proven to be bug-free, even with dealing with very large arrays.

What I like in this chapter ? The explanation of the testing strategy : which test you can write and until which point you go to be almost sure your code is bug-free.

Chapter 8 : "On-the-fly code generation for image processing" by Charles Petzold

Charles Petzold is delivering here a very interesting chapter, showing two meanings of the word "beautiful". It starts with a simple - and elegant - code to apply raster operation on images. It works good but is not so performant. As a consequence, he shows us how can generate IL code that will do the image transformation, and above all will be fast. His strategy ? Just generate minimalistic code, that won't have any loop or predicate, limiting the numboer of access to array element, ...

Chapter 14 : "How elegant code evolves with hardwares : The case of Gaussian elimination" by Jack Dongarra and Piotr Luszczek

They present here the evolution of one of the core method of the system LINPACK, LAPACK and ScaLAPACK. What is very interesting is how they made evolve the code to adapt it to the successive computer architecture.

Chapter 17 : "Another level of indirection" by Diomidis Spinellis

A nice explanation of the implementation of the core of FreeBSD dedicated to the IO operation: how an additionnal level of indirection can elegantly support the different type of file system : FAT-32, ISO-9660, NTFS, ... and can even simply support their specificities like security checks. 

Chapter 23 : "Distributed programming with MapReduce" by Jeff Dean and Sanjay Ghemawat

MapReduce is used internally at Google to execute processing of a huge number of data on a huge number of computers. They describe here how we can take advantage of this framework / API to let our programs being executed on a large scale of clusters, and then re-collecting the data into the main application. One of the introduction sentence is clear enough :

"Suppose that you have 20 billion documents, and you want to generate a count of how often each unique word occurs in the documents. With an average document size of 20 KB, just reading through the 400 terabytes of data on one machine will take roughly four months."

Chapter 31 : "Emacspeak : the complete audio desktop" by T. V. Raman

He explains here how he took the Emacs system to provide him with an audio system. What was the most interesting ? The way he does. Indeed he didn't modified the original code but worked in AOP (Aspect oriented Programmation) using the advice functionality of Lisp to provide Emacs with new aspects : the ability to speak.

Conclusion

This book shows interesting code in various languages. Maybe some chapters will be harder to read because you are so unfamiliar with Haskell or Lisp. But anyway, go for them ! They will show interesting thoughts and may point out some functionality of the used language that will let you think "How I would do that in .NET ?". No doubt that this book will inspire you and give you many new ideas !

Go for it !

Want to find more about the books I have read ? Go to my bookshelf to find the few criticism I have already made !

Tags:

Commentaires

Ajouter un commentaire




biuquote
  • Commentaire
  • Aperçu immédiat
Loading