Sunday, January 29, 2012

Biweekly roundup: PHP goes mobile

This week I will be at PHP Goes Mobile, a single day event in Milan centered on mobile platforms and a BarCamp in the afternoon where everyone can propose a topic. In the morning there will be some interesting talks by Francesco Fullone, Enrico Zimuel and others. I'm thinking about proposing a BarCamp short talk on PHPUnit_Selenium.

Here are the original articles published this week on DZone.
Practical PHP Refactoring: Extract Superclass explains how to create a two-level hierarchy by extracting a superclass where to move duplicated code.
Python Hello World, for a web application is my first step into the Python world: how to respond to GET and POST requests from a Python script with Apache and mod_python.
Practical PHP Refactoring: Extract Interface is one of the most underrated techniques in the PHP world.
PHPUnit_Selenium is an howto explaining everything you can currently do with the Selenium 1/2 support in PHPUnit.
Practical PHP Refactoring: Collapse Hierarchy is about simplifying a design by collapsing classes in a hierarchy that are not really different.
Ajax requests to other domains with Cross-Origin Resource Sharing is one of the possibilities for using the XMLHttpRequest object to connect to external websites.
Practical PHP Refactoring: Form Template Method is about eliminating non-obvious duplication with the Template Method pattern.
Unit testing when Value Objects get in the way explains the usage of the Derived Value pattern to simplify a bit tests that involve Value Objects as a fixture, or as collaborators.

Sunday, January 15, 2012

Weekly roundup: the coming war

Now, it may seem like SOPA is the end game in a long fight over copyright, and the Internet, and it may seem like if we defeat SOPA, we'll be well on our way to securing the freedom of PCs and networks. But as I said at the beginning of this talk, this isn't about copyright, because the copyright wars are just the 0.9 beta version of the long coming war on computation. -- Cory Doctorow
I advise you to read the full transcript of Cory Doctorow's talk (or watch the videoThe Coming War on General Purpose Computation to get a feel of where the closed&special purpose devices trend may head (or is already heading) in the future. Sacrificing Turing-completeness is something no engineer can dream for.

Here are my articles published this week on DZone.
Practical PHP Refactoring: Push Down Field explains how to move a field down into a class hierarchy to simplify the involved superclasses.
Object-oriented Clojure is a tutorial on how to use Java objects from Clojure and how to define new interfaces and classes (actually protocols and records).
Practical PHP Refactoring: Extract Subclass explains how to extract a new subclass, something we assumed already existed in the previous articles of the series.
Open/Closed Principle on real world code is an implementation of the Command pattern in PHPUnit_Selenium, displaying production code instead of the usual self-contained examples.

Sunday, January 08, 2012

Weekly roundup: Wirfs-Brock's book

I have started reading Rebecca Wirfs-Brock's 2003 book, cited by XPers as one of the books that teach the lost art of object-oriented design. So far I have filled one page of notes while reading the first chapter, and reached the first code sample on Double Dispatch; it's a very dense book.
It's too soon to tell if this book's content is obvious or mind-blowing - but it can succeed in instilling a design mindset different from the modern OOP one; for example, based on roles and responsibilities instead of "records with functions attached to their heads".

These are my articles published this week on DZone.
Practical PHP Refactoring: Pull Up Constructor Body completes the miniseries on pulling up duplication into a superclass, as one of the ways to eliminate it.
TDD for multithreaded applications is my attempt at test-drive the design of a distributed applications without resorting to sleep() calls and non-deterministic tests.
Practical PHP Refactoring: Push Down Method is one of two articles on simplifying superclasses by pushing down pieces of code that are specific to a subclass.
Web application in Clojure: the starting point is an howto for using Ring, the equivalent of the Servlet API in the Clojure world. I probably will try out higher-level tools in the next weeks, like Compojure or Noir.

Sunday, January 01, 2012

Biweekly roundup: waterfall resolutions

No new year's resolution for me; I've come to think they have the trait of a waterfall process: what if you realize the established goal is revelaed to be not so good for you? Even with "universally" recognized beneficial habits, you may discover they're not so important after a change in priorities. Exercising every day may be superceeded by practising a sport; learning a new programming language may be by a new job where you specialize in a single one. To me, it sounds waterfall-ish to establish an yearly goal and work towards it without revising the situation at least monthly.

By the way, in the last two weeks of the year I have published a few articles on DZone that may interest you.
Practical PHP Refactoring: Replace Error Code with Exception explains how to write object-oriented PHP also in dealing with errors.
The Spark micro framework is a concise, self-contained framework for quickly develop Java web applications.
Practical PHP Refactoring: Replace Exception with Test attempts to avoid unnecessary exceptions when an error condition can be early detected.
3D experience in a browser with Three.js is a review of a library for building 3D scenes in a browser over WebGL, the canvas element or SVG.
Practical PHP Refactoring: Pull Up Field explains how to eliminate the duplication of a field within an inheritance hierarchy.
Clojure libraries and builds with Leiningen explains how to pull Clojure and Java libraries and compile with them from the command line, like you could do with Ant and Maven.
Practical PHP Refactoring: Pull Up Method explains the use of inheritance to eliminate the duplication of a method.
Open source PHP projects of 2011 is a non-scientific review of the most popular and exciting projects in the PHP landscape.