Talk was held during the PHP Conference in Barcelona (27.09.2008), which was also attended by Derick Rethans, Scott MacVicar and other international speakers. It shows the advantages of using a php framework vs. spaghetti code for web application development in an agile manner.
A simple example based on the Akelos PHP Framework shows you how to implement a fulltext search in less than 20 minutes.
1. <?php
echo ($AgileFramework == $HappyDeveloper) ?
“Rasmus, think again!” : die(‘PHP’);
delicious.com bookmarks.yahoo.com addons.mozilla.org
All sites above were created using a PHP Framework.
11. Do you like Spaghetti?
Warning:
The following slides contain spaghetti code.
12. The “Italian” Scripting Language
* 1995
* Sample Snippet from 1995 (http://talks.php.net/show/froscon08/4)
13. The “Italian” Scripting Language
? ! ? ! ? ! ?!?!?!?
ok, back then .. but now
everything is better, no?
* 1995
* Sample Snippet from 1995 (http://talks.php.net/show/froscon08/4)
17. “Spaghetti a la OOP” anyone?
* 2005
* Sample Snippet from 2005 (http://talks.php.net/show/froscon08/5)
18. “Spaghetti a la OOP” anyone?
at least stmts!
useless exception handling!
wow! heredocs as
view template!
* 2005
* Sample Snippet from 2005 (http://talks.php.net/show/froscon08/5)
22. Then I realized that ...
... knowing everything better
... reinventing the wheel
... organizing source code
... over and over again
is a pretty heavy load.
23. But there is help ...
... to make you a more relaxed,
more productive web developer.
Disclaimer:
The following slides are not the view of a sect
or any kind of religion. Its just pragmatic!
24. If you could start fresh
... in a new job
... on a new project
25. If you could choose ...
Don’t us CAF*
e PHP?
Spaghetti
F rameworks
* Create Another Framework
35. Not reinventing the wheel ...
Framework No Framework
Lines of Code you need to write
Project Complexity
... makes you code less!
Disclaimer: I do not trust any statistics, I did not invent myself.
Graphs are representative to express a general fact.
37. Lines of Code you need to write But writing more code ...
Bugs
... results in more bugs!
Disclaimer: I do not trust any statistics, I did not invent myself.
Graphs are representative to express a general fact.
39. Control the important stuff ...
Important Basic
Without a framework With a framework
... to create a useful application!
Disclaimer: I do not trust any statistics, I did not invent myself.
Graphs are representative to express a general fact.
41. suspects
you from the usual
and a shield, which protects
Good Frameworks ...
... while leaving room
for your creativity....
... provide a solid ...
... unit tested ...
... base ...
52. Manifesto for Agile Software Development
(http://www.agilemanifesto.org)
Individuals and interactions over processes and tools
Working software over comprehensive documentation
Customer collaboration over contract negotiation
Responding to change over following a plan
69. But Rasmus said that* ...
... frameworks are performing poorly
* http://tinyurl.com/frameworks-think-again
70. Ok, let me tell
you something about
Rasmus Lerdorf
71. Rasmus’ view on PHP
a simple tool for non-developers
“to solve the web problem”
.. if you cannot solve it easily with
PHP - push it to another layer* ...
* (Not everyone wants/can code php extensions)
Did I get you right Rasmus?
72. I got a message for you
Rasmus
Graduated Computer Scientists
are developing in PHP ...
... not just script kiddies.
73. Let us have a look at
Rasmus way of testing
PHP frameworks.
75. I am going to show you the
source code for this
money machine.
You need to sign a NDA before though!
76. Disclosed
Hello World Business Core
<html>
<head> </title>
hp ech o “Test” ?>
<title><?p
</head>
<body> rld” ?>
o “Hello Wo
<?php ech
</body>
</html>
85. Rasmus is right.
Frameworks suck
for Hello World
Applications. ;-)
We evolved a bit since 1995...
Could someone please start a “hello business” example?
86. We want to make money
become rich and famous.
So a hello world app would maybe be
my second best choice for that purpose.
102. A common problem: Search Engine
Preparation
Install hyperestraier:
debian: # apt-get install hyperestraier
Setup / Start hyperestraier:
debian: # estmaster init /var/myindices
debian: # estmaster start /var/myindices
Create API user and index at:
http://admin:admin@localhost:1978
Install search plugin:
debian: akelos# ./script/plugin install acts_as_searchable
103. A common problem: Search Engine
Overview
Step 1 - Model
Enabling the search plugin on the model Video.
Indexing existing videos.
Step 2 - View
Add a search form to the archives view.
Step 3 - Controller
Add a search action to the video’s archive.
/archive/search