Download pptx - Web App Frameworks

Transcript
Page 1: Web App Frameworks

Web App Frameworksaka The Luke and Josh Variety Hour

Page 2: Web App Frameworks

servlets are terrible• Way too many System.out.println’s

• Tightly coupled

• Umm... sessions

• The ultimate DIY

Page 3: Web App Frameworks

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

the basics• Model (the stuff)

• View (the pretty face)

• Controller (the middleman)

Page 5: Web App Frameworks

model (the stuff)• Persistent data

• Trucks, POs, etc.

Page 6: Web App Frameworks

controller (the middleman)• Pull data / I can has trucks?

• Push data / save the truck’s state

Page 7: Web App Frameworks

view (the pretty face)• Show the trucks

• Edit the trucks

Page 8: Web App Frameworks

SeamIt’s pretty cool I guess

Page 9: Web App Frameworks

seam model• Model = Java object + annotations

• Truck.java

Page 10: Web App Frameworks

seam controller• Controller = Java object + annotations

• YardController.java

Page 11: Web App Frameworks

seam view• View = XHTML

• trucks.xhtml

Page 12: Web App Frameworks

Ruby on RailsWhy it is Always the Right Answer

Page 13: Web App Frameworks

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

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 CRUDPOST CreateGET ReadPUT Update/CreateDELETE Delete

Page 15: Web App Frameworks

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 CRUDPOST CreateGET ReadPUT Update/CreateDELETE Delete

Page 16: Web App Frameworks

design• How It Looks: an MVC example

• The Model, Part I

Page 17: Web App Frameworks

design• The Model, Part II

Page 18: Web App Frameworks

design• The Views

Page 19: Web App Frameworks

design• The Views: Partials

Page 20: Web App Frameworks

design• The Views: New

Page 21: Web App Frameworks

design• The Controller: Part 1

Page 22: Web App Frameworks

design• The Controller: Part 2

Page 23: Web App Frameworks

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

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

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

Last WordUse Ruby on Rails... it’s amazing

Page 27: Web App Frameworks

Questions?

Page 28: Web App Frameworks

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