Original PDF Flash format a-case-study-on-using-open-source-tools-to-build-a-platform-for-...  


A Case Study On Using Open Source Tools To Build A Platform For ...

A
case
study
on
using
open
source
tools
to
build
a
platform
for
enterprise

web
applications
using
symfony
and
Yahoo!
User
Interface
libraries.

Dustin
Whittle


Yahoo!


symfony
+
Yahoo!
User
Interface
Libraries

‣  How
did
Yahoo!
architect
Yahoo!
Answers
with
symfony
and

Yahoo!
User
Interface
libraries?

‣  What
worked
and
what
did
not
when
building
a
large
web
2.0

product
from
open
source
tools?

‣  How
to
work
with
open
source
frameworks
in
the
enterprise?

‣  How
to
develop,
test,
and
deploy
Web
2.0
applications
for
the

enterprise
using
symfony
and
the
Yahoo!
UI
libraries

‣  Q
&
A?

symfony‐project.com

|

developer.yahoo.com


A
look
at
Yahoo!
Answers

‣  http://answers.yahoo.com

‣  Yahoo!
Answers
is
the
largest
collection
of
human
knowledge

on
the
Web
with
more
than
135
million
users
and
515

million
answers
worldwide
(Yahoo!
Internal
Data,
March

2008).

‣  Yahoo!
Answers
is
the
2nd
ranked
education
&
reference
site

on
the
web
(comScore)

‣  Available
in
26
markets
and
12
languages


A
look
at
the
open
source
Yahoo!

‣  Yahoo!
is
built
from
open
source
tools
and
communities

‣  FreeBSD,
Linux,
Apache,
PHP,
MySQL

‣  We
contribute
back
and
everyone
wins

‣  We
share
our
tools,
experience,
and
data
through
open

APIs
and
web
services

‣  Yahoo!
User
Interface
Libraries
+
Edge
Caching

‣  User
Interface
Design
Patterns

‣  Exceptional
Performance
Rules
+
YSlow

‣  R3
Template
+
Translation
Management


A
look
at
Yahoo!
User
Interface
Libraries

‣  JavaScript
Framework

‣  Utilities
‐
YAHOO,
Dom,
Event,
Animation,
Browser
History

Manager,
Connection
Manager,
Cookie,
DataSource,
Drag

and
Drop,
Element,
Get,
ImageLoader,
JSON,
Resize,

Selector,
Loader

‣  Controls
/
Widgets
‐
AutoComplete,
Button,
Calendar,

Charts,
Color
Picker,
DataTable,
ImageCropper,
Rich
Text

Editor,
Slider,
Uploader

‣  Container
(Module,
Overlay,
Panel,
Tooltip,
Dialog),
Layout

Manager,
Menu,
TabView,
TreeView

‣  Debug
–
Logger,
Profiler,
Test


A
look
at
Yahoo!
User
Interface
Libraries

‣  CSS
Foundation

‣  Reset
‐
Neutralizes
browser
CSS
styles

‣  Base
‐
Applies
consistent
style
foundation

‣  Fonts
‐
Foundation
for
typography
and
font‐sizing

‣  Grids
‐
Thousands
of
wireframe
layouts

‣  User
Interface
Design
Patterns
Library

‣  Proven
solutions
to
common
interfaces

‣  http://developer.yahoo.com/ypatterns/

‣  Grade
Browser
Support
/
Progressive
Enhancement


Yahoo!
Answers
at
the
beginning

‣  Started
as
a
small
development
team
on
PHP4
from
a
fork
of

Yahoo!
Taiwan
Knowledge+

‣  Launched
December
2005
by
December
2006
there
were
60

million
users
and
65
million
answers

‣  The
code
base
eventually
became
difficult
to
maintain
and

iterate
new
features
on

‣  Large
distributed
development
teams
(US
/
UK)


Y!
Answers
Architecture

Users

Load
Balancers

Frontend

Apache

PHP

symfony
/
YUI

Custom
Modules

APC,
PEAR,
PECL,
Custom
Extensions

Backend

MySQL/Oracle

Web
Services

Ad
API

User
API

FreeBSD
4.x/6.x,
Linux
2.6.x


The
choice
to
use
an
open
source
framework

‣  symfony
was
investigated
for
use
on
Yahoo!
Bookmarks
as
a

test
for
the
later
re‐architecture
of
Yahoo!
Answers

