SlideShare a Scribd company logo
1 of 22
Download to read offline
Catalyst - refactor & have fun


            – refactor large apps
            with tE@M (of individuals)
                   and have fun!

       Adam Bartosik, krakow.pm
What we had?




                                  24
    Existing datawarehouse with CGI web interface
ξ€Š




     365
    working (mostly) 24h*365
ξ€Š


    build by many people
ξ€Š


    Perl supports individuality
ξ€Š


    Large projects HATE this
ξ€Š
What we had?

    Codebase: different styles of programming /
ξ€Š

    how perl was growing
        in-line script / eval { main() } / procedural
    ξ€Š


        split into packages
    ξ€Š



    3 approaches to html templates
ξ€Š


    3 database wrappers
ξ€Š


    own date-time counting libs
ξ€Š


    hacks, hacks, hacks.../ bugs, bugs, bugs...
ξ€Š
What we had / we want

    perl is not too formal a language. Great for
ξ€Š

    things you need to change,
    develop the way you've never thought before
    /what we mostly do/.
    The bigger a perl project is,
ξ€Š

    the more rules you need to obey.
    warnings, strict, perl-critic are just about code
ξ€Š

    quality, not about design practices
    XP, test-approach, test-suits - hard to start but
ξ€Š

    make work easier, safer and faster (changes
    are welcome!)
What we want?

    make it the best possible way
ξ€Š


    make it easier
ξ€Š


    maintainable
ξ€Š


    learn something new, have fun :)
ξ€Š
Choosing new platform

    hours of talking, advocating
ξ€Š


    use CPAN instead of self-made libs (opposit to
ξ€Š

    company politic?)
        they have better doc
    ξ€Š


        better tested
    ξ€Š


        are still being developed
    ξ€Š


        eg. DateTime is slower than simple $date, but
    ξ€Š

        checks ranges
        SQL::Abstract can quote everything
    ξ€Š


        TT can move view-logic to templates
    ξ€Š
web framework needed!

    we don't like to deal with sessions, url handling,
ξ€Š

    redirecting (handling simple redirect in cgi is
    NOT simple)
    CGI::App is like glue, but we need fundaments
ξ€Š


    it should be popular enough to have some
ξ€Š

    support level /work must be done/
    so the winner is...
ξ€Š
Catalyst ++

    Catalyst – similar to Rails
ξ€Š


    MVC – code / layout / data source
ξ€Š

    MUST (/should) be split :)
    directory layout
ξ€Š


    can start web app in a minute
ξ€Š


    most of web tasks (sessions, url mapping,
ξ€Š

    redirects) are one-liners
    self server to test changes (quick start for
ξ€Š

    developers)
Catalyst --

    hard to find good doc (but going better)
ξ€Š


    too flexible, TIMTOWTDI
ξ€Š


        what to use for O/R mapping?
    ξ€Š


        which templates?
    ξ€Š


        type of config file?
    ξ€Š


        session storage?
    ξ€Š


        view type?
    ξ€Š



    Rails, Django are easier to start with, have
ξ€Š

    better doc, marketing, hype, ”proper way to do
    it”
Learning curve




                    ?
    start-up: first 2-3 weeks are the worst
ξ€Š


    tutos, docs, advent calendars, Handel, different
ξ€Š

    approaches, different results
    logical or a crap we wasting time on?
ξ€Š
Learning curve
    Template Toolkit make life easier:
ξ€Š


         pass complex data [ {name=>bar}, {name=>baz} ]
     ξ€Š

         to templates, iterations are done in tpl
         <ul> [% FOREACH row IN rows %]
     ξ€Š

          <li>[% row.name %]
         [% END %] </ul>
         easy Ajax integration
     ξ€Š


         can switch totally different layouts (we needed it 3
     ξ€Š

         months later – nice to be possible do this without big
         hacks)
    Don't forget Mason => no another lang in tpl
ξ€Š
Learning curve

    DBIx::Class – rapid ORM interface
ξ€Š


        use when it is worth to use
    ξ€Š


        it is not trivial to rewrite complex SQL queries to
    ξ€Š

        dbix, does not simplify complicated joins (we have
        datawarehouse, a little more than blog – SQL can be simpler)
        dbix is powerfull for data updating
    ξ€Š


        $post = $c->model('app::comment')->create({
    ξ€Š

         nick => $c->req->{'nick'},
         value => $c->req->{'value'} });
        $post->update;
Learning curve

    Easy ”hard CGI things”
