Data Intensive RIAs on Rails with very little code (Netzke)

Preview:

DESCRIPTION

Netzke presentation done at OCRuby 1/31/2013

Citation preview

Data intensive RIAs on Rails with very little code

Forrest changOCruby 1/31/2013

Friday, February 1, 2013

Question(1 of many)

Friday, February 1, 2013

Who works with Rails?

Friday, February 1, 2013

Why do you love rails?

Friday, February 1, 2013

improving web development

Friday, February 1, 2013

improving web development

• Fast

Friday, February 1, 2013

improving web development

• Fast• Fun

Friday, February 1, 2013

improving web development

• Fast• Fun• Easy

Friday, February 1, 2013

Some things Rails provides

Friday, February 1, 2013

Some things Rails provides

• Structure (You know where things go/are)

Friday, February 1, 2013

Some things Rails provides

• Structure (You know where things go/are)• MVC

Friday, February 1, 2013

Some things Rails provides

• Structure (You know where things go/are)• MVC• File structure

Friday, February 1, 2013

Some things Rails provides

• Structure (You know where things go/are)• MVC• File structure

• Declarative DSL/State what you mean

Friday, February 1, 2013

Some things Rails provides

• Structure (You know where things go/are)• MVC• File structure

• Declarative DSL/State what you mean• Generators

Friday, February 1, 2013

What kinds of apps do you make with

Rails?

Friday, February 1, 2013

how about these kinds of apps

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

data rich

Friday, February 1, 2013

Data rich apps

Friday, February 1, 2013

• Data management

Data rich apps

Friday, February 1, 2013

• Data management• Complex GUI

Data rich apps

Friday, February 1, 2013

• Data management• Complex GUI• Complex data and flows

Data rich apps

Friday, February 1, 2013

Rich internet application

Friday, February 1, 2013

Rich internet application

• AJAX

Friday, February 1, 2013

Rich internet application

• AJAX• Single page

Friday, February 1, 2013

Rich internet application

• AJAX• Single page• Desktop app like apps

Friday, February 1, 2013

Friday, February 1, 2013

how would you use rails do make the

following?

Friday, February 1, 2013

Friday, February 1, 2013

Some things Rails provides (revisited)

• Structure (You know where things go/are)• MVC• File structure

• Declarative/State what you mean• Generators

Friday, February 1, 2013

Friday, February 1, 2013

Controller

Friday, February 1, 2013

Controller Controller

Friday, February 1, 2013

Controller Controller Controller

Friday, February 1, 2013

Controller Controller Controller

Controller

Friday, February 1, 2013

Controller Controller Controller

Controller

ControllerFriday, February 1, 2013

Controller Controller Controller

Controller

Controller

Controller

Friday, February 1, 2013

Controller Controller Controller

Controller

Controller

Controller

Model

Friday, February 1, 2013

Controller Controller Controller

Controller

Controller

Controller

Model Model

Friday, February 1, 2013

Controller Controller Controller

Controller

Controller

Controller

Model Model

Model

Friday, February 1, 2013

Controller Controller Controller

Controller

Controller

Controller

Model Model

Model

Partial

Friday, February 1, 2013

Controller Controller Controller

Controller

Controller

Controller

Model Model

Model

Partial

Partial

Friday, February 1, 2013

Controller Controller Controller

Controller

Controller

Controller

Model Model

Model

Partial

Partial Partial

Friday, February 1, 2013

Controller Controller Controller

Controller

Controller

Controller

Model Model

Model

Partial

Partial Partial

Partial

Friday, February 1, 2013

Controller Controller Controller

Controller

Controller

Controller

Model Model

Model

Partial

Partial Partial

PartialPartial

Friday, February 1, 2013

Controller Controller Controller

Controller

Controller

Controller

Model Model

Model

Partial

Partial Partial

PartialPartial

AJAX

Friday, February 1, 2013

Controller Controller Controller

Controller

Controller

Controller

Model Model

Model

Partial

Partial Partial

PartialPartial

AJAXAJAX

Friday, February 1, 2013

Controller Controller Controller

Controller

Controller

Controller

Model Model

Model

Partial

Partial Partial

PartialPartial

