Right now I am in Skien, which is somewhere in the middle of the dark forests of Norway. Skien, a bustling town of a whopping 45.000 people is the seventh largest municipiality in Norway, and also the home of the PHP Vikinger Unconference.
My part on this Unconference was to hold a Nontalk, a session where I asked the audience to come up with things that they think are typical for Everyday PHP use and that currently do not have a name.
The following stuff are the slightly edited and commented notes I made in front of the audience while moderating our session.
Things that have no name
The mission: I want you together with me to collect stuff and build a taxonomy of things that are special to a PHP programming culture, and then to name these things to make them searchable and to enable reflection on them.
The method: Brainstorm me. Anything goes. I am keeping onscreen notes for all of us.
Language properties
Popular PHP constructs and properties that are not often seen elsewhere.
- Reliance on plain names for functionality, not special characters as in perl.
- There is just one kind of array: Every array is a hash, every hash is an array.
- Using hashes to replace complex switches.
- Hashes have order.
- Hashes as a method of passing named parameters.
- Using hash keys to store the important information.
- $counts[$name] = 1;
- split this, sort this, map this, grep this.
- Love array_flip() instead of searching values in an array.
- Flip twice to get uniqueness.
A thing to do and try:
- Mapping ideoms from different programming languages onto each other would be an interesting project.
Ideas
- The one core value of PHP is the idea of of simplicity. Things should be plain ad straightforward as possible.
- "Dumbing it down"
- Make a complex such as SOAP servers concept accessible.
- Provide convenience functions.
- Provide a prepackaged smart path to enable users to get quick results.
- PHP is written with language driven development in mind. Tool driven ("Eclipse style") development is possible, but PHP should be useful without any other tools.
- Eliminating redundant code.
- Eliminating redundant tasks. (Example given by Rasmus: You can force types, but you don't have to).
- The network is becoming a first class API. This is a fancy way to put the fact that PHP tries to treat POST/GET data as part of the environment.
- "Fear of layers." Use the most "hands on" approach to get the job done.
- Layers are good to make concepts clear. Being able to cut through layers is good for making things possible. PHP thrives on the concept of "Leaky abstractions."
- PHP is extensible. "PHP is the borg. It can assimilate anything out there and add it to its own perfection."
- "Deployment model favors loosely coupled parts." Large scale PHP applications naturally drift to shared nothing models.
Methods
- Deployment model forces scaling by request than scaling by active session. Shared Nothing Architectures are favored. Rasmus: "Pushing the scalabilty requirements down to the components."
- Use C as an implementation language and PHP as a glue language. PHP modules are favored over PHP libraries.
Tradition
- "PHP is for the web. It was born on the web." It can be used as a general purpose language, but it cannot forget where it was born.
- "As in Perl, there is more than one way to do it. But there is a preferred standard way and we can make that one easily accessible."
- "PHP is a presentation language. Use compiled languages to do the heavy lifting."
- "The message of PHP is 'You can write it yourself.' PHP is easily accessible, while not locking out the experts."
- "PHP is not a religion, it focuses on getting the job done, not on doing it the right or even in a beautiful way."
Alan Kay: "Simple things should be simple and complex things should be possible."
Failures
- We do not make the secure way of doing things easier and more obvious than the other ways (But there is a filter extension as part of PHP 6, currently in PECL).
- We have not adapted our ways in a way to cope with the more hostile environent the internet has become.
- Inconsistency in language and module design. Is that really a problem? Or are you simply using the wrong IDE? Obviously it is not a barrier to entry.
Feature requests
- We are still missing array_flip($orig)["someval"] syntax.
- Sara wants "do() or throw new Exception", to match do() or die().
On Frameworks
- Frameworks try to make data native to PHP, for example import tables from a DB into native PHP variables and vice versa.
- Frameworks try to supply a structure to your code. Rasmus: "Everybody needs a framework in the sense of supplying rules and structure. It is just that not everybody needs the same framework. 'Getting rich with PHP' is not an anti-framework talk."
The PHP Vikinger event was a great success. It was skillfully guided by Zak Greant who did such a great job orginizing it. Since this was the first PHP event I attended and the fist unconference, I cannot really compare with "regular" conferences, but
Tracked: Jun 27, 23:02
In "The J2EE guy still doesn't get PHP", Harry Fuecks suggests that PHP really needs [someone] to get together and write a detailed paper on how it works and why PHP scales so we can all live happily ever after. I could not agree more. At the 3rd Eu
Tracked: Sep 05, 11:25