ξ€Š


        dynamic redirect (after save, redirect user to eg.
    ξ€Š

        main page)

        sub save : Local {
          my ($self, $c) = @_;
          # save
          # redirect
          $c->res->redirect($c->uri_for('/'));
        }
Learning curve

    Global ”catch-flag”, eg:
ξ€Š


        change language
    ξ€Š


        choose output format
    ξ€Š

        app/Controller/Root.pm

        sub pdf : Regex('.?pdf$') {
          my ($self, $c) = @_;
          my $redir = $c->req->path;
          $redir =~ s/.pdf$//;
          $c->stash->{output_pdf} = 1;
          $redirect =~ s{/$}{/index};
          $c->forward($redirect);
        }
Learning curve

    Preserve link layout (when SEO matters)
ξ€Š




    URL: /news/what-about-perl6.html

    sub news : LocalRegex('^/(.+).html$') {
      my ($self, $c) = @_;
      my $title = $c->req->captures->[0];
      # find this article by $title...
    }
Learning curve

    Still no best answer to all
ξ€Š

    form/multiform/validation tasks.
        HTML::Widget
    ξ€Š


        Form::Builder
    ξ€Š


        everything is possible, but typically breaks mvc
    ξ€Š



    MVC: Forms design should be in templates
ξ€Š

    (view, css, layout), not in controllers,
    validation rules for input data should be placed
    in models (see Rails approach)
Learning curve
    Web-services – SOAP, XML-RPC, REST – to
ξ€Š

    share data with other systems/projects
        just output xml/yaml/anything
    ξ€Š

        sub xml : Local {
          $c->res->body(XMLout($data)); # kiss/works
        }
        build simple controller with pure TT and xml
    ξ€Š

        template (fast when you must pass defined output,
        DTD/Schema)
        many plugins/controllers in CPAN, eg.
    ξ€Š

        C::P::Flavour, see also Catalyst Cookbook / simply
        ask what kind of abstraction for WS you need
Catalyst is social!

    easy to work together – code is split /by design/
ξ€Š

    into many parts
    no global switches/routing rules => less
ξ€Š

    conflicts in code repository
    the team can scale: start with 2, growth to 5 or
ξ€Š

    more
Catalyst is social!

     We must obey some rules & conventions – what,
 ξ€Š

     where, how – work in team need some rules
     => they make life easier
     why develop own libs when there are so many
 ξ€Š

     good on CPAN? We can fix bugs, extend them,
     contribute to open source
         less own codebase => lower costs
     ξ€Š


         more developers => better approaches
     ξ€Š


         other features => can need them in 2 or 3 months
     ξ€Š
Benefits after time

    Months of active developemt but codebase is
ξ€Š

    still fresh (and it is perl, true!)
        Clear design
    ξ€Š


        Only ”business application” code
    ξ€Š


        Less to type
    ξ€Š



    We can make deep changes:
ξ€Š


        multi-level caches for balanced nodes
    ξ€Š

        with pre-caching
        change layout as often as is needed by marketing :)
    ξ€Š
Benefits after time


    Catalyst works like a web-processing
ξ€Š

    meta-language
    It is not that (dirty) perl, it is a Catalyst
ξ€Š
see in Krakow!

      Thanks - krakow perl mongers

More Related Content

What's hot

