
LAMP and the REST Architecture Step by step analysis of best practice Santiago Gala High Sierra Technology S.L.U. Minimalistic design using a Resource Oriented Architecture What is a Software Platform (Ray Ozzie ) ...a relevant and ubiquitous common service abstraction Creates value by leveraging participants (e- cosystem) Hardware developers (for OS level platforms) Software developers Content developers Purchasers Administrators Users Platform Evolution Early stage: not “good enough” solution differentiation, innovation, value flows Later: modular architecture, commoditiza- tion, cloning no premium, just speed to market and cost driven The platform effect - ossification, followed by cloning - is how Chris- tensen-style modularity comes to exist in the software industry. What begins as a value-laden proprietary platform becomes a replaceable component over time, and the most successful of these components finally define the units of exchange that power commodity networks. ( David Stutz ) Platform Evolution (II) Example: PostScript Adobe Apple LaserWriter Aldus Pagemaker Desktop Publishing Linotype imagesetters NeWS (Display PostScript) OS X standards (XSL-FO -> PDF, Scribus, OOo) Software Architecture ...an abstraction of the runtime elements of a software system during some phase of its oper- ation. A system may be composed of many lev- els of abstraction and many phases of opera- tion, each with its own software architecture. Roy Fielding (REST) What is Architecture? Way to partition a system in components Way for components to locate and co-operate with other components Way to make information flow through the sys- tem Way to evolve components independently Way to describe the above Elements of Architecture Components Abstract units of instructions and internal state that provides data transformation through a given interface Connectors Abstract mechanism that mediates communication, coordination or cooperation between components Data Element of information that is transferred from a com- ponent, or received by a component, via a connector Architecture characteristics Elements i.e. Components, Connectors, and Data Properties what can be achieved by combination of the above in a certain way. Quality attributes Styles An Architectural style is a coordinated set of architec- tural constraints that restricts the roles/features of ar- chitectural elements and the allowed relationships among those elements within any architecture that conforms to the style Architecture characteristics (II) Configuration Structure of architectural relationships amongst com- ponents, connectors and data during a period of the system runtime Patterns Software patterns, etc. Views Global Architecture aspects. Examples: temporal issues state and control approaches data representation transaction life cycle security safeguards peak demand and graceful degradation. Network App. Styles Process Oriented Information is “processed” by components Data Flow Oriented information flows in a component pipeline Resource (Document) Oriented components serve and receive documents Message Oriented components send and receive messages Data-flow styles ● Process is analized as information that moves between components ● Pipe and Filter (PF) ● Uniform P&F (UPF) Replication styles ● Proces is achieved by copying data to the com- ponent that is going to use it ● Replicated Repository (RR) ● Caché ($) Hierarchical ● Process is achieved by a configuration of com- ponents with diverse roles ● Client-Server (CS) ● Layered System, Layered CS (LS, LCS) ● Client-Stateless-Server (CSS) ● Client-Caché-Stateless-Server (C$SS) ● Remote Session (RS) ● Remote Data Access (RDA) Mobile Code ● Not just data, but code moves for the process- ing ● Virtual Machine (VM) ● Remote Evaluation (REV) ● Code on demand (COD) ● LCODC$SS ● Mobile Agent (MA) Peer-to-Peer ● No hierarchy of clients and servers between the processing nodes ● Event Based Integration (EBI) ● C2 (combines EBI with LCS) ● Distributed Objects (DO) ● Brokered Distributed Objects (BDO) P . y Style Compay rit son m i t m . r l y i y r y y i y . l t z t o t i t i r i i o c . i b y i f l l f i l i b t u i r n c b i i r m i s a l b e g b e l a i b e i o i v n a a f P t s p l a l b P t c e i i i s n t u r l a o t f m s e P u o e e f c i v x i o Style Derivation N U E S S E E C C R V P R PF +- + + + + + UPF PF - +- ++ + + ++ ++ + RR ++ + + $ RR + + + + CS + + + LS - + + + + LCS CS+LS - ++ + ++ + + CSS CS - ++ + + + + C$SS CSS+$ - + + ++ + + + + LC$SS LCS+C$SS - +- + +++ ++ ++ + + + + RS CS + - + + - RDA CS + - - + - VM +- + - + REV CS+VM + - +- + + - + - COD CS+VM + + + +- + + - LCODC$SS LC$SS+COD - ++ ++ +4+ + +-+ ++ + + + +- + + MA REV+COD + ++ +- ++ + + - + EBI + -- +- + + + + - - C2 - + + ++ + + ++ +- + +- DO - + + + + + - - BDO - - ++ + + ++ - + REST Representational State Transfer The Web Architectural Style client-server browser server stateless requests are selfcontained cache Protocol has provisions for caching uniform interface HTTP/verbs (GET, POST ...) layered system proxies, balancers, gateways code-on-demand applets, javascript Elements of REST Data Resource (Abstract Document) Resource Identifier (URL, URN) Representation (HTML, RSS, Atom) Representation metadata (media type, ... ) Resource metadata Control data Connectors client (libwww) server (libapr) caché resolver tunnel Components origin server (Apache, Tomcat, AOLServer,...) gateway (mod_proxy, mod_jk) proxy (Squid) user agent (Firefox, Safari, MSIE) Ye olde CRUD... Resource Oriented State Transfer Uniform Interface... HTTP verbs: PUT, GET, POST, DELETE CRUD verbs: CREATE, READ, UPDATE, DELETE ...but Document Oriented The concept of “site” is strong collection of resources headlines and logs are typical of publishing CRUD is too shallow for small grain objects, but right for big grain documents Different things, but related A platform usually brings an Architectural Style “natural” to it There are reinforcement loops: The Platform makes certain Architectures easier Style becomes ecosystem “culture” In a house construction example, wooden American houses do have distinct architec- ture style than brick European ones, or adobe Web Platforms LAMP/WAMP and LAP/WAP :-) driven by power developers and users J2EE driven by traditional EIS providers more oriented to intranet or complex services .NET (a second iteration clone of J2EE) tries to preserve the Client Server Windows ecosystem (VB.NET, ASP) driven by Microsoft constituents LAMP Linux, Apache, MySQL, Perl/PHP/Python WAMP variant, using Windows Variant: LAP or WAP (no Database) Dynamic Languages... High Level (abstract types, code is first order) Open Source (“grass roots”) Dynamically typed (“type goes with object”) ...with rich libraries scrape a web site in 200 LOC CPAN, PHP-lib or Python could become even stronger with parrot LAMP works Quality: “fitness for a given purpose” A quality Architectural style/Platform is fit for the requirements and constraints of the system deliver in changing spec environments statelessness lead to big scalability Loose Coupling Minimizing state Reactive Programming for Web Apps, J2EE/.NET follows LAMP Blosxom (and PyBlosxom) Rael Dornfest design and implementation The Zen of blogging Minimalistic blog software Microcontent rendering engine Extensible and simple to install and use Could it be the Zen of Content Manage- ment? Blosxom (and Pyblosxom) (II) Blosxom 2: The Zen of blogging 614 LOC, 17k core 413 LOC, 11k plugins A bit more in docs and samples Pyblosxom: a clone in python 1780LOC, 58K core more comments and plugins (150K total) Mombo Sam Ruby's blogging code blosxom derivative Started as a mix between perl, python, java and mod_rewrite Now it is python+procmail+mod_rewrite More sophisticated, enforces xhtml Less “platform-like” design still very small and powerful Size does matter (Code Size) The less lines of code less bugs less maintenance smaller learning curve Size does matter (Content Granularity) It is no longer the Web Document Content Management Unit -> Entry (Infolet) Rendering Unit -> Portlet PIM (Personal Information Manager) 90's, Contacts, Calendar, Email, Documents Lotus Organizer, Outlook, Notes PKM (Personal Knowledge Manager) 00's Calendar, Blogroll, Entries, Email, Bookmarks Blosxom, Groovy?, Chandler?, Dashboard? Services: del.icio.us, Technorati, Bloglines Size does matter (Platformwise) The less lines of code more visible are the design and architecture trade-offs easier to deploy and reuse Value shifts from platform vendor to platform user (trainer, deployer, customizer) Value shifts to services around *Blosxom Architecture CGI (gateway) or Static Generator (caché) Store (File System) Micro Pipeline: Parser Aggregator Renderer *Blosxom Components File system: hierarchical database resources flavours templates Title and meta info inside the file Could be substituted for real metainfo (Reiser, HFS+, ...) URLs can be mapped to make a dynamic site look static to make a static site as a caché of dynamic generated code *Blosxom Data URL maps to hierarchy of entries... symlinks and tags will work in 3.0 ...or temporal period... ...plus representation... Decouple “flavours” from resources (html, rss, atom) ... via templates with var interpolation) *Blosxom design Pipeline pattern (with plugins) Extension points for template selection head date story
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages72 Page
-
File Size-