Skip to content

Communities

Practical PHP Refactoring: Replace Delegation with Inheritance

Delegation is a more flexible solution with respect to inheritance, because it allows to change collaborators by introducing new classes. However, it hides the public protocol of the collaborator into a private field.If you find yourself writing many delegation methods, you may refactor to inheritance to simplify the code. The subclass will inherit everything automatically, which makes...
Categories: Communities

A Twitter Experiment: @devops_jerk

I am @devops_jerk. I’m not a jerk – but I have played one on Twitter. On the 15th of October I setup the account on Twitter. Today, not quite 2 months later, I am officially ending the experiment. I learned some interesting things and had a lot of fun in the process – this blog post talks about the experience. Article Type:  ...
Categories: Communities

Algorithm of the Week: Data Compression with Relative Encoding

OverviewRelative encoding is another data compression algorithm. Preview Text:  I will show you how you can save space for certain implementations by reducing the amount of characters you are encoding using relative encoding. Christopher Smith
Categories: Communities

Practical PHP Refactoring: Replace Inheritance with Delegation

When a subclass violates the Liskov Substitution Principle, or uses only part of a superclass, it is a warning sign that composition can simplify the design.Refactoring to composition transform the superclass into an object of its own, which becomes the collaborator of the class under refactoring. Instead of inheriting every public method, the object will just expose the strictly needed...
Categories: Communities

Improving Performance by Batching Azure Table Storage Inserts

This is a short post to share the results of a little investigation I did that was inspired by comments on a post I wrote about using SQL Azure for handling session data. The comment was by someone reporting that SQL Azure seemed to be faster than Azure Table Storage for handling session data.
Categories: Communities

Developer Machine Automation: Dependencies

As I mentioned in a post last week we’ve been automating the setup of our developer machines with puppet over the last week and one thing that we’ve learnt is that you need to be careful about how you define dependencies. The aim is to get your scripts to the point where the outcome is reasonably deterministic so that we can have confidence they’re going to work the next we run...
Categories: Communities

Practical PHP Refactoring: Form Template Method

Duplication is not always expressed as an identical block of code: often it is subtler to discover, because it exists at an higher level of abstraction.Consider a sorting algorithm, a classic example in computer science: it can be implemented on widely different data structures, as long as their element can be compared and swapped. If we compare quicksort implemented on an array of integers or on...
Categories: Communities

Algorithm of the Week: Data Compression with Diagram Encoding and Pattern Substitution

Two variants of run-length encoding are the diagram encoding and the pattern substitution algorithms. The diagram encoding is actually a very simple algorithm.
Categories: Communities

Sh*t Project Managers Say

Just a few things you may hear from your everyday project manager... Embed Tag:  <object width="640" height="480"><param name="movie" value="http://www.youtube.com/v/UBr3MM9_zd4?version=3&amp;hl=en_US"></param><param name="allowFullScreen"...
Categories: Communities

Practical PHP Refactoring: Collapse Hierarchy

In the scenario of today, a subclass and superclass are not very different: the evolution of the code has brought them to this situation. Behavior has been removed, or moved elsewhere in the system, and they are almost the same entity.The Collapse Hierarchy refactoring provides a series of steps to unify two such classes into one, simplifying the design.
Categories: Communities

DZone Top Article of 2011: Programmers are f***ing lazy

With the possible exception of philosophers, programmers are the laziest bunch of people I know. It seems like everyone else I speak to has some sort of labor intensive profession. Think about it, biologists do all those experiments … giving a drug to hundreds of mice is can’t be automated. Article Type:  Opinion/Editorial ...
Categories: Communities

PHPUnit_Selenium

With the 1.2 release, PHPUnit_Selenium supports (basically) for the first time the Selenium 2 WebDriver API. While PHPUnit_Selenium already worked with Selenium 2, it did so only by using the Selenium 1 emulation included in the jar; now it provides an object-oriented API right natively supported in a base PHPUnit test case, shipped in PHPUnit's PEAR channel.InstallationInstallation is usually...
Categories: Communities

Using SQL Azure Federations via PHP

Among the December updates to the Windows Azure platform was the introduction of SQL Azure Federations. In a nutshell, SQL Azure Federations introduces an abstraction layer for the sharding of SQL Azure databases.
Categories: Communities

DZone Top Article of 2011: Ask DZ - What's the best programming advice you've ever got?

For example, Travis Griggs' blog post explains some of the best OOP advice he ever received.What is the best piece of advice anyone ever gave you, and why it was so good? Maybe include some particular projects the advice helped you with, or how the advice improved your general approach to development, etc. Article Type:  Opinion/Editorial ...
Categories: Communities

Practical PHP Refactoring: Extract Interface

A concrete class still defines an implicit interface by itself, as the set of its public methods. When the called interface is a subset of this, or it is depended upon in multiple places, it is interesting to make it explicit.The Extract Interface refactoring creates an interface from an existing concrete class.
Categories: Communities

Algorithm of the Week: Data Compression with Bitmaps

In my previous post we saw how to compress data consisting of very long runs of repeating elements. This type of compression is known as “run-length encoding” and can be very handy when transferring data with no loss. The problem is that the data must follow a specific format.
Categories: Communities

Practical PHP Refactoring: Extract Superclass

In the scenario of today, there are two or more unrelated classes with similar members, like common methods or fields. While these classes may be already linked on the semantical level (via duplicated names or namespaces), there is nothing that ties them in the PHP interpreter's mind (if it has one.)The Extract Superclass refactoring establishes an inheritance hierarchy by introducing a base...
Categories: Communities

DZone Top Article of 2011: 7 Tenets Of Framework Selection

As you develop any application, you will need to choose various tools, libraries and frameworks that you want to integrate into the application. In some cases, this could be a very simple task of choosing the most popular and widely respected tool. However, this is not often the case. In most cases, there are several tools that could fit your basic requirement, and they all have their own...
Categories: Communities

DZone Top Article of 2011: 3 Components of a Successful Project

Earlier this month I attended the monthly meeting of the Seattle PHP Meetup Group. In ways I didn’t expect, it was a very interesting meeting. The content itself was interesting enough (we were talking about database design), but what I found even more interesting was how the meeting dynamics provided a good reminder of what goes into a successful software project.References ...
Categories: Communities

Are Google Analytics Cookies Slowing Down the Internet?

Eduardo Cereto has some concerns about the possibility of Google Analytics cookies slowing down the sites that use the web app (which obviously includes many of the most popular sites on the internet).  Some readers may have thought this claim illegitimate, as such a major issue could hardly have gone unnoticed by Google engineers.  But the first comment on Cereto's post was made by none...
Categories: Communities