5
Encourage more usage of PHP Interfaces in Drupal Better Core. Better Modules. Better Drupal. Chris Charlton - XTND.US - http://xtnd.us

DrupalCon Developer Summit 2010 lightning slides: Encourage usage of PHP Interfaces In Drupal

Embed Size (px)

DESCRIPTION

My lightning slides for the Developer Summit taking place a couple days before the DrupalCon 2010 San Francisco event.

Citation preview

Page 1: DrupalCon Developer Summit 2010 lightning slides: Encourage usage of PHP Interfaces In Drupal

Encourage more usage of PHP Interfaces in DrupalBetter Core. Better Modules. Better Drupal.

Chris Charlton - XTND.US - http://xtnd.us

Page 2: DrupalCon Developer Summit 2010 lightning slides: Encourage usage of PHP Interfaces In Drupal

PHP Interfaces implements

Maps out required functions a Class file implements.

Multiple Interfaces allowed per Class file.

Can be extended using the extends operator.

Prevents errors and misspellings of functions/hooks.

Smart IDE software use Interface files as blueprints.

Page 3: DrupalCon Developer Summit 2010 lightning slides: Encourage usage of PHP Interfaces In Drupal

PHP Interfaces usage example

<?php

/** * Query builder for SELECT statements. */class SelectQuery extends Query implements SelectQueryInterface { // ...}

Page 4: DrupalCon Developer Summit 2010 lightning slides: Encourage usage of PHP Interfaces In Drupal

Interfaces used in over 20 instances of Drupal 7 core

Queries & DB Engine

Queues

File transfers

Page 5: DrupalCon Developer Summit 2010 lightning slides: Encourage usage of PHP Interfaces In Drupal

class Drupal implements IDrupal

Attract OOP-based followers (PHP, Java, etc.).

Represents a level of code maturity (and complexity).

Next-gen Module / Theme Engine development?

Might be too soon for Drupal. D9? D10?