‣  Investigation
was
performed
in
February
2006

‣  symfony,
CakePHP,
Prado,
Zend
Framework,
Struts,

Tapestry,
Spring,
Seaside,
Ruby
on
Rails,
Django

‣  PHP
has
most
support
internally,
so
the
choice
was
really

between
symfony,
CakePHP,
Prado,
php.MVC,
and
Zend

Framework


What
were
the
needs
from
a
frontend
platform?

‣  Fit
existing
environment
(BSD/PHP5/Apache)
for
phased

migration

‣  Development
Cycle
–
How
easy
to
develop,
test,
and
deploy?

‣  Clean
separation
between
data,
logic,
and
display
(MVC)


‣  Independent
model
layer
to
fit
service
oriented
architecture

‣  Extensible
and
pluggable

‣  Internationalization
and
localization
support

‣  Detailed
documentation
and
active
community
of
support

‣  Open
source
and
ability
to
contribute
back


The
choice
to
use
symfony

‣  Philosophy

‣  Full‐stack
framework
for
building
complex
web
applications

‣  Adopt
best
ideas
from
anywhere,
using
existing
code
if

available
(Mojavi,
Prado,
Rails,
Django)

‣  
Design

‣  Clean
separation
between
Model,
View,
and
Controller

‣  Controller
using
modules
and
actions

‣  Views
using
templates
in
straight
PHP
with
helpers

‣  Easy
to
reuse
view
modules
to
compose
a
page

‣  Layouts,
Components,
Partials,
Slots


The
choice
to
use
symfony

‣  Configurability
/
Flexibility

‣  Features
we
do
not
want
are
easily
disabled

‣  Use
of
factories
for
easy
customization

‣  Documentation
/
Support
Community

‣  The
Definitive
Guide
to
symfony
(free
online)

‣  Excellent
tutorials
and
example
applications
‐
Askeet

‣  Active
community
with
wiki,
mailing
lists,
forums,
irc

channel


A
look
at
symfony
features

‣  MVC
Design
+
Project/Application
Structure

‣  Cascading
Configuration
System
(YAML
‐>
PHP)

‣  Environments
–
Dev,
Prod,
Test,
QA,
Staging

‣  Task
System
–
Tasks
system
for
project
management

‣  Internationalization

+
Localization
Support

‣  Form
/
Widget
/
Validation
System

‣  Security
–
CSRF
+
XSS
Protection
+
User
Management

‣  Caching
–
APC,
Memcache,
File,
Database

‣  Testing
Framework
–
LIME
Unit
+
Functional


Views
are
organized
and
reusable

‣  Actions
can
render
different
views,

a
partial,
or
a
component

(think:
same
action
for
ajax)

‣  View.yml
–
Configures
css,
js,
meta,
layout
(app/module/action)

‣  Layouts
–
Most
web
apps
consist
of
full
page
and
popup
layout

‣  A
partial
is
a
static
template
fragment

(think:
footer)

‣  A
component
is
a
template
fragment
with
business
logic

(think:
popular
list)

‣  Slots
are
placeholders
in
a
page
and
can
be
set
from
anywhere


Component
Partials
Slots
Layouts


A
complete
frontend
platform

‣  A
community
maintained
approach
to
building
web

applications
from
frameworks

‣  PHP
Framework

‣  JavaScript
Framework

‣  CSS
Framework

‣  UI
Design
Patterns
+
Best
Practices

‣  Development
Tools
(logger,
profiler,
debugger,
docs)

‣  Unit
+
Functional
Testing
Frameworks
(LIME
/
YUI
Test)

‣  Deployment
Tools
(rsync
deployment
system)


What
does
Yahoo!
change?

‣  Minor
changes
to
fit
our
environment
(bsd/php/apache)

‣  Most
of
our
changes
are
easily
implemented
via
factories

‣  Added
dimensions
to
configurations
(ysfDimensionsPlugin)

‣  Integrate
R3
translation/template
management
(ysfR3Plugin)

‣  R3
‐
http://developer.yahoo.com/r3/


‣  
Dropped
the
ORM
and
pushed
down
the
stack
(SOA)

‣  Added
a
parallel
API
Dispatcher
(ysfAPIClientPlugin)

‣  Created
a
build
and
deployment
solution
(ysfBuildPlugin)

‣  Integrate
support
for
Y!
User
Interface
libraries
(ysfYUIPlugin)