AJAXAJAX

AJAX

Friday, February 1, 2013

Controller Controller Controller

Controller

Controller

Controller

Model Model

Model

Partial

Partial Partial

PartialPartial

AJAXAJAX

AJAX AJAX

Friday, February 1, 2013

Controller Controller Controller

Controller

Controller

Controller

Model Model

Model

Partial

Partial Partial

PartialPartial

AJAXAJAX

AJAX AJAX

AJAX

Friday, February 1, 2013

Controller Controller Controller

Controller

Controller

Controller

Model Model

Model

Partial

Partial Partial

PartialPartial

AJAXAJAX

AJAX AJAX

AJAX

AJAX

Friday, February 1, 2013

etc.

Friday, February 1, 2013

but wait, there’s more!

Friday, February 1, 2013

single page app

Friday, February 1, 2013

single page app

• Structure• Backbone• Ember• etc.?

• Widgets• Libraries• etc.

Friday, February 1, 2013

Friday, February 1, 2013

What if you could do it in just a few

lines?

Friday, February 1, 2013

netzke

Friday, February 1, 2013

netzke?

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Kudos from Matz!

Friday, February 1, 2013

Kudos from Matz!

Good stuff

Friday, February 1, 2013

Kudos from Matz!

Good stuff

Netzke FTW!

Friday, February 1, 2013

Netzke: a DSL to write gui web components

Friday, February 1, 2013

netzke = Rails + ext js

Friday, February 1, 2013

Friday, February 1, 2013

extjs

Friday, February 1, 2013

extjs

• Hundreds of components

Friday, February 1, 2013

extjs

• Hundreds of components• Component based architecture

Friday, February 1, 2013

extjs

• Hundreds of components• Component based architecture• Well documented

Friday, February 1, 2013

extjs

• Hundreds of components• Component based architecture• Well documented• Active community

Friday, February 1, 2013

extjs

• Hundreds of components• Component based architecture• Well documented• Active community• Maintained by a company

Friday, February 1, 2013

extjs

• Hundreds of components• Component based architecture• Well documented• Active community• Maintained by a company• Dual License

Friday, February 1, 2013

extjs

• Hundreds of components• Component based architecture• Well documented• Active community• Maintained by a company• Dual License

• GPL

Friday, February 1, 2013

extjs

• Hundreds of components• Component based architecture• Well documented• Active community• Maintained by a company• Dual License

• GPL• Commercial

Friday, February 1, 2013

EXTJS

Y U NO HAVE FREE, PERMISSIVE LICENSE!

Friday, February 1, 2013

Friday, February 1, 2013

PROBABLY WORTH IT IF YOU NEED A

DATA RICH RIA

Friday, February 1, 2013

Ext JS?

Friday, February 1, 2013

Ext JS?

• Best RIA framework (cuz it’s pay and it’s all they do, next best is far from it)

Friday, February 1, 2013

Ext JS?

• Best RIA framework (cuz it’s pay and it’s all they do, next best is far from it)

• Cross platform

Friday, February 1, 2013

Ext JS?

• Best RIA framework (cuz it’s pay and it’s all they do, next best is far from it)

• Cross platform• Examples and documentation

Friday, February 1, 2013

Ext JS?

• Best RIA framework (cuz it’s pay and it’s all they do, next best is far from it)

• Cross platform• Examples and documentation• Maintained by company/support/

training

Friday, February 1, 2013

Missing

Friday, February 1, 2013

Missing

• Seamless service side bindings (you do it yourself)

Friday, February 1, 2013

Missing

• Seamless service side bindings (you do it yourself)

• Server driven configuration (you do both sides driving however you want)

Friday, February 1, 2013

ExtJS: Component based framework

Friday, February 1, 2013

ExtJS: Component based framework

• Reusability

Friday, February 1, 2013

ExtJS: Component based framework

• Reusability• Extensibility

Friday, February 1, 2013

ExtJS: Component based framework

• Reusability• Extensibility• Compose-ability

Friday, February 1, 2013

ExtJS: Component based framework

• Reusability• Extensibility• Compose-ability• Events

Friday, February 1, 2013

ExtJS: Front end focused

Friday, February 1, 2013

