the origin of lithium
DESCRIPTION
This talk is an overview of the history of the PHP language and major framework projects that have emerged in the last 5 years. It examines what we've learned in the development of these frameworks, how that education has been brought to bear in Lithium. Most of this talk ended up being me demoing and answering questions, so there's not a lot of content in the slides, sorry.TRANSCRIPT
![Page 1: The Origin of Lithium](https://reader033.vdocuments.us/reader033/viewer/2022051110/54b7a7d64a795993718b48b3/html5/thumbnails/1.jpg)
On the Origin of LithiumThe framework for people who hate frameworks
![Page 2: The Origin of Lithium](https://reader033.vdocuments.us/reader033/viewer/2022051110/54b7a7d64a795993718b48b3/html5/thumbnails/2.jpg)
?
![Page 3: The Origin of Lithium](https://reader033.vdocuments.us/reader033/viewer/2022051110/54b7a7d64a795993718b48b3/html5/thumbnails/3.jpg)
![Page 4: The Origin of Lithium](https://reader033.vdocuments.us/reader033/viewer/2022051110/54b7a7d64a795993718b48b3/html5/thumbnails/4.jpg)
I booked this talk with Hans
And now here we are
![Page 5: The Origin of Lithium](https://reader033.vdocuments.us/reader033/viewer/2022051110/54b7a7d64a795993718b48b3/html5/thumbnails/5.jpg)
In the beginning...
PHP / FI
1995
<!--sql database select * from table where user='$username'-->
<!--ifless $numentries 1--> Sorry, that record does not exist<p> <!--endif exit-->
Welcome <!--$user-->!<p> You have <!--$index:0--> credits left in your account.<p>
PHP 3
![Page 6: The Origin of Lithium](https://reader033.vdocuments.us/reader033/viewer/2022051110/54b7a7d64a795993718b48b3/html5/thumbnails/6.jpg)
In the beginning...
PHP / FIPHP 3
1998
<? $name = "bob"; $db = "db"; $result = msql($db,"select * from table where firstname='$name'"); $num = msql_numrows($result); echo "$num records found!<p>"; $i=0; while($i<$num); echo msql_result($result,$i,"fullname"); echo "<br>"; echo msql_result($result,$i,"address"); echo "<br>"; $i++; endwhile;>
PEAR
![Page 7: The Origin of Lithium](https://reader033.vdocuments.us/reader033/viewer/2022051110/54b7a7d64a795993718b48b3/html5/thumbnails/7.jpg)
In the beginning...
PHP / FIPHP 3
2000
require_once 'MDB2.php';require_once 'DB/Table.php';require_once 'Guestboook_Table.php';
$dsn = "phptype://username:password@localhost/database";$conn = MDB2::connect($dsn);
$table = 'GuestBook';$create = 'safe';$GuestBook =& new GuestBook_Table($conn, $table, $create);
if ($GuestBook->error) { echo "Failure! Try again."; print_r($GuestBook->error);}
PEAR PHP 4
![Page 8: The Origin of Lithium](https://reader033.vdocuments.us/reader033/viewer/2022051110/54b7a7d64a795993718b48b3/html5/thumbnails/8.jpg)
In the beginning...
PHP / FIPHP 3
2000
class A { function foo() { if (isset($this)) { echo '$this is defined (' . get_class($this). ")\n"; } else { echo "\$this is not defined.\n"; } }}class B { function bar() { A::foo(); }}
PEAR PHP 4 PHP 5
![Page 9: The Origin of Lithium](https://reader033.vdocuments.us/reader033/viewer/2022051110/54b7a7d64a795993718b48b3/html5/thumbnails/9.jpg)
In the beginning...
PHP / FIPHP 3
2004
class A {
protected $_foo = 0;
public static function foo() { self::$_foo++; } }
PEARPHP 4 PHP 5 CakePHP
![Page 10: The Origin of Lithium](https://reader033.vdocuments.us/reader033/viewer/2022051110/54b7a7d64a795993718b48b3/html5/thumbnails/10.jpg)
In the beginning...
PHP / FIPHP 3
2005
PEARPHP 4PHP 5 CakePHP
class PostsController extends AppController {
public function index() { $posts = $this->Post->find(“all”); $this->set(compact(‘posts’)); } }
Symfony
![Page 11: The Origin of Lithium](https://reader033.vdocuments.us/reader033/viewer/2022051110/54b7a7d64a795993718b48b3/html5/thumbnails/11.jpg)
In the beginning...
PHP / FIPHP 3
2005
PEARPHP 4PHP 5CakePHP
class mymoduleActions extends sfActions{ public function executeIndex() { // Retrieving request parameters $password = $this->getRequestParameter('password'); // Retrieving controller information $moduleName = $this->getModuleName(); $actionName = $this->getActionName(); // Retrieving framework core objects $request = $this->getRequest(); $userSession = $this->getUser(); $response = $this->getResponse();
Symfony CodeIgniter
![Page 12: The Origin of Lithium](https://reader033.vdocuments.us/reader033/viewer/2022051110/54b7a7d64a795993718b48b3/html5/thumbnails/12.jpg)
In the beginning...
PHP / FIPHP 3
2006
PEARPHP 4PHP 5CakePHP
class Blogmodel extends Model {
var $title = ''; var $content = ''; var $date = '';
function Blogmodel() { // Call the Model constructor parent::Model(); } function get_last_ten_entries()
Symfony CodeIgniter Zend
![Page 13: The Origin of Lithium](https://reader033.vdocuments.us/reader033/viewer/2022051110/54b7a7d64a795993718b48b3/html5/thumbnails/13.jpg)
In the beginning...
PHP / FIPHP 3
2007
PEARPHP 4PHP 5CakePHP
< ?php class Bootstrap extends Zend_Application_Bootstrap_Bootstrap{ protected function _initDoctype() { $this->bootstrap('view'); $view = $this->getResource('view'); $view->doctype('XHTML1_STRICT'); } protected function _initAutoload() { $autoloader = new Zend_Application_Module_Autoloader(array(
SymfonyCodeIgniter Zend
![Page 14: The Origin of Lithium](https://reader033.vdocuments.us/reader033/viewer/2022051110/54b7a7d64a795993718b48b3/html5/thumbnails/14.jpg)
What have we learned?
Uniformity: +
Tight coupling: -
Lack of extensibility: -
![Page 15: The Origin of Lithium](https://reader033.vdocuments.us/reader033/viewer/2022051110/54b7a7d64a795993718b48b3/html5/thumbnails/15.jpg)
What have we learned?
People dislike complexity for its own sake
Things are reactionary (high level)
A lot of things are superficial (high level)
![Page 16: The Origin of Lithium](https://reader033.vdocuments.us/reader033/viewer/2022051110/54b7a7d64a795993718b48b3/html5/thumbnails/16.jpg)
Ch-Ch-Ch-Changes
Late Static Binding
Namespaces
Closures
![Page 17: The Origin of Lithium](https://reader033.vdocuments.us/reader033/viewer/2022051110/54b7a7d64a795993718b48b3/html5/thumbnails/17.jpg)
Late Static BindingProper subclassing of static classes... finally
Warm, fuzzy feelings of architectural purity
Handling state (vs. statelessness)
![Page 18: The Origin of Lithium](https://reader033.vdocuments.us/reader033/viewer/2022051110/54b7a7d64a795993718b48b3/html5/thumbnails/18.jpg)
Namespaces
Formal, non-hacky way to organize classes
No_More_Class_Names_That_Go On_For_Days
New PEAR-inspired naming standard
![Page 19: The Origin of Lithium](https://reader033.vdocuments.us/reader033/viewer/2022051110/54b7a7d64a795993718b48b3/html5/thumbnails/19.jpg)
![Page 20: The Origin of Lithium](https://reader033.vdocuments.us/reader033/viewer/2022051110/54b7a7d64a795993718b48b3/html5/thumbnails/20.jpg)
Standards AdoptersAgavi
Symfony
Doctrine
PEAR
Solar
Zend Framework
...
![Page 21: The Origin of Lithium](https://reader033.vdocuments.us/reader033/viewer/2022051110/54b7a7d64a795993718b48b3/html5/thumbnails/21.jpg)
![Page 22: The Origin of Lithium](https://reader033.vdocuments.us/reader033/viewer/2022051110/54b7a7d64a795993718b48b3/html5/thumbnails/22.jpg)
Closures
function Y($F) { return current(array(function($f) { return $f($f); }))->__invoke(function($f) use ($F) { return $F(function($x) use ($f) { return $f($f)->__invoke($x); }); }); }