Localizing
the
experience
with
dimensions

‣  Cascading
Configuration
based
on
YAML

‣  Framework
‐>
Project
‐>
Application
‐>
Module

‣  Extending
the
cascade
to
be
based
on
dimensions

‣  Dimensions
can
be
anything
(and
can
be
chained
together)

‣  Data
Center
+
Environment
for
customizing

configurations

‣  Culture
for
localizing
user
interface
+
data

‣  Theme
for
customizing
look
and
feel

‣  User
info
(is
user
on
corporate
intranet?)

‣  Caching


Extending
the
view
+
i18n
system
with
R3

‣  Translation
+
Template
Management

‣  Integrated
with
symfony
i18n
+
view
layers

‣  <r3:trans>hello</r3:trans>
vs
__(‘hello’)

‣  Dictionary
Management

‣  SQLite/XLIFF
Backend

‣  r3:include,
r3:var,
r3:cphp

‣  Added
tasks

‣  Importing/Exporting
XLIFF
dictionary

‣  Generating
translations
for
projects


A
build
and
deployment
system

‣  Aggregate
and
minify
stylesheets
and
javascripts

‣  Rewrite
templates,
css,
js
for
CDN
(Akamai,
S3,
…)

‣  Generate
translations
for
configurations
+
templates

‣  Generate
configuration
cache

‣  Aggregate
core
classes
+
remove
debug
statements

‣  Run
lint,
unit,
functional
tests

‣  Package
applications
as
.tgz

‣  Deployment
via
rsync


Real
World
Performance

‣  symfony
is
not
targeted
for
building
hello
world
‐‐
It
is

targeted
at
building
complex
web
applications

‣  symfony
can
provide
many
features
(db,
i18n,
security,
orm)

disable
the
ones
you
will
not
use

‣  Yahoo!
Bookmarks

‣  Yahoo!
Answers

‣  100%
dynamic
(no
view
caching)

‣  40‐120qps
with
<
100ms
frontend
latency

‣  Yahoo!
Widgets


symfony
Documentation

‣  The
Definitive
Guide
to
symfony

‣  http://symfony‐project.com/book/1_1

‣  Licensed
under
GFDL
(read
it
free)

‣  API
Documentation

‣  http://www.symfony‐project.org/api/1_1/

‣  Wiki

‣  http://trac.symfony‐project.com/wiki


‣  Many
useful
tutorials,
how
to,
and
translations


Askeet
Advent
+
Community
Support

‣  Askeet.com

‣  http://symfony‐project.com/askeet

‣  24
Day
Tutorial


‣  How
to
build
a
real
web
2.0
application

‣  In‐depth
coverage
of
all
aspects
of
symfony

‣  IRC,
Mailing
List,
and
Forums

‣  irc://irc.freenode.net/#symfony

‣  symfony‐users@googlegroups.com

‣  http://symfony‐project.com/forum


YUI
Examples
+
Documentation

‣  More
than
275
functional
examples

‣  http://developer.yahoo.com/yui/examples/

‣  Yslow
+
Performance
Rules

‣  http://developer.yahoo.com/performance

‣  YUI
Blog

‣  http://yuiblog.com/

‣  Mailing
List
@
Yahoo!
Groups

‣  http://tech.groups.yahoo.com/group/ydn‐javascript/


Getting
started
in
10
minutes

‣  Install
symfony
from
PEAR

‣  pear
channel‐discover
pear.symfony‐project.com

‣  pear
install
symfony/symfony‐beta

‣  Create
a
project
with
symfony
cli

‣  mkdir
web2expo
;
cd
web2expo

‣  symfony
generate:project
web2expo

‣  symfony
generate:app
frontend

‣  symfony
generate:module
frontend
demo


Install
a
foundation
from
plugins

‣  Community
plugins

‣  symfony
plugin:install
sfGuardPlugin

‣  symfony
plugin:install
sfFeed2Plugin

‣  Yahoo!
Plugins
(will
be
released
with
1.1
stable)

‣  symfony
plugin:install
ysfDimensionsPlugin

‣  symfony
plugin:install
ysfR3Plugin

‣  symfony
plugin:install
ysfBuildPlugin

‣  symfony
plugin:install
ysfYUIPlugin


Questions?


Thanks
for
listening
and
enjoy
the
rest
of
the

Web
2.0
Expo!