Benefits of Starting From the Server

Friday, February 1, 2013

Benefits of Starting From the Server

• Authentication/Authorization

Friday, February 1, 2013

Benefits of Starting From the Server

• Authentication/Authorization• Data

Friday, February 1, 2013

Benefits of Starting From the Server

• Authentication/Authorization• Data• Business Logic

Friday, February 1, 2013

Benefits of Starting From the Server

• Authentication/Authorization• Data• Business Logic• Ruby

Friday, February 1, 2013

netzke

Friday, February 1, 2013

netzke

• Rails + Ext JS

Friday, February 1, 2013

netzke

• Rails + Ext JS• Server and client working together

seamlessly

Friday, February 1, 2013

netzke

• Rails + Ext JS• Server and client working together

seamlessly• and easily

Friday, February 1, 2013

client + server = WIN!

Friday, February 1, 2013

client + server = WIN!

• Single point of configuration

Friday, February 1, 2013

client + server = WIN!

• Single point of configuration• Testability

Friday, February 1, 2013

client + server = WIN!

• Single point of configuration• Testability• Resuability

Friday, February 1, 2013

client + server = WIN!

• Single point of configuration• Testability• Resuability• Code encapsulation

Friday, February 1, 2013

A netzke component is a ruby class represented

by an ext js component in the browser

Friday, February 1, 2013

Ruby class responsibilities

• Generate Ext JS counterpart (client class)

• Configure it’s client class instance• Run any server side logic• Handle nesting, dynamic loading, etc.

Friday, February 1, 2013

Netzke component

Ruby class:class SimpleComponent < Netzke::Base

end

and it’s corresponding JS classExt.define(‘Netzke.classes.SimpleComponent’, {

// ...

});

Friday, February 1, 2013

some netzke features

Friday, February 1, 2013

client server interaction

Friday, February 1, 2013

nesting

Friday, February 1, 2013

inheritance

Friday, February 1, 2013

Customization

Customize nearly everything

Friday, February 1, 2013

<RANT>

Friday, February 1, 2013

Hate “write it yourself scratch”

• GUI items via HTML• Markup• Style

Friday, February 1, 2013

Hate the front/backend duplications

• Models on both ends• Logic on both ends

Friday, February 1, 2013

In Netzke, Single Point of

configuration

Friday, February 1, 2013

</RANT>

Friday, February 1, 2013

Rails setup

Friday, February 1, 2013

Rails setup

• Copy extjs lib to public/extjs

Friday, February 1, 2013

Rails setup

• Copy extjs lib to public/extjs• Copy famfamfam_silk_icons to images/icons (optional)

Friday, February 1, 2013

Rails setup

• Copy extjs lib to public/extjs• Copy famfamfam_silk_icons to images/icons (optional)• Gemfilegem ‘netzke-core’ # presently point to github

gem ‘netzke-basepack’

Friday, February 1, 2013

Rails setup

• Copy extjs lib to public/extjs• Copy famfamfam_silk_icons to images/icons (optional)• Gemfilegem ‘netzke-core’ # presently point to github

gem ‘netzke-basepack’

• add to routes.rbnetzke # all data and dynamic loading routes

Friday, February 1, 2013

Rails setup

• Copy extjs lib to public/extjs• Copy famfamfam_silk_icons to images/icons (optional)• Gemfilegem ‘netzke-core’ # presently point to github

gem ‘netzke-basepack’

• add to routes.rbnetzke # all data and dynamic loading routes

• Add to header of the appropriate layout<%= csrf_meta_tag %>

<%= load_netzke %>

Friday, February 1, 2013

why netzke?

Friday, February 1, 2013

why netzke?

• Clean client (Ext JS)/server (Rails) integration

Friday, February 1, 2013

why netzke?

• Clean client (Ext JS)/server (Rails) integration

• Built in components that understand Rails

Friday, February 1, 2013

why netzke?

• Clean client (Ext JS)/server (Rails) integration

• Built in components that understand Rails

• Easy to compose and reuse components

Friday, February 1, 2013

why netzke?

• Clean client (Ext JS)/server (Rails) integration

• Built in components that understand Rails

• Easy to compose and reuse components• Stop writing everything from scratch on

