160 likes | 177 Views
This article provides an in-depth look at the processes and decision-making involved in assessing, selecting, and using a lightweight Perl web framework. It covers technical considerations, business tools for decision-making, and various Perl application frameworks. The article is aimed at individuals with a background and interest in Perl web development.
E N D
Desperately Seeking…a lightweight Perl web framework Peter Edwards Desperately seeking... a lightweight Perl web framework
Introduction • Peter Edwards ~ background Subject • Explain about the processes and decision making involved in assessing, selecting and using a Perl web framework Desperately seeking... a lightweight Perl web framework
Aims • Learn what frameworks are out there • Technical considerations • Business tools for decision-making • Audience: What is your background and interest? Desperately seeking... a lightweight Perl web framework
Topics • Define the problem • Example requirements • Attributes of frameworks • Business decision making tools • Architecture • Application components • Perl application frameworks • Roll your own • Summary Desperately seeking... a lightweight Perl web framework
Define the Problem • Why do you need a web app? • What functionality / how complex?no. screens, other features, e.g. search engine, integration to other apps/components/company infrastructure, server platform • Business settingProject length, size; Developer expertise, skill sets; Integration to network, database type, existing frameworks e.g. ADS authentication; Capacity plan - no. of users and required performance Desperately seeking... a lightweight Perl web framework
Example http://merlinfootball.com • ComponentsFlash front end, sending XML transactions toPerl back endPerl XHTML admin system • ElementsHuge volume of users and transactionsStreaming videoPicture upload and approval to galleryFAQ submission, approval and editing into FAQ list Desperately seeking... a lightweight Perl web framework
Attributes of Frameworks • Size -> complexity • Learning curve • Vertical vs. horizontal • Functionality, flexibility • Monotheistic/"One True Way" vs. agnostic • Increased power, reduced performance • Cost of testing new code = 50% of time • By extension DRY KISS Desperately seeking... a lightweight Perl web framework
Business Decision Making Tools The point of businessIncreased shareholder value - cash William of Occam, 14th century logician and Franciscan friarentia non sunt multiplicanda praeter necessitatementities should not be multiplied beyond necessity"All things being equal, the simplest solution tends to be the best one.“It often happens that the best explanation is much more complicated than the simplest possible explanation because it requires fewer assumptions. Pareto Principle, by Joseph M. Juran named after Vilfredo Pareto, Italian economist"for many phenomena, 80% of the consequences stem from 20% of the causes“-- en.wikipedia.org Cost Benefit AnalysisEstimate days for developmentEstimate hidden costs and benefits e.g. of more stable frameworkCost comparison -> decisionPerfection vs. pragmatism Desperately seeking... a lightweight Perl web framework
Architecture I • Web ProtocolHTTP request/responseURI, REST, URL parameters http://server.com/client/view/FRED?view=xml&tabs=allWeb 2.0, AJAX • Web ServerApache, IIS, lighttpdCGI/mod_perl, FastCGI • Controller ProcessingApache registry style stacked phase handlersMVC Model View ControllerSingle entry point vs. separate CGI Desperately seeking... a lightweight Perl web framework
Architecture II • SessionCGI::SessionApache::SessionCatalyst::Plugin::Session -> Cache::FastMMap • Security AuthenticationGroup permission rolesHTML field and SQL field encoding • Database layerDirect DBISimple Class::DBIORM Object Relational Mapper DBIx::Class Rose::DBPerformance considerations - DBI 10-100x fasterData object attributes - data dictionary - screen dictionary Desperately seeking... a lightweight Perl web framework
Architecture III • TemplatesTemplate::Toolkit (TT2) variable merge, not too complex, encourages using Perl in app modulesHTML::Mason – inline codePersonal preference; understandable by Web designersXHTML, accessibility, internationalisation Locale::MaketextForm handling, CRUD from db object, validation Data::FormValidatorRich components http://script.aculo.us/ http://dojotoolkit.org/ • Testingmodule unit test, business data object tests, Javascript/browser compatability checksTest::More Test::WWW::Mechanize Test::WWW::Selenium Desperately seeking... a lightweight Perl web framework
Application Components • Pre-built componentssave time in short term on testing; may cost more long term; integration costsPHP::Session LanguageRepositoryTemplateComponentPerl CPAN TT2 BricolagePHP PEAR Smarty CMSMSPython Built-in Clearsilver Trac Desperately seeking... a lightweight Perl web framework
Perl Application Frameworks • CGI::Application + CGI::Session lightweight, easy to use, reliable, full control, open Watch out for CGI::Builder, based on CGI::App but used to have Makefile.PL that downloaded and eval'd code, also bizarre "Perlish" coding style ; use 5.006_001 ; use Carp ; $Carp::Internal{+__PACKAGE__}++ ; $Carp::Internal{__PACKAGE__.'::_'}++ ; use IO::Util • CGI::Frameworkfixed - glue between HTML::Template, CGI::Session, CGI, Locale::Maketext last release 11-Oct-2005 • Jifty one true way: database mapper, template, web services, AJAX toolkit, handlers for FastCGI continuations, form-based dispatch "Jifty is the only web application framework that comes with a pony“ • Gantry + Bigtop Apache/mod_perl, MVC Bigtop - web application data language processor, app generator • OpenInteract + SPOPS Complex, slow, powerful, CMS-oriented permissions last release 18-Mar-2005 • Catalystagnostic, MVC, complex, magic, powerful, slow (third time in NEXT/C3 OO extension), well tested Works well with DBIx::Class and TT2; can also use Class:DBI, HTML::Mason Many plugins for auth, XML etc. • Maypole (ancestor of Catalyst) similar approach Class::DBI, TT2 Desperately seeking... a lightweight Perl web framework
Roll Your Own • "Not invented here" syndrome, AKA submitting a module to CPAN with "Lite" or "Plus" in the name. • Can base on CGI::Application + CGI::Session • Or write one yourself. Easier than you'd think. Here's one written in a week, not pretty but delivered a project delivered fast and on time: http://perl.dragonstaff.co.uk/app.zip Desperately seeking... a lightweight Perl web framework
Summary Processes and decision making • requirements • business context • CBA decision basis • technical considerations, architecture, constraints and features • application components • Perl application frameworks Desperately seeking... a lightweight Perl web framework
Where to Get More Information • CPAN http://search.cpan.org • Books • Any Questions • These slides are at http://perl.dragonstaff.co.uk/ Desperately seeking... a lightweight Perl web framework