WP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of DeveloperWP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of DeveloperChandra Patel
Β 
Bring the light in your Always FREE Oracle Cloud
Bring the light in your Always FREE Oracle CloudBring the light in your Always FREE Oracle Cloud
Bring the light in your Always FREE Oracle CloudDimitri Gielis
Β 
Untangling the web9
Untangling the web9Untangling the web9
Untangling the web9Derek Jacoby
Β 
Aligning Ember.js with Web Standards
Aligning Ember.js with Web StandardsAligning Ember.js with Web Standards
Aligning Ember.js with Web StandardsMatthew Beale
Β 
Debugging Drupal - How to Debug your Drupal Application
Debugging Drupal - How to Debug your Drupal ApplicationDebugging Drupal - How to Debug your Drupal Application
Debugging Drupal - How to Debug your Drupal ApplicationZyxware Technologies
Β 
[drupalday2017] - Speed-up your Drupal instance!
[drupalday2017] - Speed-up your Drupal instance![drupalday2017] - Speed-up your Drupal instance!
[drupalday2017] - Speed-up your Drupal instance!DrupalDay
Β 
EG Reports - Delicious Data
EG Reports - Delicious DataEG Reports - Delicious Data
EG Reports - Delicious DataBenjamin Shum
Β 
Sparkling Water, ASK CRAIG
Sparkling Water, ASK CRAIGSparkling Water, ASK CRAIG
Sparkling Water, ASK CRAIGSri Ambati
Β 
Developing OpenResty Framework
Developing OpenResty FrameworkDeveloping OpenResty Framework
Developing OpenResty FrameworkOpenRestyCon
Β 
Laravel level 0 (introduction)
Laravel level 0 (introduction)Laravel level 0 (introduction)
Laravel level 0 (introduction)Kriangkrai Chaonithi
Β 
NetflixOss Stack
NetflixOss StackNetflixOss Stack
NetflixOss StackDiego Pacheco
Β 
Laravel level 2 (Let's Practical)
Laravel level 2 (Let's Practical)Laravel level 2 (Let's Practical)
Laravel level 2 (Let's Practical)Kriangkrai Chaonithi
Β 
Building Recoverable (and optionally async) Pipelines with Apache Spark (+ s...
Building Recoverable (and optionally async) Pipelines with Apache Spark  (+ s...Building Recoverable (and optionally async) Pipelines with Apache Spark  (+ s...
Building Recoverable (and optionally async) Pipelines with Apache Spark (+ s...Holden Karau
Β 
JavaScript - No Longer A Toy Language
JavaScript - No Longer A Toy LanguageJavaScript - No Longer A Toy Language
JavaScript - No Longer A Toy LanguageKMS Technology
Β 
How we maintain 200+ Drupal sites in Georgetown University
How we maintain 200+ Drupal sites in Georgetown UniversityHow we maintain 200+ Drupal sites in Georgetown University
How we maintain 200+ Drupal sites in Georgetown UniversityOvadiah Myrgorod
Β 
Internationalizing The New York Times
Internationalizing The New York TimesInternationalizing The New York Times
Internationalizing The New York TimesScott Taylor
Β 
WP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of DeveloperWP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of DeveloperChandra Patel
Β 

What's hot (20)

WP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of DeveloperWP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of Developer
Β 
Dev streams2
Dev streams2Dev streams2
Dev streams2
Β 
Bring the light in your Always FREE Oracle Cloud
Bring the light in your Always FREE Oracle CloudBring the light in your Always FREE Oracle Cloud
Bring the light in your Always FREE Oracle Cloud
Β 
Untangling the web9
Untangling the web9Untangling the web9
Untangling the web9
Β 
Aligning Ember.js with Web Standards
Aligning Ember.js with Web StandardsAligning Ember.js with Web Standards
Aligning Ember.js with Web Standards
Β 
Debugging Drupal - How to Debug your Drupal Application
Debugging Drupal - How to Debug your Drupal ApplicationDebugging Drupal - How to Debug your Drupal Application
Debugging Drupal - How to Debug your Drupal Application
Β 
[drupalday2017] - Speed-up your Drupal instance!
[drupalday2017] - Speed-up your Drupal instance![drupalday2017] - Speed-up your Drupal instance!
[drupalday2017] - Speed-up your Drupal instance!
Β 
Designing net-aws-glacier
Designing net-aws-glacierDesigning net-aws-glacier
Designing net-aws-glacier
Β 
EG Reports - Delicious Data
EG Reports - Delicious DataEG Reports - Delicious Data
EG Reports - Delicious Data
Β 
Sparkling Water, ASK CRAIG
Sparkling Water, ASK CRAIGSparkling Water, ASK CRAIG
Sparkling Water, ASK CRAIG
Β 
Developing OpenResty Framework
Developing OpenResty FrameworkDeveloping OpenResty Framework
Developing OpenResty Framework
Β 
Laravel level 0 (introduction)
Laravel level 0 (introduction)Laravel level 0 (introduction)
Laravel level 0 (introduction)
Β 
NetflixOss Stack
NetflixOss StackNetflixOss Stack
NetflixOss Stack
Β 
Laravel level 2 (Let's Practical)
Laravel level 2 (Let's Practical)Laravel level 2 (Let's Practical)
Laravel level 2 (Let's Practical)
Β 
Building Recoverable (and optionally async) Pipelines with Apache Spark (+ s...
Building Recoverable (and optionally async) Pipelines with Apache Spark  (+ s...Building Recoverable (and optionally async) Pipelines with Apache Spark  (+ s...
Building Recoverable (and optionally async) Pipelines with Apache Spark (+ s...
Β 
Laravel Level 1 (The Basic)
Laravel Level 1 (The Basic)Laravel Level 1 (The Basic)
Laravel Level 1 (The Basic)
Β 
JavaScript - No Longer A Toy Language
JavaScript - No Longer A Toy LanguageJavaScript - No Longer A Toy Language
JavaScript - No Longer A Toy Language
Β 
How we maintain 200+ Drupal sites in Georgetown University
How we maintain 200+ Drupal sites in Georgetown UniversityHow we maintain 200+ Drupal sites in Georgetown University
How we maintain 200+ Drupal sites in Georgetown University
Β 
Internationalizing The New York Times
Internationalizing The New York TimesInternationalizing The New York Times
Internationalizing The New York Times
Β 
WP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of DeveloperWP-CLI - A Good Friend of Developer
WP-CLI - A Good Friend of Developer
Β 

Similar to Catalyst - refactor large apps with it and have fun!

Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008Mir Nazim
Β 
Practical catalyst
Practical catalystPractical catalyst
Practical catalystdwm042
Β 
Killing the Angle Bracket
Killing the Angle BracketKilling the Angle Bracket
Killing the Angle Bracketjnewmanux
Β 
The "Holy Grail" of Dev/Ops
The "Holy Grail" of Dev/OpsThe "Holy Grail" of Dev/Ops
The "Holy Grail" of Dev/OpsErik Osterman
Β 
Don't you (forget about me) - PHP Meetup Lisboa 2023
Don't you (forget about me) - PHP Meetup Lisboa 2023Don't you (forget about me) - PHP Meetup Lisboa 2023
Don't you (forget about me) - PHP Meetup Lisboa 2023Bernd Alter
Β 
Crash Course HTML/Rails Slides
Crash Course HTML/Rails SlidesCrash Course HTML/Rails Slides
Crash Course HTML/Rails SlidesUdita Plaha
Β 
Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010
Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010
Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010singingfish
Β 
Ad505 dev blast
Ad505 dev blastAd505 dev blast
Ad505 dev blastBill Buchan
Β 
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven PignataroJoomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven PignataroSteven Pignataro
Β 
RubyEnRails2007 - Dr Nic Williams - Keynote
RubyEnRails2007 - Dr Nic Williams - KeynoteRubyEnRails2007 - Dr Nic Williams - Keynote
RubyEnRails2007 - Dr Nic Williams - KeynoteDr Nic Williams
Β 
Intro to mobile web application development
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application developmentzonathen
Β 
JavaScripts & jQuery
JavaScripts & jQueryJavaScripts & jQuery
JavaScripts & jQueryAsanka Indrajith
Β 
Usability in the GeoWeb
Usability in the GeoWebUsability in the GeoWeb
Usability in the GeoWebDave Bouwman
Β 
SOUG_Deployment__Automation_DB
SOUG_Deployment__Automation_DBSOUG_Deployment__Automation_DB
SOUG_Deployment__Automation_DBUniFabric
Β 
Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011Wim Godden
Β 
Buildingsocialanalyticstoolwithmongodb
BuildingsocialanalyticstoolwithmongodbBuildingsocialanalyticstoolwithmongodb
BuildingsocialanalyticstoolwithmongodbMongoDB APAC
Β 
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Codemotion
Β 
[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress DevelopmentAdam Tomat
Β 

Similar to Catalyst - refactor large apps with it and have fun! (20)

Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Best Practices For Drupal Developers By Mir Nazim @ Drupal Camp India 2008
Β 
Practical catalyst
Practical catalystPractical catalyst
Practical catalyst
Β 
Killing the Angle Bracket
Killing the Angle BracketKilling the Angle Bracket
Killing the Angle Bracket
Β 
The "Holy Grail" of Dev/Ops
The "Holy Grail" of Dev/OpsThe "Holy Grail" of Dev/Ops
The "Holy Grail" of Dev/Ops
Β 
Don't you (forget about me) - PHP Meetup Lisboa 2023
Don't you (forget about me) - PHP Meetup Lisboa 2023Don't you (forget about me) - PHP Meetup Lisboa 2023
Don't you (forget about me) - PHP Meetup Lisboa 2023
Β 
Crash Course HTML/Rails Slides
Crash Course HTML/Rails SlidesCrash Course HTML/Rails Slides
Crash Course HTML/Rails Slides
Β 
Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010
Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010
Don't RTFM, WTFM - Open Source Documentation - German Perl Workshop 2010
Β 
Ad505 dev blast
Ad505 dev blastAd505 dev blast
Ad505 dev blast
Β 
Supa fast Ruby + Rails
Supa fast Ruby + RailsSupa fast Ruby + Rails
Supa fast Ruby + Rails
Β 
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven PignataroJoomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
Β 
RubyEnRails2007 - Dr Nic Williams - Keynote
RubyEnRails2007 - Dr Nic Williams - KeynoteRubyEnRails2007 - Dr Nic Williams - Keynote
RubyEnRails2007 - Dr Nic Williams - Keynote
Β 
Api Design
Api DesignApi Design
Api Design
Β 
Intro to mobile web application development
Intro to mobile web application developmentIntro to mobile web application development
Intro to mobile web application development
Β 
JavaScripts & jQuery
JavaScripts & jQueryJavaScripts & jQuery
JavaScripts & jQuery
Β 
Usability in the GeoWeb
Usability in the GeoWebUsability in the GeoWeb
Usability in the GeoWeb
Β 
SOUG_Deployment__Automation_DB
SOUG_Deployment__Automation_DBSOUG_Deployment__Automation_DB
SOUG_Deployment__Automation_DB
Β 
Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011
Β 
Buildingsocialanalyticstoolwithmongodb
BuildingsocialanalyticstoolwithmongodbBuildingsocialanalyticstoolwithmongodb
Buildingsocialanalyticstoolwithmongodb
Β 
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Β 
[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development[Bristol WordPress] Supercharging WordPress Development
[Bristol WordPress] Supercharging WordPress Development
Β 

Recently uploaded

APRIL2024_UKRAINE_xml_0000000000000 .pdf
APRIL2024_UKRAINE_xml_0000000000000 .pdfAPRIL2024_UKRAINE_xml_0000000000000 .pdf
APRIL2024_UKRAINE_xml_0000000000000 .pdfRbc Rbcua
Β 
Cyber Security Training in Office Environment
Cyber Security Training in Office EnvironmentCyber Security Training in Office Environment
Cyber Security Training in Office Environmentelijahj01012
Β 
Chapter 9 PPT 4th edition.pdf internal audit
Chapter 9 PPT 4th edition.pdf internal auditChapter 9 PPT 4th edition.pdf internal audit
Chapter 9 PPT 4th edition.pdf internal auditNhtLNguyn9
Β 
Marketplace and Quality Assurance Presentation - Vincent Chirchir
Marketplace and Quality Assurance Presentation - Vincent ChirchirMarketplace and Quality Assurance Presentation - Vincent Chirchir
Marketplace and Quality Assurance Presentation - Vincent Chirchirictsugar
Β 
8447779800, Low rate Call girls in Rohini Delhi NCR
8447779800, Low rate Call girls in Rohini Delhi NCR8447779800, Low rate Call girls in Rohini Delhi NCR
8447779800, Low rate Call girls in Rohini Delhi NCRashishs7044
Β 
TriStar Gold Corporate Presentation - April 2024
TriStar Gold Corporate Presentation - April 2024TriStar Gold Corporate Presentation - April 2024
TriStar Gold Corporate Presentation - April 2024Adnet Communications
Β 
Pitch Deck Teardown: Geodesic.Life's $500k Pre-seed deck
Pitch Deck Teardown: Geodesic.Life's $500k Pre-seed deckPitch Deck Teardown: Geodesic.Life's $500k Pre-seed deck
Pitch Deck Teardown: Geodesic.Life's $500k Pre-seed deckHajeJanKamps
Β 
Financial-Statement-Analysis-of-Coca-cola-Company.pptx
Financial-Statement-Analysis-of-Coca-cola-Company.pptxFinancial-Statement-Analysis-of-Coca-cola-Company.pptx
Financial-Statement-Analysis-of-Coca-cola-Company.pptxsaniyaimamuddin
Β 
Darshan Hiranandani [News About Next CEO].pdf
Darshan Hiranandani [News About Next CEO].pdfDarshan Hiranandani [News About Next CEO].pdf
Darshan Hiranandani [News About Next CEO].pdfShashank Mehta
Β 
Call Us πŸ“²8800102216πŸ“ž Call Girls In DLF City Gurgaon
Call Us πŸ“²8800102216πŸ“ž Call Girls In DLF City GurgaonCall Us πŸ“²8800102216πŸ“ž Call Girls In DLF City Gurgaon
Call Us πŸ“²8800102216πŸ“ž Call Girls In DLF City Gurgaoncallgirls2057
Β 
Investment in The Coconut Industry by Nancy Cheruiyot
Investment in The Coconut Industry by Nancy CheruiyotInvestment in The Coconut Industry by Nancy Cheruiyot
Investment in The Coconut Industry by Nancy Cheruiyotictsugar
Β 
PSCC - Capability Statement Presentation
PSCC - Capability Statement PresentationPSCC - Capability Statement Presentation
PSCC - Capability Statement PresentationAnamaria Contreras
Β 
NewBase 19 April 2024 Energy News issue - 1717 by Khaled Al Awadi.pdf
NewBase  19 April  2024  Energy News issue - 1717 by Khaled Al Awadi.pdfNewBase  19 April  2024  Energy News issue - 1717 by Khaled Al Awadi.pdf
NewBase 19 April 2024 Energy News issue - 1717 by Khaled Al Awadi.pdfKhaled Al Awadi
Β 
Church Building Grants To Assist With New Construction, Additions, And Restor...
Church Building Grants To Assist With New Construction, Additions, And Restor...Church Building Grants To Assist With New Construction, Additions, And Restor...
Church Building Grants To Assist With New Construction, Additions, And Restor...Americas Got Grants
Β 
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCRashishs7044
Β 
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCRashishs7044
Β 
International Business Environments and Operations 16th Global Edition test b...
International Business Environments and Operations 16th Global Edition test b...International Business Environments and Operations 16th Global Edition test b...
International Business Environments and Operations 16th Global Edition test b...ssuserf63bd7
Β 
Market Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 EditionMarket Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 EditionMintel Group
Β 

Recently uploaded (20)

APRIL2024_UKRAINE_xml_0000000000000 .pdf
APRIL2024_UKRAINE_xml_0000000000000 .pdfAPRIL2024_UKRAINE_xml_0000000000000 .pdf
APRIL2024_UKRAINE_xml_0000000000000 .pdf
Β 
Cyber Security Training in Office Environment
Cyber Security Training in Office EnvironmentCyber Security Training in Office Environment
Cyber Security Training in Office Environment
Β 
Chapter 9 PPT 4th edition.pdf internal audit
Chapter 9 PPT 4th edition.pdf internal auditChapter 9 PPT 4th edition.pdf internal audit
Chapter 9 PPT 4th edition.pdf internal audit
Β 
Marketplace and Quality Assurance Presentation - Vincent Chirchir
Marketplace and Quality Assurance Presentation - Vincent ChirchirMarketplace and Quality Assurance Presentation - Vincent Chirchir
Marketplace and Quality Assurance Presentation - Vincent Chirchir
Β 
8447779800, Low rate Call girls in Rohini Delhi NCR
8447779800, Low rate Call girls in Rohini Delhi NCR8447779800, Low rate Call girls in Rohini Delhi NCR
8447779800, Low rate Call girls in Rohini Delhi NCR
Β 
TriStar Gold Corporate Presentation - April 2024
TriStar Gold Corporate Presentation - April 2024TriStar Gold Corporate Presentation - April 2024
TriStar Gold Corporate Presentation - April 2024
Β 
Pitch Deck Teardown: Geodesic.Life's $500k Pre-seed deck
Pitch Deck Teardown: Geodesic.Life's $500k Pre-seed deckPitch Deck Teardown: Geodesic.Life's $500k Pre-seed deck
Pitch Deck Teardown: Geodesic.Life's $500k Pre-seed deck
Β 
Financial-Statement-Analysis-of-Coca-cola-Company.pptx
Financial-Statement-Analysis-of-Coca-cola-Company.pptxFinancial-Statement-Analysis-of-Coca-cola-Company.pptx
Financial-Statement-Analysis-of-Coca-cola-Company.pptx
Β 
Darshan Hiranandani [News About Next CEO].pdf
Darshan Hiranandani [News About Next CEO].pdfDarshan Hiranandani [News About Next CEO].pdf
Darshan Hiranandani [News About Next CEO].pdf
Β 
Japan IT Week 2024 Brochure by 47Billion (English)
Japan IT Week 2024 Brochure by 47Billion (English)Japan IT Week 2024 Brochure by 47Billion (English)
Japan IT Week 2024 Brochure by 47Billion (English)
Β 
Call Us πŸ“²8800102216πŸ“ž Call Girls In DLF City Gurgaon
Call Us πŸ“²8800102216πŸ“ž Call Girls In DLF City GurgaonCall Us πŸ“²8800102216πŸ“ž Call Girls In DLF City Gurgaon
Call Us πŸ“²8800102216πŸ“ž Call Girls In DLF City Gurgaon
Β 
Investment in The Coconut Industry by Nancy Cheruiyot
Investment in The Coconut Industry by Nancy CheruiyotInvestment in The Coconut Industry by Nancy Cheruiyot
Investment in The Coconut Industry by Nancy Cheruiyot
Β 
PSCC - Capability Statement Presentation
PSCC - Capability Statement PresentationPSCC - Capability Statement Presentation
PSCC - Capability Statement Presentation
Β 
NewBase 19 April 2024 Energy News issue - 1717 by Khaled Al Awadi.pdf
NewBase  19 April  2024  Energy News issue - 1717 by Khaled Al Awadi.pdfNewBase  19 April  2024  Energy News issue - 1717 by Khaled Al Awadi.pdf
NewBase 19 April 2024 Energy News issue - 1717 by Khaled Al Awadi.pdf
Β 
Church Building Grants To Assist With New Construction, Additions, And Restor...
Church Building Grants To Assist With New Construction, Additions, And Restor...Church Building Grants To Assist With New Construction, Additions, And Restor...
Church Building Grants To Assist With New Construction, Additions, And Restor...
Β 
Call Us βž₯9319373153β–»Call Girls In North Goa
Call Us βž₯9319373153β–»Call Girls In North GoaCall Us βž₯9319373153β–»Call Girls In North Goa
Call Us βž₯9319373153β–»Call Girls In North Goa
Β 
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
8447779800, Low rate Call girls in New Ashok Nagar Delhi NCR
Β 
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
8447779800, Low rate Call girls in Uttam Nagar Delhi NCR
Β 
International Business Environments and Operations 16th Global Edition test b...
International Business Environments and Operations 16th Global Edition test b...International Business Environments and Operations 16th Global Edition test b...
International Business Environments and Operations 16th Global Edition test b...
Β 
Market Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 EditionMarket Sizes Sample Report - 2024 Edition
Market Sizes Sample Report - 2024 Edition
Β 

Catalyst - refactor large apps with it and have fun!

  • 1. Catalyst - refactor & have fun – refactor large apps with tE@M (of individuals) and have fun! Adam Bartosik, krakow.pm
  • 2. What we had? 24 Existing datawarehouse with CGI web interface ξ€Š 365 working (mostly) 24h*365 ξ€Š build by many people ξ€Š Perl supports individuality ξ€Š Large projects HATE this ξ€Š
  • 3. What we had? Codebase: different styles of programming / ξ€Š how perl was growing in-line script / eval { main() } / procedural ξ€Š split into packages ξ€Š 3 approaches to html templates ξ€Š 3 database wrappers ξ€Š own date-time counting libs ξ€Š hacks, hacks, hacks.../ bugs, bugs, bugs... ξ€Š
  • 4. What we had / we want perl is not too formal a language. Great for ξ€Š things you need to change, develop the way you've never thought before /what we mostly do/. The bigger a perl project is, ξ€Š the more rules you need to obey. warnings, strict, perl-critic are just about code ξ€Š quality, not about design practices XP, test-approach, test-suits - hard to start but ξ€Š make work easier, safer and faster (changes are welcome!)
  • 5. What we want? make it the best possible way ξ€Š make it easier ξ€Š maintainable ξ€Š learn something new, have fun :) ξ€Š
  • 6. Choosing new platform hours of talking, advocating ξ€Š use CPAN instead of self-made libs (opposit to ξ€Š company politic?) they have better doc ξ€Š better tested ξ€Š are still being developed ξ€Š eg. DateTime is slower than simple $date, but ξ€Š checks ranges SQL::Abstract can quote everything ξ€Š TT can move view-logic to templates ξ€Š
  • 7. web framework needed! we don't like to deal with sessions, url handling, ξ€Š redirecting (handling simple redirect in cgi is NOT simple) CGI::App is like glue, but we need fundaments ξ€Š it should be popular enough to have some ξ€Š support level /work must be done/ so the winner is... ξ€Š
  • 8. Catalyst ++ Catalyst – similar to Rails ξ€Š MVC – code / layout / data source ξ€Š MUST (/should) be split :) directory layout ξ€Š can start web app in a minute ξ€Š most of web tasks (sessions, url mapping, ξ€Š redirects) are one-liners self server to test changes (quick start for ξ€Š developers)
  • 9. Catalyst -- hard to find good doc (but going better) ξ€Š too flexible, TIMTOWTDI ξ€Š what to use for O/R mapping? ξ€Š which templates? ξ€Š type of config file? ξ€Š session storage? ξ€Š view type? ξ€Š Rails, Django are easier to start with, have ξ€Š better doc, marketing, hype, ”proper way to do it”
  • 10. Learning curve ? start-up: first 2-3 weeks are the worst ξ€Š tutos, docs, advent calendars, Handel, different ξ€Š approaches, different results logical or a crap we wasting time on? ξ€Š
  • 11. Learning curve Template Toolkit make life easier: ξ€Š pass complex data [ {name=>bar}, {name=>baz} ] ξ€Š to templates, iterations are done in tpl <ul> [% FOREACH row IN rows %] ξ€Š <li>[% row.name %] [% END %] </ul> easy Ajax integration ξ€Š can switch totally different layouts (we needed it 3 ξ€Š months later – nice to be possible do this without big hacks) Don't forget Mason => no another lang in tpl ξ€Š
  • 12. Learning curve DBIx::Class – rapid ORM interface ξ€Š use when it is worth to use ξ€Š it is not trivial to rewrite complex SQL queries to ξ€Š dbix, does not simplify complicated joins (we have datawarehouse, a little more than blog – SQL can be simpler) dbix is powerfull for data updating ξ€Š $post = $c->model('app::comment')->create({ ξ€Š nick => $c->req->{'nick'}, value => $c->req->{'value'} }); $post->update;
  • 13. Learning curve Easy ”hard CGI things” ξ€Š dynamic redirect (after save, redirect user to eg. ξ€Š main page) sub save : Local { my ($self, $c) = @_; # save # redirect $c->res->redirect($c->uri_for('/')); }
  • 14. Learning curve Global ”catch-flag”, eg: ξ€Š change language ξ€Š choose output format ξ€Š app/Controller/Root.pm sub pdf : Regex('.?pdf$') { my ($self, $c) = @_; my $redir = $c->req->path; $redir =~ s/.pdf$//; $c->stash->{output_pdf} = 1; $redirect =~ s{/$}{/index}; $c->forward($redirect); }
  • 15. Learning curve Preserve link layout (when SEO matters) ξ€Š URL: /news/what-about-perl6.html sub news : LocalRegex('^/(.+).html$') { my ($self, $c) = @_; my $title = $c->req->captures->[0]; # find this article by $title... }
  • 16. Learning curve Still no best answer to all ξ€Š form/multiform/validation tasks. HTML::Widget ξ€Š Form::Builder ξ€Š everything is possible, but typically breaks mvc ξ€Š MVC: Forms design should be in templates ξ€Š (view, css, layout), not in controllers, validation rules for input data should be placed in models (see Rails approach)
  • 17. Learning curve Web-services – SOAP, XML-RPC, REST – to ξ€Š share data with other systems/projects just output xml/yaml/anything ξ€Š sub xml : Local { $c->res->body(XMLout($data)); # kiss/works } build simple controller with pure TT and xml ξ€Š template (fast when you must pass defined output, DTD/Schema) many plugins/controllers in CPAN, eg. ξ€Š C::P::Flavour, see also Catalyst Cookbook / simply ask what kind of abstraction for WS you need
  • 18. Catalyst is social! easy to work together – code is split /by design/ ξ€Š into many parts no global switches/routing rules => less ξ€Š conflicts in code repository the team can scale: start with 2, growth to 5 or ξ€Š more
  • 19. Catalyst is social! We must obey some rules & conventions – what, ξ€Š where, how – work in team need some rules => they make life easier why develop own libs when there are so many ξ€Š good on CPAN? We can fix bugs, extend them, contribute to open source less own codebase => lower costs ξ€Š more developers => better approaches ξ€Š other features => can need them in 2 or 3 months ξ€Š
  • 20. Benefits after time Months of active developemt but codebase is ξ€Š still fresh (and it is perl, true!) Clear design ξ€Š Only ”business application” code ξ€Š Less to type ξ€Š We can make deep changes: ξ€Š multi-level caches for balanced nodes ξ€Š with pre-caching change layout as often as is needed by marketing :) ξ€Š
  • 21. Benefits after time Catalyst works like a web-processing ξ€Š meta-language It is not that (dirty) perl, it is a Catalyst ξ€Š
  • 22. see in Krakow! Thanks - krakow perl mongers