both front and back ends

Friday, February 1, 2013

instead of canned examples...

Friday, February 1, 2013

My App

Friday, February 1, 2013

Audit Log Archive App

• Audit Log data for our Salesforce.com instance taking up all our space, so need to archive it, but still get access off line

• Salesforce.com database, i.e. legacy

Friday, February 1, 2013

APP WALK THROUGH

Friday, February 1, 2013

screen by screen code

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

Friday, February 1, 2013

That’s all the code!

Friday, February 1, 2013

Netzke showcaseapps

(i.e. examples)

Friday, February 1, 2013

http://yanit.heroku.com/

Friday, February 1, 2013

http://netzke-demo.herokuapp.com/

Friday, February 1, 2013

http://netzke-desktop-demo.heroku.com/

Friday, February 1, 2013

Benefits

Friday, February 1, 2013

Benefits

• Server multiplexing

Friday, February 1, 2013

Benefits

• Server multiplexing• Reusable components - OO coding

Friday, February 1, 2013

Benefits

• Server multiplexing• Reusable components - OO coding• The power of Ext JS

Friday, February 1, 2013

Benefits

• Server multiplexing• Reusable components - OO coding• The power of Ext JS• Dynamic Loading

Friday, February 1, 2013

Benefits

• Server multiplexing• Reusable components - OO coding• The power of Ext JS• Dynamic Loading• Quick Development

Friday, February 1, 2013

Benefits

• Server multiplexing• Reusable components - OO coding• The power of Ext JS• Dynamic Loading• Quick Development• Easy to code if your needs match the

examples

Friday, February 1, 2013

Drawbacks

Friday, February 1, 2013

Drawbacks

• ExtJS License (YMMV)

Friday, February 1, 2013

Drawbacks

• ExtJS License (YMMV)• Netzke documentation good but sometimes stuff

missing

Friday, February 1, 2013

Drawbacks

• ExtJS License (YMMV)• Netzke documentation good but sometimes stuff

missing• Needs to know Ext JS for certain parts

Friday, February 1, 2013

Drawbacks

• ExtJS License (YMMV)• Netzke documentation good but sometimes stuff

missing• Needs to know Ext JS for certain parts• Needs ActiveRecordSession store, session hungry

Friday, February 1, 2013

Drawbacks

• ExtJS License (YMMV)• Netzke documentation good but sometimes stuff

missing• Needs to know Ext JS for certain parts• Needs ActiveRecordSession store, session hungry• I don’t know how to TDD/unit test these yet

Friday, February 1, 2013

Drawbacks

• ExtJS License (YMMV)• Netzke documentation good but sometimes stuff

missing• Needs to know Ext JS for certain parts• Needs ActiveRecordSession store, session hungry• I don’t know how to TDD/unit test these yet• Caching can bite you during development

Friday, February 1, 2013

Drawbacks

• ExtJS License (YMMV)• Netzke documentation good but sometimes stuff

missing• Needs to know Ext JS for certain parts• Needs ActiveRecordSession store, session hungry• I don’t know how to TDD/unit test these yet• Caching can bite you during development• Easy to code if your needs match the examples

Friday, February 1, 2013

CONCLUSION

Friday, February 1, 2013

CONCLUSION

• Netzke awesome for Data Rich RIA’s

Friday, February 1, 2013

CONCLUSION

• Netzke awesome for Data Rich RIA’s• Focus on what you want to solve not

the details

Friday, February 1, 2013

CONCLUSION

• Netzke awesome for Data Rich RIA’s• Focus on what you want to solve not

the details• Ruby to write frontend

Friday, February 1, 2013

CONCLUSION

• Netzke awesome for Data Rich RIA’s• Focus on what you want to solve not

the details• Ruby to write frontend• General happiness all around

Friday, February 1, 2013

Resources

• http://netzke.org• showcase apps• https://groups.google.com/group/

netzke• http://writelesscode.com• @netzke• I will blog about how to write ALAA

Friday, February 1, 2013

Credit to @nomadcoder

• For writing @netzke (awesome!)• For material from his slides, which I

liberally borrowed

Friday, February 1, 2013

Friday, February 1, 2013