Web App Frameworks aka The Luke and Josh Variety Hour.

28
Web App Frameworks aka The Luke and Josh Variety Hour

Transcript of Web App Frameworks aka The Luke and Josh Variety Hour.

Page 1: Web App Frameworks aka The Luke and Josh Variety Hour.

Web App Frameworks

aka The Luke and Josh Variety Hour

Page 2: Web App Frameworks aka The Luke and Josh Variety Hour.

servlets are terrible

• Way too many System.out.println’s

• Tightly coupled

• Umm... sessions

• The ultimate DIY

Page 3: Web App Frameworks aka The Luke and Josh Variety Hour.

web frameworks are cool

• Fewer System.out.println’s

• Hide the gross stuff (sessions...)

• Lots of free stuff

• Steep learning curve :(

Page 4: Web App Frameworks aka The Luke and Josh Variety Hour.

the basics

• Model (the stuff)

• View (the pretty face)

• Controller (the middleman)

Page 5: Web App Frameworks aka The Luke and Josh Variety Hour.

model (the stuff)

• Persistent data

• Trucks, POs, etc.

Page 6: Web App Frameworks aka The Luke and Josh Variety Hour.

controller (the middleman)

• Pull data / I can has trucks?

• Push data / save the truck’s state

Page 7: Web App Frameworks aka The Luke and Josh Variety Hour.

view (the pretty face)

• Show the trucks

• Edit the trucks

Page 8: Web App Frameworks aka The Luke and Josh Variety Hour.

Seam

It’s pretty cool I guess

Page 9: Web App Frameworks aka The Luke and Josh Variety Hour.

seam model

• Model = Java object + annotations

• Truck.java

Page 10: Web App Frameworks aka The Luke and Josh Variety Hour.

seam controller

• Controller = Java object + annotations

• YardController.java

Page 11: Web App Frameworks aka The Luke and Josh Variety Hour.

seam view

• View = XHTML

• trucks.xhtml

Page 12: Web App Frameworks aka The Luke and Josh Variety Hour.

Ruby on Rails

Why it is Always the Right Answer

Page 13: Web App Frameworks aka The Luke and Josh Variety Hour.

rails

• “Web development that doesn’t hurt.”

• Based very strongly on the Ruby scripting language

• Heavily Object-Oriented

• Dynamic type

• Basically, it’s scripting for the web.

• Well-developed programming paradigm

• Huge community support and documentation

Page 14: Web App Frameworks aka The Luke and Josh Variety Hour.

paradigm

• RESTful design

• REpresentative State Transfer

• Designs data control into the four natural states of HTTP communication

• Not specific to Rails, just the adopted paradigm

• States: The CRUD Model

UD

• CRUD

• POST

• Create

• GET

• Read

• PUT

• Update/Create

• DELETE

• Delete

• HTTP

• CRUD

• POST

• Create

• GET

• Read

• PUT

• Update/Create

• DELETE

• Delete

• HTTP

• CRUD

• POST

• Create

• GET

• Read

• PUT

• Update/Create

• DELETE

• Delete

HTTP CRUD

POST Create

GET Read

PUT Update/Create

DELETE Delete

Page 15: Web App Frameworks aka The Luke and Josh Variety Hour.

paradigm

• Reasons for RESTful design

• Clean, meaningful organization

• Organized by action

• Concise way of sending data

• Improves consistency and data integrity

• Simplified interface design

• Three components

• View data

• Create new entry

• Edit existing entry

HTTP CRUD

POST Create

GET Read

PUT Update/Create

DELETE Delete

Page 16: Web App Frameworks aka The Luke and Josh Variety Hour.

design

• How It Looks: an MVC example

• The Model, Part I

Page 17: Web App Frameworks aka The Luke and Josh Variety Hour.

design

• The Model, Part II

Page 18: Web App Frameworks aka The Luke and Josh Variety Hour.

design

• The Views

Page 19: Web App Frameworks aka The Luke and Josh Variety Hour.

design

• The Views: Partials

Page 20: Web App Frameworks aka The Luke and Josh Variety Hour.

design

• The Views: New

Page 21: Web App Frameworks aka The Luke and Josh Variety Hour.

design

• The Controller: Part 1

Page 22: Web App Frameworks aka The Luke and Josh Variety Hour.

design

• The Controller: Part 2

Page 23: Web App Frameworks aka The Luke and Josh Variety Hour.

why rails is better

• Single-Source Solution… mostly

• Install Ruby and RoR and you’re ready to start.

• The total MVC solution is wrapped up in Rails, no need for:

• JBoss framework

• Seam

• Hibernate

• JSF

• Richfaces

• This includes JavaScript/AJAX functionality. All Ruby code which is

rendered to HTML/Javascript later.

Page 24: Web App Frameworks aka The Luke and Josh Variety Hour.

why rails is better

• Integration across platform much smoother, all Ruby/Rails code, no need for other layers.

• Because of this, it’s faster.

• More control over finer details of:

• Server environment

• Development or Production

• Database setup – lots of options

• Optimization – lots of opportunities for this

• Large number of plugins

• Can get a bit over-the-top if not careful.

Page 25: Web App Frameworks aka The Luke and Josh Variety Hour.

downfalls• Still gaining adoption on a large scale

• Very strict definitions (namely database naming conventions)

• A bad thing?

• Optimization is not automatic, programmer needs to do a lot to optimize

• Takes smart programming to gain in efficiency

• A bad thing?

• Not as many sweet built-in GUI features

Page 26: Web App Frameworks aka The Luke and Josh Variety Hour.

Last Word

Use Ruby on Rails... it’s amazing

Page 27: Web App Frameworks aka The Luke and Josh Variety Hour.

Questions?

Page 28: Web App Frameworks aka The Luke and Josh Variety Hour.

references• http://www.seamframework.org/Documentation/GettingStarted

• http://livedemo.exadel.com/richfaces-demo/richfaces/message.jsf?s=glassX

• http://www.infoq.com/articles/jboss-seam

• http://rubyonrails.org/- Ruby on Rails site

• http://www.railsbrain.com/ - Rails documentation

• http://railscasts.com/ - Rails Tutorials via Screencast

• http://railsforum.com/ - Rails help / discussion forum