Henry Van Styn
<vanstyn@cpan.org>
YAPC::NA 2014
Tuesday, 24 June - 11:00AM
www.rapidapp.info
irc.perl.org - #rapidapp
Agenda
• What is RapidApp - overview & rationale
• How it works - basic architecture & APIs
• Live Demos & Examples…
• Que...
RapidApp is…
• An extension to the Catalyst stack
• Aims to speed development with easy access to
common interface paradig...
Features…
• Automatic, model-driven Ajax interfaces (ExtJS)
• Maps DBIx::Class methods to web front-ends (CRUD+)
• RESTful...
Why another web framework?
Interfaces.
implicit interfaces
…the CRUD-based interfaces which are already implied
by the schema
* all you should have to do to ask ...
“Give me an interface to add rows to Foo”
• Should auto-generate a robust, fully working form
• with fields for each of Fo...
“Give me an interface to add rows to Foo”
…and, don’t be stupid:
• yes - handle client-side validation
• yes - scroll long...
“Give me an interface to add rows to Foo”
And one more thing:
Do predict & provide high-level choices & options…
…and allo...
All I’m really sayin’ …
give me everything
for free
with no trade-offs
Is that really so much to ask??
We already take powerful, declarative APIs for
granted in our perl-side code.
(how I learned I wanted them)
Perl has spoiled me
…and showed what great APIs can & should do
Catalyst
Moose
DBIx::Class
Devel::NYTProf
IO::All
Type::Tiny
Moo
Try::Tiny DateTime
Dist::Zilla
Plack
Path::Class
Web::Sim...
makes programming feel like …
Until…
…it was time to write the front-side code
Y U NO USE MY CSS CLASS?!
But, to be fair …
proficiency bias…
and it usually wasn’t the fault of CSS, Firefox …
(it was IE’s fault)
I don’t want to know CSS.
I want to write models and business logic.
(and still feel entitled to robust web interfaces)
Controller
ViewModel
Application Architecture:
Standard MVC
(“Components” in Catalyst)
DBIC
Controller
ViewModel
Application Architecture:
Standard MVC
(“Components” in Catalyst)
DBIC
Controller
ViewModel
Module
Application Architecture:
RapidApp adds
“Modules” to the mix
Standard MVC
(“Components” i...
DBIC
Controller
ViewModel
Module
Application Architecture:
RapidApp adds
“Modules” to the mix
Encapsulate interface(s)
w/ ...
ViewModel
Controller Root
Module
DBIC
Controller
ViewModel
Module
Application Architecture:
Controller(s)
View(s)Model(s)
...
ViewModel
Controller Root
Module
DBIC
Controller
ViewModel
Module
Application Architecture:
Controller(s)
View(s)Model(s)
...
ViewModel
Controller Root
Module
DBIC
Controller(s)
View(s)Model(s)
Module
Module Module
ModuleModule
...
Application Arch...
ViewModel
Controller
DBIC
Controller(s)
View(s)Model(s)
Root
Module
Module Module
ModuleModule
...
Application Architectur...
ViewModel
Controller
DBIC
Controller(s)
View(s)Model(s)
Root
Module
Module Module
ModuleModule
Catalyst::Plugin::RapidApp
...
Excitement for learning another DSL…
ViewModel
Controller
DBIC
Controller(s)
View(s)Model(s)
Root
Module
Module Module
ModuleModule
Catalyst::Plugin::RapidApp
...
ViewModel
Controller
DBIC
Controller(s)
View(s)Model(s)
Root
Module
Module Module
ModuleModule
Catalyst::Plugin::RapidApp
...
ViewModel
Controller
DBIC
Controller(s)
View(s)Model(s)
Root
Module
Module Module
ModuleModule
Catalyst::Plugin::RapidApp
...
ViewModel
Controller
DBIC
Controller(s)
View(s)Model(s)
Root
Module
Module Module
ModuleModule
Catalyst::Plugin::RapidApp
...
DBIC
Controller(s)
View(s)Model(s)
Root
Module
Module Module
ModuleModule
Catalyst::Plugin::RapidApp
Plugin Plugin Plugin
...
DBIC
Controller(s)
View(s)Model(s)
Root
Module
Module Module
ModuleModule
Catalyst::Plugin::RapidApp
Plugin Plugin Plugin
...
Plugin
Application Architecture:
DBIC
Controller(s)
View(s)Model(s)
Root
Module
Module Module
ModuleModule
Catalyst::Plugi...
Ok… so, show us some code!
Example - MyDNS
• Lightweight authoritative DNS server
• C daemon serves records directly from MySQL
• Very simple schema ...
Our task:
• Create a web-based admin app to manage MyDNS
MyDNS Schema
MyDNS Schema
(demo)
Demo checklist (RA::MyDNS) - 1
cpanm RapidApp
Explain + bootstrap with rapidapp.pl
Run app (1):
Explain navtree + tab pane...
Demo checklist (RA::MyDNS) - 3
Configure app (3):
Create ‘Type’ ResultSource::View
Run app (4):
Show new Type grid
With it...
Demo BlueBox checklist
Explain AngleHack + BlueBox
git clone BlueBox repo
Run app:
Show public demo (newman)
Login and sho...
Questions?
Henry Van Styn
<vanstyn@cpan.org>
www.rapidapp.info
irc.perl.org - #rapidapp
RapidApp - YAPC::NA 2014
Upcoming SlideShare
Loading in...5
×

RapidApp - YAPC::NA 2014

532

Published on

Presentation on RapidApp web framework presented at YAPC::NA 2014

Published in: Software, Technology, Art & Photos
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
532
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Going to talk about the open-source, RapidApp
    web framework

    Which has been an in-house platform that we’ve
    been developing internally for 5 years.

    Just started open-sourcing within the past year.

    which is an extension to Catalyst that focuses on
    building database-driven apps faster than ever.
  • Once we get to the demos will go “off-script”
    and will dive into features and code partially based
    on audience feedback

    This slideshow will be uploaded to slideshare with
    link on yapcna.org after the end of the talk. There
    will also be links to all the code we’ll cover
    (including code we’ll write live during the talk)

    want to get to the demos & actual code quickly,
    … but first we need some context to set the stage
  • It does…

    DBIC: this is one of the primary, original
    core features,… and we’ll be exploring it quite a
    bit in this talk…
    …but is still just a piece of a larger puzzle

    RapidApp also does…
  • What problems does RapidApp solve?
  • Still require entirely too much effort

    Not so much about custom specialty interfaces & designs -
    the highly visible ones you/designer want and plan to write
    … there are plenty of existing designer tools

    custom is custom…

    All the other, general interfaces…
    That you need but don’t want to write…

    And the interfaces that you just do without
    because you don’t have time to write them
  • Just the idea that the basic rules and info
    needed for interfaces are already defined
    in the table schema…

    should be able to have access to them
    without a lot of effort

    Here is one, specific example: (NEXT) ->
  • Where Foo is an existing model object,
    like a DBIC source
  • Database won’t let you insert a string
    into an integer column …
    … so the form shouldn’t either

    Stay tied to schema…
  • just as important as what a framework
    gives is what it takes away

    Don’t presume to know all the use-cases in advance
  • Particularly in the tools coming out of
    the modern Perl movement, like Moose
  • it feels great to program when you
    have awesome tools and libraries at
    your disposal

    it’s why i love Perl
  • it’s how good APIs should make you feel

    …how Perl usually makes me feel
  • Its like going from casting lightning bolts
    from your fingertips like a jedi master…

    … to scrubbing the bathroom floor with a
    toothbrush
  • and CSS and I get along a lot better these days…

    CSS and JavaScript are robust, well-designed & impressive

    But that’s not the point…
  • NEXT:
    Let’s see how RapidApp is built to accomplish this
  • RapidApp is still Catalyst, so we still have the
    same Models, Views and Controllers…
  • …with DBIC-based database backends connected
    through the Model API… Also standard
  • Think of as specialized “Fat controller”

    Contains within it its own MVC-type structures
  • Uses standard plugin API…

    Loading Plugin::RapidApp is what makes a Catalyst
    application become a RapidApp application…

    NEXT: Excitement for learning another DSL…
  • These are the general items I plan to
    cover in the RA::MyDNS live demo…
  • These are the general items I plan to
    cover in the RA::MyDNS live demo…
  • These are the general items I plan to
    cover in the BlueBox live demo…
  • RapidApp - YAPC::NA 2014

    1. 1. Henry Van Styn <vanstyn@cpan.org> YAPC::NA 2014 Tuesday, 24 June - 11:00AM www.rapidapp.info irc.perl.org - #rapidapp
    2. 2. Agenda • What is RapidApp - overview & rationale • How it works - basic architecture & APIs • Live Demos & Examples… • Questions feedback from audience & IRC: join #rapidapp on irc.perl.org
    3. 3. RapidApp is… • An extension to the Catalyst stack • Aims to speed development with easy access to common interface paradigms • Preserves native APIs and environments • Flexible, uber-modular design • Multiple declarative configuration layers • Wide-range of application personalities…
    4. 4. Features… • Automatic, model-driven Ajax interfaces (ExtJS) • Maps DBIx::Class methods to web front-ends (CRUD+) • RESTful URL navigation schemes • Powerful built-in templating and CMS • Automatic asset management (css, js, icons, etc) • (and other gooey-goodness)
    5. 5. Why another web framework?
    6. 6. Interfaces.
    7. 7. implicit interfaces …the CRUD-based interfaces which are already implied by the schema * all you should have to do to ask for them (declarative) *
    8. 8. “Give me an interface to add rows to Foo” • Should auto-generate a robust, fully working form • with fields for each of Foo’s columns • according to each column type… • datetime? - date selector • varchar? - text box • etc. • Column non-nullable? - required field • Foreign key? - selection dialog for the remote source (e.g. dropdown) • and so on
    9. 9. “Give me an interface to add rows to Foo” …and, don’t be stupid: • yes - handle client-side validation • yes - scroll long content in a manner that is not moronic • yes - display exceptions to the client • etc. • no - do not truncate column names… • no - do not drown the children in the tub… (or any other horrible thing I haven’t thought of but obviously don’t want) Be on-demand - automatically change with the schema… • column dropped? - field ceases to exist • made nullable? - field no longer required And obviously… • Handle all the plumbing to tie cleanly into the backend • Just work.
    10. 10. “Give me an interface to add rows to Foo” And one more thing: Do predict & provide high-level choices & options… …and allow me to customize, extend & build upon the base… …but don’t limit me. Do not hinder me in any way from doing things differently.
    11. 11. All I’m really sayin’ … give me everything for free with no trade-offs Is that really so much to ask??
    12. 12. We already take powerful, declarative APIs for granted in our perl-side code. (how I learned I wanted them)
    13. 13. Perl has spoiled me …and showed what great APIs can & should do
    14. 14. Catalyst Moose DBIx::Class Devel::NYTProf IO::All Type::Tiny Moo Try::Tiny DateTime Dist::Zilla Plack Path::Class Web::Simple Authen::Passphrase Test::More Template::Toolkit DBI Dancer
    15. 15. makes programming feel like …
    16. 16. Until… …it was time to write the front-side code
    17. 17. Y U NO USE MY CSS CLASS?!
    18. 18. But, to be fair … proficiency bias… and it usually wasn’t the fault of CSS, Firefox … (it was IE’s fault)
    19. 19. I don’t want to know CSS. I want to write models and business logic. (and still feel entitled to robust web interfaces)
    20. 20. Controller ViewModel Application Architecture: Standard MVC (“Components” in Catalyst)
    21. 21. DBIC Controller ViewModel Application Architecture: Standard MVC (“Components” in Catalyst)
    22. 22. DBIC Controller ViewModel Module Application Architecture: RapidApp adds “Modules” to the mix Standard MVC (“Components” in Catalyst)
    23. 23. DBIC Controller ViewModel Module Application Architecture: RapidApp adds “Modules” to the mix Encapsulate interface(s) w/ plumbing
    24. 24. ViewModel Controller Root Module DBIC Controller ViewModel Module Application Architecture: Controller(s) View(s)Model(s) RapidApp adds “Modules” to the mix Encapsulate interface(s) w/ plumbing Components live adjacent to each other
    25. 25. ViewModel Controller Root Module DBIC Controller ViewModel Module Application Architecture: Controller(s) View(s)Model(s) Components live adjacent to each other Modules live in a hierarchy
    26. 26. ViewModel Controller Root Module DBIC Controller(s) View(s)Model(s) Module Module Module ModuleModule ... Application Architecture: Components live adjacent to each other Modules live in a hierarchy
    27. 27. ViewModel Controller DBIC Controller(s) View(s)Model(s) Root Module Module Module ModuleModule ... Application Architecture: Only one “Root” Module …which is a Controller
    28. 28. ViewModel Controller DBIC Controller(s) View(s)Model(s) Root Module Module Module ModuleModule Catalyst::Plugin::RapidApp ... Application Architecture: RapidApp extends Catalyst via the standard plugin API
    29. 29. Excitement for learning another DSL…
    30. 30. ViewModel Controller DBIC Controller(s) View(s)Model(s) Root Module Module Module ModuleModule Catalyst::Plugin::RapidApp ... Application Architecture: automatically injects and configures modules and components…
    31. 31. ViewModel Controller DBIC Controller(s) View(s)Model(s) Root Module Module Module ModuleModule Catalyst::Plugin::RapidApp Plugin Plugin Plugin ... Application Architecture: automatically injects and configures modules and components…
    32. 32. ViewModel Controller DBIC Controller(s) View(s)Model(s) Root Module Module Module ModuleModule Catalyst::Plugin::RapidApp Plugin Plugin Plugin ... Application Architecture: loads and configures other plugins…
    33. 33. ViewModel Controller DBIC Controller(s) View(s)Model(s) Root Module Module Module ModuleModule Catalyst::Plugin::RapidApp Plugin Plugin Plugin Plugin ... Application Architecture: loads and configures other plugins…
    34. 34. DBIC Controller(s) View(s)Model(s) Root Module Module Module ModuleModule Catalyst::Plugin::RapidApp Plugin Plugin Plugin Plugin Plugin ... ... More Declarative Application Architecture: + More Specialized
    35. 35. DBIC Controller(s) View(s)Model(s) Root Module Module Module ModuleModule Catalyst::Plugin::RapidApp Plugin Plugin Plugin Plugin Plugin ... ... More Declarative Application Architecture: + More Specialized
    36. 36. Plugin Application Architecture: DBIC Controller(s) View(s)Model(s) Root Module Module Module ModuleModule Catalyst::Plugin::RapidApp Plugin Plugin Plugin Plugin ... Controller Module
    37. 37. Ok… so, show us some code!
    38. 38. Example - MyDNS • Lightweight authoritative DNS server • C daemon serves records directly from MySQL • Very simple schema (only 2 tables) • Generally recognizable data (for those familiar with DNS)
    39. 39. Our task: • Create a web-based admin app to manage MyDNS
    40. 40. MyDNS Schema
    41. 41. MyDNS Schema
    42. 42. (demo)
    43. 43. Demo checklist (RA::MyDNS) - 1 cpanm RapidApp Explain + bootstrap with rapidapp.pl Run app (1): Explain navtree + tab panel Show that URLs are all RESTful Show grids Paging, sorting, items p/pg, query time Columns, show/hide, reorder, auto-size Row page (double-click) Filters Quick Search Relationship columns CSV export Configure app (1): Show main app class, model & generated schema classes Explain grid_params & TableSpecs enable editing Run app (2): Edit in grid, page & edit form Delete: single, multiple Batch Modify Add rr w/ existing, then new soa Configure app (2): Set display_column (Soa/origin) Run app (3): Reload tab Show zone rel w/ edit Demo checklist (RA::MyDNS) - 2
    44. 44. Demo checklist (RA::MyDNS) - 3 Configure app (3): Create ‘Type’ ResultSource::View Run app (4): Show new Type grid With its rrs relationship Configure app (4): Add AuthCore plugin Run app (5): Login and out and in… Show login via direct URL Configure app (5): Add CoreSchemaAdmin plugin Run app (6): Change a password Show Sessions grid Configure app (7): Add NavCore plugin Run app (8): Create a saved view Organize Navtree Set a default source view Demo checklist (RA::MyDNS) - 4
    45. 45. Demo BlueBox checklist Explain AngleHack + BlueBox git clone BlueBox repo Run app: Show public demo (newman) Login and show admin section Show editing template pages nested templates *.md templates Show order_list page view page source explain iframe Configure app: Show code Explain main class cnf opts Explain Template Access class Explain Chinook Demo (already on site) git clone RA-ChinookDemo repo checkout complex_rels branch Show HEAD commit in github Run app: Show Album single-rels Show Artist single-rel (self_titled_album) Show MediaType multi-rel (rock_tracks) Demo RA-ChinookDemo checklist
    46. 46. Questions? Henry Van Styn <vanstyn@cpan.org> www.rapidapp.info irc.perl.org - #rapidapp
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×