Sunday, June 26, 2011

Bi-weekly roundup: Practical PHP Refactoring

I didn't have much time last Sunday, so here's a roundup of my articles that cover the two weeks just passed.

In the first week, I started a new Practical PHP Refactoring series, as suggested by @_odino_ as a continuation from the Practical PHP Testing Patterns one.  The level of interest is comparable between the two series, so I feel it will go on.
Practical PHP Refactoring: Extract Method is one of the basic tools of the code surgeon.
Parallelism for dummies explains how parallelism affects our programmer lives at various levels, from multi-core processors to clusters of servers.
Practical PHP Refactoring: Inline Method is the simmetrical refactoring.
Automated code reviews for PHP is an introduction to PHP quality assurance tools that you can include in your build.

In the second week, 
Practical PHP Refactoring: Inline Temp is about eliminating unnecessary abstractions.
Monitoring on Unix from scratch is an overview of the tools for logging CPU, memory and I/O utilization bundled on Linux and similar systems.
Practical PHP Refactoring: Replace Temp with Query is about keeping methods short by extracting the calculation of variables into other methods.
I don't know how to test this makes the point on the importance of learning testing skills, and gives you lots of tips from my experience on web applications.

Image courtesy of Ildar Sagdejev.

Sunday, June 12, 2011

Weekly roundup: referendum day

Today (and tomorrow) Italian get the chance to vote in a referendum on nuclear power, water privatization and whether politicians can go on trial. #IoHoVotato (I have voted) was a worldwide trending topic this morning on Twitter.
For the referendum to be valid, more than 50% of the citizens must vote. If you are Italian, you have the chance to do so up to the 15 of Monday.

To cheer you up after you return from the voting booth, here is the list of my article published this week on DZone.

Practical PHP Testing Patterns: Generated Value is the last pattern for prodiving expected and input values in tests.
On commits and commit messages is an analysis on commit ACID properties and on the lost art writing messages.
Practical PHP Testing Patterns: Dummy Object is a specialization of the Test Double pattern.
The Victorian Internet, and the Victorian social networks tells the story of an invention that predates the Internet and had a similar, and probably greater, social impact.

Sunday, June 05, 2011

Weekly roundup: a new Practical series

We're getting to the end of the Practical PHP Testing Patterns series, which followed the Practical PHP Patterns one in exploring by-the-book patterns (by the Gang of Four, Fowler and Meszaros) in their application to PHP code. It all started with the Practical PHP Testing ebook, with a simple tenet: working code sample at the end of each chapter/article.

Since these series have gained the trust of many readers, I'm thinking about a new Practical-branded series. The format has worked pretty well: one small topic treated from theory to code sample, twice a week; the level of views is constant and that tells me there is interest.
So what would you like to see after our joruney in design, enteprise application architecture and testing patterns?

Meanwhile, here are my articles published this week on DZone.
Practical PHP Testing Patterns: Literal Value is the simplest pattern for dealing with example values in tests.
The Kindle is ready for programmers is a review of the Kindle from a programmer's point of view. Some people told me that this article addresses their doubts regarding using a Kindle for technical books.
Practical PHP Testing Patterns: Derived Value describes the practice of generating input or expected values for your tests on-the-fly.
PHPSpec: BDD for your classes is a review of PHPSpec and its approach to Behavior-Driven Development in the small.

Thursday, June 02, 2011

Choosing pronounceable names

It's not a w, it's an omega. If you have a background in engineering like me, you are familiar with the Greek alphabet. Learning how to pronounce these letters while reading a book helps your studies: you don't have to wonder what this symbol is every time you encounter it, nor you have issues in explaining to other people what you mean (the angular velocity w... wait, what?).

Fortunately Greek letters aren't used in programming due to lack of ubiquitous Unicode support and difficulty of entering them with a standard keyboard. Yet when it comes the time to variable names, I find $pwd and $stdGrpType everywhere.

These names are difficult to read, understand and must be spelled out for discussion, leading to phrases such as pea double v dee and es tee dee gee ar pea type. Let's do a favor to the psychopatics who will end up maintaining our code and choose $password and $standardGroupType instead.