Tag: Book Review

Book Review: Magento Site Performance Optimization

Magento Site Performance Optimization book coverMagento Site Performance Optimization by Mathieu Nayrolles is a handy little primer on the basics of optimizing a server for magento. This little gem covers the basics, doesn’t spend a lot of time on fluff, and moves quickly into optimizing MySQL and covers the basics of using two mysql instances (through replication) one for writing and another for reading.

Chapter 1: Starting with the Right Hardware covers the basics of choosing what hardware is necessary, and how to decide who is a good host. I found the section of choosing a host to be very light because it basically suggests finding a magento recommended host and finding somebody located in the same country. It didn’t really cover much in the way of latency, dns, etc. The section on Content Delivery Networks left a lot to be desired, and really should have looked at some of the avaialble plugins.

Chapter 2: Choosing the Best Web Server is about some of the different options available out there for serving websites on linux. Makes perfect sense to cover the normal Apache and lighttpd. The Apache section discusses the standard .htaccess modifications, compiling Apache with some of the modules, and disabling what you aren’t using. Overall, the Apache section was good for a basic primer. I’m interested in using lightttpd more after reading a bit about it.

Surprisingly, Mathieu also covers Nginx which turns out to be much better for hosting magento once it’s properly tuned. This chapter was one of the most interesting and useful to me. I haven’t ever really looked at the numbers in the way he presented them or decided to try and load test configuration settings as I made each one.

Chapter 3: Tuning, Scaling, and Replicating MySQL covered exactly like the title says. This chapter discussed a bit about some of the different scripts available, but the real gem was the discussion about replication and how to configure it in magento. I didn’t realize I could setup two mysql instances and have magento read and write to different ones.

Chapter 4: Caching Them All starts off with one of the first things I try to do with caching. Turn off most of it, and see how much it changes performance. On nearly every system, I’ve worked on the performance has actually improved because writing to files and reading the files for differences is usually more expensive than just pulling the data again from the database.

Mathieu presents a reall interesting approach, that again I hadn’t really thought of which is using the RAM hold /var/cache which seems like it could be a significant improvement for the caching since most sites are using SCSI drives and not SSD like his examples.

The different caching technologies covered aren’t covered in great detail, and don’t really have that same level of details as Chapter 2 which was pretty disappointing. I had hoped we would spend some more time and energy discussing full page caching, which I find to one of the greatest optimizations to be using full page caching.

The real beauty of Chapter 4 is the section on HipHop Virtual Machine (HHVM) which is something I’ve actually never heard of before. I can’t wait to try it in the next few months and test it on on my site. HHVM is open source and produced by Facebook.

Overall, I found the book to be detailed, easy to follow and full of useful information. Also fantastic is the fact there aren’t twenty pages devoted to installing magento; the book is free of fluff and really introductory details. I also felt that it really left a lot to be desired too. Hopefully, in the next version they can spend a bit more time discussing hosts,content delivery networks and some of the code enhancements that can be done to improve speed.

Book Review: Clean Code a Handbook of Software Craftsmanship

Clean Code Book Cover

I first heard of “Uncle” Bob Martin on twitter, a few of the people I was following were discussing how amazing the book Clean Code was and how they would love if some of the other developers they worked with used some of the techniques.

“Uncle” Bob Martin wrote Clean Code: A Handbook of Agile Software Craftsmanship in 2008. The book consists of many different and related topics. Some of the topics Martin wrote about include: naming, using small functions, formatting, some threading, and of course some on testing.

Most of the book can be summarized as if you’re professional you will truly care about the quality of work you do and will not want to leave messy code for somebody else or another time to deal with.

Literally, Bob jumps into meaningful variable names, functions, and comments in the first few chapters and then talk about different techniques for reducing lines of code, reducing code rot, and what happens if tests are ignored and not properly maintained. Bob also says a lot more than simply saying using meaningful names, he says to use easily pronounceable, easily spelled, etc.

I don’t necessarily agree with all of Uncle Bob Martin’s writing: I really agree with Steve McConnell (Code Complete) that a function could be short and be 100 to 200 lines. The average function I write is probably about 20 to 30 lines of code including white space, brackets on a separate line, etc.

One of my favourite concepts is the clear writing about allowing a function or class to only do one task. For example, exceptions should be handled by either another function or a different class depending on the situation. Martin has clearly written one of the best chapters I have ever read on Error Handling even though it didn’t contain a huge amount of code.

One of the most interesting concepts is writing tests for 3rd party code so that you can understand the library’s functionality, and testing how an upgrade would affect the rest of the software. By far, I believe this book is one of the best books I have ever read and has really affected the way I write software.

Book Review: jQuery in Action

jQuery in Action, First Edition is written by Bear Bibeault and Yehuda Katz and is probably the simplest and easiest to understand programming book available. Target reader is somebody that already is using javascript in projects and is looking to push the limits of their web applications by using jQuery and many of it’s great plugins.

I found the book and its appendices to be extremely well written. I found the examples to be superbly written and extremely usable in my projects: there aren’t a lot of examples on basic things like selectors but there are a ton of great examples on much more advanced concepts. An additional feature that I found really helpful was the interactive lab exercises that begin around chapter two.

As a reference, which I don’t think was the primary intent, it would be difficult to use the book as some of the API is randomly spread throughout the book. The random spread does make the book a lot better though, because each chapter definitely builds well upon the previous chapter.

I completely recommend this book and can only imagine that the Second Edition improves upon the First Edition. I haven’t really found much negative about the book other than wishing the API wasn’t spread out so much, but the index is very good.

Book Review: Code Craft

“Code Craft” (ISBN: 1-59327-119-0) was written by Pete Goodliffe. The book is relevant to all developers: code is very language agnostic. Code Craft doesn’t just cover the design of the program, but also includes quite a bit of content on the process the program goes through “in the trenches.”

The book does include some minor annoyances such as the “Good Programmers… Bad Programmers..” part which is often a large part of each chapter’s content summary. Code Craft also suffers from a visually boring layout. Unfortunately, there are also some parts where it feels like Pete has taken a lot of work from secondary sources and just sort of glued it together.

The first time, I read Code Craft I had just started my first professional programming job. Reading Code Craft really made me ensure that I started using source control management, and really started to pay attention to the process of software design which I didn’t really grasp while in school. Immediately, these first few things were noticed at that first job and got me some kudos from the more senior programmer who reviewed a lot of my initial work.

Code Craft is a larger technical book and spends a lot of time describing the process that software should go through and other softer skills than just the technical side of things. There are sections on growing code, different architectures, and even coding itself but over all there’s something for most programmers even if the main idea already appears in other books.

Although, I think the book is excellent there isn’t exactly new concepts that can’t be found in other books such as Code Complete, Refactoring, and even a bit in Design Patterns. I don’t regret spending the $30 or so on the book, because I really do feel that I learned new things, was even entertained a little bit because Pete’s humour is light and even a little funny at times. Pete’s work has definitely helped me to create more meaningful software and to act as a mentor even when I didn’t have one.