Prefactoring (Anglais) Broché – 9 septembre 2005
|Neuf à partir de||Occasion à partir de|
Descriptions du produit
Présentation de l'éditeur
Biographie de l'auteur
Ken Pugh has extensive experience in the area of software analysis and design, both as a doer and as a teacher. He's a well-known, frequent conference speaker.--Ce texte fait référence à une édition épuisée ou non disponible de ce titre.
Aucun appareil Kindle n'est requis. Téléchargez l'une des applis Kindle gratuites et commencez à lire les livres Kindle sur votre smartphone, tablette ou ordinateur.
Pour obtenir l'appli gratuite, saisissez votre adresse e-mail ou numéro de téléphone mobile.
Détails sur le produit
En savoir plus sur les auteursDécouvrez des livres, informez-vous sur les écrivains, lisez des blogs d'auteurs et bien plus encore.
Dans ce livre(En savoir plus)
Commentaires en ligne
Commentaires client les plus utiles sur Amazon.com (beta)
The presentation as a whole just didn't work for me, though. There were lots of little things, like a sloppy misquote of Santayana's famous "Those who cannot remember the past are condemned to repeat it," minor but annoying. The whole conversational, I-said-then-he-said style is too user-friendly for me - by the time the writer finishes piling on all the scripting flourishes, discussion tends to evaporate into fluff. Pugh could have just made his point without chopping it into pieces and mixing in fictional personalities. Much of the good in this discussion was buried under this chatty style, or lost amid the scene-setting details preparatory to the real discussion of planning for extensibility.
The technical problems were the big ones, though. In discussing error handling (p.35), he omits mention of the worst sin I know: silently converting a bad value into something you'd rather deal with. He also missed the biggest extensibility problems I've seen in any system, the ones where external data formats change over time. That happens when your 2.0 program reads a file written by the 1.0 version, and the file format has changed. It can also happen when someone creates a version 2.0 file and sends it to a user still running version 1.0. It happens in worse form when your networked application requires that 2.0 and 1.0 versions of the code talk to each other. Face it, you'll never be able to take down the whole production network and force all the servers to run the same rev of protocol. Inter-version interoperability is a must in any major application, and simply not mentioned here.
There is good in this book, but it is often hidden under poor organization, weak descriptions, and lack of technical explanation. Beginners may get a bit from this book but, on the whole, I don't recommend it.
When you've got one programming book named after another one, one reasonable idea is to compare the two. Prefactoring's premise is that, instead of fixing your design afterwards -- an extremely terse summary of Refactoring -- you apply what you've learned from that in the past to build it with the right design principles from the get-go. That sounds like good common sense, and it is. Unfortunately, it really only makes sense in the context of a misunderstanding of Refactoring. Refactoring and debugging are different things. It's very common in software for people to use buzzwords and catchphrases as an alternative to thinking, and consequently, in certain organizations, you'll hear "refactoring" used as a synonym for "debugging."
In fact, refactoring is supposed to happen during debugging -- but it's also supposed to happen during the course of development, and in fact this is the preferred time to do it. Refactoring comes from agile development, specifically Extreme Programming, where the basic cycle is to write unit tests, write the simplest code that can possibly satisfy those tests, refactor that code, and then begin again with new unit tests. Refactoring can mean improving things during debugging, but much more importantly, what it really means is streamlining existing code as you refine it. To say that the best thing to learn from refactoring is to get your code right first time is to use the vocabulary of agile development to advocate waterfall development, and this, in fact, is what Prefactoring often seems to do.
Worse still, many of the code examples are in Java, and they don't use Josh Bloch's guidelines from Effective Java or Java Puzzlers. This might be a quibble, but I'd certainly hire or fire based on this quibble, as I think it's very important (and therefore not a quibble at all). Pretty much everything I've done for months has been in Ruby on Rails, so I'm frequently reminded that Java is not popular in every sector of the tech industry -- however, if you are going to write Java, I personally feel that writing Java without observing Bloch's guidelines is careless at best, and borders on outright negligence.
On the other hand, I seem to be kind of eviscerating this book here, and that's not quite fair. I disagree with some of the design principles laid out in this book, but most of them are pretty strong in the common sense department. Also, software development is one of those things where you can be better off after reading a book even if you disagree with it. For instance, just in criticizing this book's attitude towards refactoring, I've had to question my own understanding of it. If you read this book with the right frame of mind, you'll challenge your own ideas and come to new conclusions, and probably become a better developer in the process.
So, what do I like about this book?
- The ideas are practical, common-sense ones.
- I like the revisiting of a small number of examples, developing them a little more each time as familiar problems with them are identified.
- The book sits comfortably in the world of Agile development, but is not rabid about it.
- Design diagrams are used sparingly, enough to educate and remind, but not overwhelmingly so.
Contents: Introduction To Prefactoring; The System In So Many Words; General Development Issues; Getting The Big Picture; Got Class?; A Few Words On Classes; Getting There; The First Release; Associations And States; Interfaces And Adaption; Zip Codes and Interfaces; More Reports; Invoices, Credit Cards, And Discounts; Sam Is Expanding; A Printserver Example; Antispam Example; Epilogue; Guidelines And Principles; Source Code; Index
Pugh runs an imaginary development project (Sam's CD Rental and Lawn Mower Repair) where a new system is built to allow customers to rent CDs. This is currently a manual process, but the owner wants to automate it. By using prefactoring design techniques throughout, the developers are able to build the system such that it's much easier to make changes and design modifications later on without causing major rework. Throughout the book, each step in the process is recapped in a short maxim that makes the concept easy to remember and apply to your own situation. For instance, "Do A Little Job Well And You May Be Called Upon Often - Methods and classes that perform specific jobs can be reused more often" and "Figure Out How To Migrate Before You Migrate - Considering the migration path might help you discover additional consideration in other areas of the design". Personally, it's these little gems that make the book most valuable.
I can see how some people would think this "prefactoring" is nothing more than good design techniques. That's probably a valid point. I don't know that prefactoring is some new revolutionary approach to design that will rank up there with things like agile methodologies and such. But it does allow you to wrap your mind around a general concept ("good design") and develop a framework for improving your skills in that area. For that, it's a valuable read...