RapidApp - YAPC::NA 2014
-
Upload
henry-van-styn -
Category
Software
-
view
387 -
download
2
description
Transcript of RapidApp - YAPC::NA 2014
![Page 1: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/1.jpg)
Henry Van Styn<[email protected]>
YAPC::NA 2014Tuesday, 24 June - 11:00AM
www.rapidapp.info
irc.perl.org - #rapidapp
![Page 2: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/2.jpg)
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
![Page 3: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/3.jpg)
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…
![Page 4: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/4.jpg)
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)
![Page 5: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/5.jpg)
Why another web framework?
![Page 6: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/6.jpg)
Interfaces.
![Page 7: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/7.jpg)
implicit interfaces…the CRUD-based interfaces which are already
implied by the schema
* all you should have to do to ask for them
(declarative) *
![Page 8: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/8.jpg)
“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
![Page 9: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/9.jpg)
“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.
![Page 10: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/10.jpg)
“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.
![Page 11: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/11.jpg)
All I’m really sayin’ …
give me everything
for free
with no trade-offs
Is that really so much to ask??
![Page 12: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/12.jpg)
We already take powerful, declarative APIs for granted in our perl-side code.
(how I learned I wanted them)
![Page 13: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/13.jpg)
Perl has spoiled me…and showed what great APIs can & should
do
![Page 14: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/14.jpg)
Catalyst
Moose
DBIx::Class
Devel::NYTProf
IO::All
Type::Tiny
Moo
Try::Tiny DateTime
Dist::ZillaPlack
Path::Class
Web::Simple
Authen::Passphrase
Test::More
Template::Toolkit
DBI
Dancer
![Page 15: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/15.jpg)
makes programming feel like …
![Page 16: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/16.jpg)
![Page 17: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/17.jpg)
Until…
…it was time to write the front-side code
![Page 18: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/18.jpg)
Y U NO USE MY CSS CLASS?!
![Page 19: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/19.jpg)
But, to be fair …
proficiency bias…
and it usually wasn’t the fault of CSS, Firefox …
(it was IE’s fault)
![Page 20: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/20.jpg)
I don’t want to know CSS.
I want to write models and business logic.
(and still feel entitled to robust web interfaces)
![Page 21: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/21.jpg)
Controller
ViewModel
Application Architecture:
Standard MVC (“Components” in Catalyst)
![Page 22: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/22.jpg)
DBIC
Controller
ViewModel
Application Architecture:
Standard MVC (“Components” in Catalyst)
![Page 23: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/23.jpg)
DBIC
Controller
ViewModel
Module
Application Architecture:
RapidApp adds“Modules” to the
mixStandard MVC
(“Components” in Catalyst)
![Page 24: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/24.jpg)
DBIC
Controller
ViewModel
Module
Application Architecture:
RapidApp adds“Modules” to the
mixEncapsulate
interface(s) w/ plumbing
![Page 25: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/25.jpg)
ViewModel
Controller RootModule
DBIC
Controller
ViewModel
Module
Application Architecture:
Controller(s)
View(s)Model(s)
RapidApp adds“Modules” to the
mixEncapsulate
interface(s) w/ plumbing
Components live adjacent to each
other
![Page 26: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/26.jpg)
ViewModel
Controller RootModule
DBIC
Controller
ViewModel
Module
Application Architecture:
Controller(s)
View(s)Model(s)
Components live adjacent to each
other
Modules live in a hierarchy
![Page 27: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/27.jpg)
ViewModel
Controller RootModule
DBIC
Controller(s)
View(s)Model(s)
Module
Module Module
ModuleModule
. . .
Application Architecture:
Components live adjacent to each
other
Modules live in a hierarchy
![Page 28: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/28.jpg)
ViewModel
Controller
DBIC
Controller(s)
View(s)Model(s)
RootModule
Module Module
ModuleModule
. . .
Application Architecture:
Only one “Root” Module
…which is a Controller
![Page 29: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/29.jpg)
ViewModel
Controller
DBIC
Controller(s)
View(s)Model(s)
RootModule
Module Module
ModuleModule
Catalyst::Plugin::RapidApp
. . .
Application Architecture:
RapidApp extends Catalyst via the standard
plugin API
![Page 30: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/30.jpg)
Excitement for learning another DSL…
![Page 31: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/31.jpg)
ViewModel
Controller
DBIC
Controller(s)
View(s)Model(s)
RootModule
Module Module
ModuleModule
Catalyst::Plugin::RapidApp
. . .
Application Architecture:
automatically injects and configures modules and
components…
![Page 32: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/32.jpg)
ViewModel
Controller
DBIC
Controller(s)
View(s)Model(s)
RootModule
Module Module
ModuleModule
Catalyst::Plugin::RapidApp
Plugin Plugin Plugin
. . .
Application Architecture:
automatically injects and configures modules and
components…
![Page 33: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/33.jpg)
ViewModel
Controller
DBIC
Controller(s)
View(s)Model(s)
RootModule
Module Module
ModuleModule
Catalyst::Plugin::RapidApp
Plugin Plugin Plugin
. . .
Application Architecture:
loads and configures other plugins…
![Page 34: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/34.jpg)
ViewModel
Controller
DBIC
Controller(s)
View(s)Model(s)
RootModule
Module Module
ModuleModule
Catalyst::Plugin::RapidApp
Plugin Plugin Plugin
Plugin
. . .
Application Architecture:
loads and configures other plugins…
![Page 35: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/35.jpg)
DBIC
Controller(s)
View(s)Model(s)
RootModule
Module Module
ModuleModule
Catalyst::Plugin::RapidApp
Plugin Plugin Plugin
Plugin
Plugin
. . .
. . .
More Declarativ
e
Application Architecture:
+More
Specialized
![Page 36: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/36.jpg)
DBIC
Controller(s)
View(s)Model(s)
RootModule
Module Module
ModuleModule
Catalyst::Plugin::RapidApp
Plugin Plugin Plugin
Plugin
Plugin
. . .
. . .
More Declarativ
e
Application Architecture:
+More
Specialized
![Page 37: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/37.jpg)
Plugin
Application Architecture:
DBIC
Controller(s)
View(s)Model(s)
RootModule
Module Module
ModuleModule
Catalyst::Plugin::RapidApp
Plugin Plugin Plugin
Plugin
. . .
Controller
Module
![Page 38: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/38.jpg)
Ok… so, show us some code!
![Page 39: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/39.jpg)
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)
![Page 40: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/40.jpg)
Our task:
• Create a web-based admin app to manage MyDNS
![Page 41: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/41.jpg)
MyDNS Schema
![Page 42: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/42.jpg)
MyDNS Schema
![Page 43: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/43.jpg)
(demo)
![Page 44: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/44.jpg)
Demo checklist (RA::MyDNS) - 1
cpanm RapidAppExplain + bootstrap with rapidapp.pl
Run app (1):Explain navtree + tab panelShow that URLs are all RESTfulShow gridsPaging, sorting, items p/pg, query timeColumns, show/hide, reorder, auto-sizeRow page (double-click)FiltersQuick SearchRelationship columnsCSV export
Configure app (1):Show main app class, model & generated schema classesExplain grid_params & TableSpecsenable editing
Run app (2):Edit in grid, page & edit formDelete: single, multipleBatch ModifyAdd rr w/ existing, then new soa
Configure app (2):Set display_column (Soa/origin)
Run app (3):Reload tabShow zone rel w/ edit
Demo checklist (RA::MyDNS) - 2
![Page 45: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/45.jpg)
Demo checklist (RA::MyDNS) - 3
Configure app (3):Create ‘Type’ ResultSource::View
Run app (4):Show new Type gridWith 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 passwordShow Sessions grid
Configure app (7):Add NavCore plugin
Run app (8):Create a saved viewOrganize NavtreeSet a default source view
Demo checklist (RA::MyDNS) - 4
![Page 46: RapidApp - YAPC::NA 2014](https://reader034.fdocuments.in/reader034/viewer/2022051323/5482b5cfb4af9f6d148b464f/html5/thumbnails/46.jpg)
Demo BlueBox checklist
Explain AngleHack + BlueBoxgit clone BlueBox repo
Run app:Show public demo (newman)Login and show admin sectionShow editing template pages
nested templates*.md templates
Show order_list pageview page sourceexplain iframe
Configure app:Show codeExplain main class cnf optsExplain Template Access class
Explain Chinook Demo (already on site)git clone RA-ChinookDemo repocheckout complex_rels branchShow HEAD commit in github
Run app:Show Album single-relsShow Artist single-rel (self_titled_album)Show MediaType multi-rel (rock_tracks)
Demo RA-ChinookDemo checklist