JavaTWO專業技術大會<br />
Play!Framework for JavaEE Developers<br />
Who am I<br />Exp : JSP/Servlet , Tapestry , Spring/Hibernate/JavaEE , Wicket , Android , Grails , Play! Framework<br />ht...
Web Framework Experiences<br /><ul><li>JSP/Servlet
Too old , cumbersome
 Tapestry (old experience, T5 is very good)
Complicated , evolution/deprecation too fast
 Wicket
Too elaborate , fail to see the wood for the trees
May lead to over-engineered architecture for OO-purism
Spend too much time refactoring
Maybe web component reuse is just a myth
Grails (old experience, without Groovy++)
Slow
Too many inconsistent DSLs (URL-mapping , DB , logging...)
Not Java , IDE unfriendly</li></li></ul><li>Conventional JavaEE Stack<br />
Conventional JavaEE Stack<br /><ul><li>Want standard page ?
Let's define JSP/JSTL (JSR-53)
And let Apache (or others) to implement Jakata Taglibs
 Want web components ?
Let's define Java Server Faces (JSR-127)
And let communities to implement MyFaces, PrimeFaces, ICEfaces...
Want restful ?
Let's define JAX-RS (JSR-311)
And let communities to implement CXF, Jersey, RESTEasy, Wink...</li></li></ul><li>Conventional JavaEE Stack<br /><ul><li>L...
Specs
Implementations
Configurations
Tedious , Error-prone
Unless you use a full-fledged JavaEE Server (Glassfish or WebLogic ...)
Layered
Defined by Standards/Specs
Assembled by Interfaces</li></ul>OVER ARCHITECTED<br />
Play’s App Looks Like ?<br />conf/routes<br />app/App.java<br />GET    /hello    App.hello<br />public class App extends C...
And Play is ...<br /><ul><li>A full stack framework (platform)
Totally independent of JavaEE environment
RESTful
No session
Stateless
Pure server side
Similar to Rails / Django
Rich domain model
Unlike JavaEE's anemic domain model</li></li></ul><li>Full Stack Framework?<br /><ul><li>Bundles compiler , embedded serve...
Can be packaged as a WAR and deployed to servlet containers</li></li></ul><li>Play! A Glued Pure Web Framework<br />Shallo...
Play! URLs are RESTful & SEO-friendly<br />UGLY<br />GRACEFUL<br /><ul><li>/car/1
/listcar/page1/count10
/listcar/page1?count=10
/listcar/page/1/count/10
/car.jsp?id=1
/listcars.jsp?page=1&count=10
http://www.facebook.com/ photo.php? fbid=2121715487568& set=o.172881386106136& type=1&theater</li></li></ul><li>Play is no...
Use HttpSessionListener to count sessions (online users)
ServletFilter
Servlet-related securities
 @ServletSecurity
 <auth-constraint /> , <security-role /></li></li></ul><li>Play! is Stateless<br /><ul><li>Play! shares nothing between ea...
The most important feature you have to keep in mind
No session!
Session is the source of all problems of the JavaEE platform!
Session replication 
Upcoming SlideShare
Loading in...5
×

Play! Framework for JavaEE Developers

19,833

Published on

Play! Framework for JavaEE Developers
Presented in JavaTWO Taiwan @ Jul 29,2011

Published in: Technology, Education
2 Comments
36 Likes
Statistics
Notes
No Downloads
Views
Total Views
19,833
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
589
Comments
2
Likes
36
Embeds 0
No embeds

No notes for slide

Play! Framework for JavaEE Developers

  1. 1. JavaTWO專業技術大會<br />
  2. 2. Play!Framework for JavaEE Developers<br />
  3. 3. Who am I<br />Exp : JSP/Servlet , Tapestry , Spring/Hibernate/JavaEE , Wicket , Android , Grails , Play! Framework<br />http://gplus.to/smallufo<br />http://twitter.com/smallufo<br />smallufo@gmail.com<br />
  4. 4. Web Framework Experiences<br /><ul><li>JSP/Servlet
  5. 5. Too old , cumbersome
  6. 6.  Tapestry (old experience, T5 is very good)
  7. 7. Complicated , evolution/deprecation too fast
  8. 8.  Wicket
  9. 9. Too elaborate , fail to see the wood for the trees
  10. 10. May lead to over-engineered architecture for OO-purism
  11. 11. Spend too much time refactoring
  12. 12. Maybe web component reuse is just a myth
  13. 13. Grails (old experience, without Groovy++)
  14. 14. Slow
  15. 15. Too many inconsistent DSLs (URL-mapping , DB , logging...)
  16. 16. Not Java , IDE unfriendly</li></li></ul><li>Conventional JavaEE Stack<br />
  17. 17. Conventional JavaEE Stack<br /><ul><li>Want standard page ?
  18. 18. Let's define JSP/JSTL (JSR-53)
  19. 19. And let Apache (or others) to implement Jakata Taglibs
  20. 20.  Want web components ?
  21. 21. Let's define Java Server Faces (JSR-127)
  22. 22. And let communities to implement MyFaces, PrimeFaces, ICEfaces...
  23. 23. Want restful ?
  24. 24. Let's define JAX-RS (JSR-311)
  25. 25. And let communities to implement CXF, Jersey, RESTEasy, Wink...</li></li></ul><li>Conventional JavaEE Stack<br /><ul><li>Lots of ...
  26. 26. Specs
  27. 27. Implementations
  28. 28. Configurations
  29. 29. Tedious , Error-prone
  30. 30. Unless you use a full-fledged JavaEE Server (Glassfish or WebLogic ...)
  31. 31. Layered
  32. 32. Defined by Standards/Specs
  33. 33. Assembled by Interfaces</li></ul>OVER ARCHITECTED<br />
  34. 34.
  35. 35. Play’s App Looks Like ?<br />conf/routes<br />app/App.java<br />GET /hello App.hello<br />public class App extends Controller {<br /> public static void hello() {<br /> User user = User.findById(1L);<br /> render(user);<br /> }<br />} <br />views/App/hello.html<br />Hello World : ${user.name}<br />http://localhost:9000/hello<br />
  36. 36. And Play is ...<br /><ul><li>A full stack framework (platform)
  37. 37. Totally independent of JavaEE environment
  38. 38. RESTful
  39. 39. No session
  40. 40. Stateless
  41. 41. Pure server side
  42. 42. Similar to Rails / Django
  43. 43. Rich domain model
  44. 44. Unlike JavaEE's anemic domain model</li></li></ul><li>Full Stack Framework?<br /><ul><li>Bundles compiler , embedded server , hibernate , logger , test runner , email , groovy template engine, scala...
  45. 45. Can be packaged as a WAR and deployed to servlet containers</li></li></ul><li>Play! A Glued Pure Web Framework<br />Shallow!<br />Most libs are directly <br />exposed to Play! & replaceable<br />Where Magic Happens<br />
  46. 46. Play! URLs are RESTful & SEO-friendly<br />UGLY<br />GRACEFUL<br /><ul><li>/car/1
  47. 47. /listcar/page1/count10
  48. 48. /listcar/page1?count=10
  49. 49. /listcar/page/1/count/10
  50. 50. /car.jsp?id=1
  51. 51. /listcars.jsp?page=1&count=10
  52. 52. http://www.facebook.com/ photo.php? fbid=2121715487568& set=o.172881386106136& type=1&theater</li></li></ul><li>Play is not based on Servlet<br />Many java server side frameworks (Spring MVC / Struts / Wicket / JSF / Tapestry ...) are based on servlets, but Play! is not!<br />You cannot do such things :<br /><ul><li>session.setAttribute("user" , user); 
  53. 53. Use HttpSessionListener to count sessions (online users)
  54. 54. ServletFilter
  55. 55. Servlet-related securities
  56. 56.  @ServletSecurity
  57. 57.  <auth-constraint /> , <security-role /></li></li></ul><li>Play! is Stateless<br /><ul><li>Play! shares nothing between each request!
  58. 58. The most important feature you have to keep in mind
  59. 59. No session!
  60. 60. Session is the source of all problems of the JavaEE platform!
  61. 61. Session replication 
  62. 62. Sticky session
  63. 63. Play uses (delegates to) memcached to eliminates such headaches</li></li></ul><li>Play's Informative Error Page<br />
  64. 64. Play's Domain Objects Are Rich<br />Play<br />*Spring promoted JavaEE<br />User extends Model<br />User extends Object<br />UserDao.java<br /><ul><li>save(User u)</li></ul>User u = new User(...)<br />u.save()<br />UserDaoImpl implements UserDao<br /><ul><li>void setEntityManager(...)
  65. 65. save(User u)</li></ul>Client.java<br />@Inject UserDao userDao<br />User u = new User(...)<br />userDao.save(u)<br />VS<br />*JPA advocates eliminating the DAO layer<br />
  66. 66. Play's Architecture<br />$ play new myproj<br />myproj<br />app<br />controllers<br />models<br />conf<br />application.conf<br />views<br />messages<br />lib<br />foo<br />routes<br />modules<br />bar<br />public<br />images<br />javascripts<br />src<br />stylesheets<br />
  67. 67. conf/application.conf<br />application.name=myapp<br />application.mode=dev<br />application.secret=OOXXOOXXOOXXOOXXOOXX<br />http.port=9000<br />java.source=1.6<br />db.url=jdbc:mysql:...<br />db.driver=com.mysql.jdbc.Driver<br />db.user=user<br />db.pass=pass<br />hibernate.use_sql_comments=true<br />hibernate.format_sql = true<br />XForwardedSupport=127.0.0.1<br />
  68. 68. Play's Architecture<br />controllers<br />app<br />MyController.java<br />public static void index()<br />public static void show()<br />models<br />views<br />MyController<br />index.html<br />foo<br />show.html<br />bar<br />
  69. 69. conf/routes<br />HTTP method<br />URI Pattern<br />Action<br />GET    /                      App.index<br />POST   /login                 App.login<br />GET    /tag/{name}            App.tag(name)<br />GET    /list/{page}           App.list(page)<br />GET    /list/{<[0-9]+>page}   App.list(page)<br />GET    /list/{page}/{count}   App.list(page,count)<br />GET    /public/               staticDir:public<br />*      /{controller}/{action} {controller}.{action}<br />
  70. 70. Play's Request Life Cycle<br />
  71. 71. Controllers and Redirections<br />public class App extends play.mvc.Controller {<br />  public static void index() {<br />    render(); // views/App/index.html contains a login form<br />  }<br />  public static void login(String name,String passwd) {<br />    if(...) // success<br />      welcome();<br />    else   // failed<br />      index();<br />  }<br />  public static void welcome() {<br />    render();  // renders views/App/welcome.html <br />  }<br />}<br />
  72. 72. Controller Interceptions<br />public class App extends play.mvc.Controller {<br />  @play.mvc.Before(unless={“index”, “login”})<br />  public static void intercept() {<br />    if (session.get("uid")==null) <br />      index();<br />  }<br />  public static void index() {...}<br />  public static void login(String name,Stringpasswd){..}<br />  public static void welcome() {...}<br />}<br />
  73. 73. Session : A Signed Cookie<br />public static void login(String name , String passwd) {<br />  User u = ...<br />  if (...) {<br />    session.put("uid" , u.id);<br />  }<br />}<br />Only put index data to session<br />Never store sensitive data<br />signed, <br />uneditable!<br />
  74. 74. Controller Revisited<br />public static void show(Long uid, String type) {<br />  User u = ...<br />  if (type.equals("json") {<br />    renderJSON(u);   // provided by GSON<br />  } <br />  else if (type.equals("xml") {<br />    renderXml(u);    // provided by XStream<br />  } <br />  <br />  render(u);  <br />}<br />Why not continue rendering?<br />play.mvc.Controller<br />throw new RenderJson(jsonString);<br />throw new RenderXml(xml);<br />throw new RenderTemplate(...);<br />
  75. 75. Controller and View<br />controllers/App.java<br />public static void showUser(Long uid) {<br />  User u = ...<br />  List<Car> cars = ...<br />  renderArgs.put("user",u);<br />  render(cars, company, job, ...);  <br />}<br />public static void showCar(Long id) {...}<br />renderArgs.put(“cars”,car);<br />renderArgs.put(“company”,company);<br />renderArgs.put(“job”,job);<br />same<br />views/App/showUser.html<br />Hello ${user.name} , these are your cars :<br />#{list items:cars , as:'car'}<br />  #{a @showCar(car.id)} ${car.name} #{/a}<br />#{/list}<br />template tag<br />@App.showCar(car.id)<br />
  76. 76. How objects are passed to View !?<br />controllers/App.java<br />public static void showUser(Long uid) {<br />  renderArgs.put("user",u);<br />  render(cars , ...);  <br />}<br />!!??<br />views/App/showUser.html<br />${user.name}<br />#{list items:cars , as:'car'}<br />Let's decompile it...<br />
  77. 77. public static void showUser(Long uid)<br />{<br />  play.classloading.enhancers.LocalvariablesNamesEnhancer.LocalVariablesNamesTracer.enter();<br />  play.classloading.enhancers.LocalvariablesNamesEnhancer.LocalVariablesNamesTracer.addVariable("uid", uid);<br />  if(!play.classloading.enhancers.ControllersEnhancer.ControllerInstrumentation.isActionCallAllowed())<br />  {<br />    Controller.redirect("controllers.App.showUser", new Object[] {<br />      uid<br />    });<br />  } else<br />  {<br />    play.classloading.enhancers.ControllersEnhancer.ControllerInstrumentation.stopActionCall();<br />    User u = (User)User.findById(uid);<br />    play.classloading.enhancers.LocalvariablesNamesEnhancer.LocalVariablesNamesTracer.addVariable("u", u);<br />    List cars = Car.all().fetch();<br />    play.classloading.enhancers.LocalvariablesNamesEnhancer.LocalVariablesNamesTracer.addVariable("cars", cars);<br />    Object obj = null;<br />    play.mvc.Scope.RenderArgs renderargs = null;<br />    renderargs = (play.mvc.Scope.RenderArgs)Java.invokeStatic(Desc.getType("Lplay/mvc/Scope$RenderArgs;"), "current");<br />    renderargs.put("user", u);<br />    render(new Object[] {<br />      cars<br />    });<br />  }<br />  break MISSING_BLOCK_LABEL_120;<br />  Exception exception;<br />  exception;<br />  Object obj1 = null;<br />  play.classloading.enhancers.LocalvariablesNamesEnhancer.LocalVariablesNamesTracer.exit();<br />  throw exception;<br />  Object obj2 = null;<br />  play.classloading.enhancers.LocalvariablesNamesEnhancer.LocalVariablesNamesTracer.exit();<br />  return;<br />}<br />
  78. 78. Who Modifies My Code !?<br />Who ?<br /><ul><li>Play's custom classloader & JDT & javassist</li></ul>When ?<br /><ul><li>DEV mode : When you modify the code and reload the page
  79. 79. PROD mode : App's start time</li></ul>How ?<br /><ul><li>At compile time , some classes are enhanced by play.classloading.enhancers.* (powered by javassist)
  80. 80. ContinuationEnhancer
  81. 81. ControllerEnhancer
  82. 82. PropertiesEnhancer
  83. 83. LocalvariablesNamesEnhancer, ...</li></ul>Impact ?<br /><ul><li>Rapid development time !</li></li></ul><li>View Template<br />object path<br />${objectname}<br />${object.property}<br />implicit objects<br />${params.userId}<br />${session.userId}<br />${request.userId}<br />built-in tags<br />#{if} ... #{/if} #{else}... #{/else}<br />#{list items:users , as:'user'}<br />  ${user.name}<br />#{/list}<br />#{a @App.showUser(user.id)} show user #{/a}<br />#{form @App.login() } ... #{/form}<br />
  84. 84. Rich Domain Object Model<br />package models;<br />@javax.persistence.Entity<br />public class User extends play.db.jpa.Model {<br />  public String username;<br />  public String password;<br />}<br />Support JPA's annotations : @Column , @ManyToOne , @OneToMany ...<br />NO more getters & setters... Great !<br />
  85. 85. Rich Domain Object Model<br />BUT...<br />The underlayer is hibernate & hibernate needs getter/setter<br />Again...<br />Who modifies my model ?<br />
  86. 86. Rich Domain Object Model<br />In Fact...<br />    Your model still contains getter/setter , modified by Play's custom classloader & JDT & javassist<br />User.java<br />public String getUsername() {<br />  return "overridden";<br />}<br />${user.username} will be ??<br />
  87. 87. Rich Domain Object<br />User u = User.findById(1);<br />User u = User.find("byUsernameAndPassword", username , password).first();<br />User u = User.find("select u from User u where u.username = :username and u.password = :password")<br />  .bind("username",username)<br />  .bind("password",password)<br />  .first();<br />List<User> users = User.all().fetch();<br />User.em().createQuery(...);<br />
  88. 88. Validations : Controller<br />#{form @App.login()}<br /> <p><br />username<br /> <input type=“text” name=“username” value=“${flash.username}” /><br /> <span class=“error”>#{error 'username'/}</span><br /> </p><br /> <p><br />password<br /> <input type=“password” name=“password” value=“${flash.password}” /><br /> <span class=“error”>#{error 'password'/}</span><br /> </p><br /> <input type="submit" value=“Login" /><br /> <span class=“error”>#{error ‘other'/}</span><br />#{/form}<br />username<br />請輸入帳號<br />password<br />請輸入密碼<br />Login<br />帳號或密碼輸入錯誤<br />
  89. 89. Validations : Controller<br />public static void login(<br />@Required(message ="請輸入帳號")String username, <br />@Required(message ="請輸入密碼")String password) {<br /> User user = User.login(username , password);<br /> if (validation.hasErrors()){<br /> params.flash(); // add parameters to flash scope<br /> validation.keep(); // keeps the errors<br /> flash.error(validation.errors().get(0).toString());<br /> render(“pleaseLogin.html”);<br /> }<br /> flash.success(“welcome : “ + user.username);<br /> render();<br />}<br />
  90. 90. Validation : Model<br />public class User extends Model {<br />@Required @MinSize(6)<br /> public username;<br />@Required @MinSize(6)<br /> public password;<br /> public static User login(String username , String password) {<br /> Validation validation = Validation.current();<br /> User user = ...<br /> validation.isTrue(user!=null)<br /> .key(“other”).message(“帳號或密碼輸入錯誤”);<br /> return user;<br />}}<br />Will @MinSize affect login() ?<br />
  91. 91. Validations<br />@Required , @Min , @Max , @MinSize , @MaxSize , @Range , @Email , @URL ...<br />Custom validation annotation<br />extends AbstractAnnotationCheck & implements isSatisfied()<br />i18n messages<br />/conf/messages<br />
  92. 92. Cache<br />Conventional JavaEE's Way<br />public User getUser(String name) {<br />  Session s = (Session)em.getDelegate();<br />  Criteria c = s.createCriteria(User.class);<br />  c.add(Restrictions.eq("username",name);<br />  c.setMaxResults(1);<br />  c.setCacheable(true);<br />  if (c.uniqueResult() == null)<br />    return null;<br />  return (User) c.uniqueResult();<br />}<br />
  93. 93. Cache<br />Play's Way : Not In Favor of 2nd Level<br />public static User getUser(String name) {<br />  String key="username_"+name;<br />  User user = Cache.get(key,User.class);<br />  if (user != null)<br />    return user;<br />  user = User.find("byUsername",name).first();<br />  Cache.set(key,user,"30mn");<br />  return user;<br />}<br />
  94. 94. Cache - Problem !<br />User.java {<br />  public static User getUser(Long id) {<br />    String key = "userId_"+id;<br />    ...<br />  }<br />  public static List<User> getUsers(Long page, int cnt) {<br />    String key="users_"+page+"_"+cnt;<br />    ...<br />  }<br />}<br />public interface UserDao.java {<br /> public User getUser(Long id);<br /> public List<User> getUsers(Long page, int cnt);<br />}<br />
  95. 95. Conventional JavaEE's Way<br />User u1 = userDao.getUsers(1,10).get(0);<br />User u2 = userDao.get(1L);<br />assertTrue(u1.equals(u2)); // PASSED<br />u2.modifySomething(...);<br />userDao.save(u2);<br />User u3 = userDao.getUsers(1,10).get(0);<br />assertTrue(u3.equals(u2)); // PASSED<br />Play's Way<br />User u1 = User.getUsers(1,10).get(0);<br />User u2 = User.getUser(1L);<br />assertTrue(u1.equals(u2)); // PASSED<br />u2.modifySomething(...);<br />u2.save();<br />User u3 = User.getUsers(1,10).get(0);<br />assertTrue(u3.equals(u2)); // FAILED!<br />
  96. 96. Cache Problem : Reason <br />users_1_10<br />cache key :<br />TIME<br />u<br />u<br />u<br />u<br />u<br />u<br />u<br />u<br />u<br />u<br />u1<br />userId_1<br />cache key :<br />u<br />modified / updated<br />u2<br />users_1_10<br />cache key :<br />?<br />u<br />u<br />u<br />u<br />u<br />u<br />u<br />u<br />u<br />u3<br />
  97. 97. Cache - Problem! How to Solve It ?<br /><ul><li>Ignore it , accept it
  98. 98. Never cache sensitive data
  99. 99. Two phase list retrieval
  100. 100. Cache object ids instead of objects</li></ul>public static List<User> getUsers(Long page, int cnt) {<br />  String key="users_"+page+"_"+cnt;  <br />  List<Long> userIds = <br />    User.find("select u.id from User u)<br />    .fetch(page,cnt);<br />  Cache.set(key, userIds, "1mn");<br />  // iterate each id in result and query cache or fetch<br />}<br />
  101. 101. Cache : Wait... I saw Model.em() ? <br />How about get underlaying Hibernate’s session and setCacheable(true) ?<br />Session s = (Session) User.em().getDelegate();<br />Critieria c = s.createCriteria(...);<br />c.add(... criterions ... );<br />c.setCacheable(true);<br />
  102. 102. Play's Module System<br />
  103. 103. Module : CRUD<br />package models;<br />public class User extends Model { ... }<br />package controllers;<br />public class Users extends CRUD { ... }<br />Cars , Photos , Logs<br />even ...<br />Boxs , Buss, Kisss<br />
  104. 104. Module GAE + Module Siena<br />public class User extends siena.Model { <br />  public String uid;<br />  public static User getUser(String uid) {<br />    return User.all(User.class).filter("uid",uid).get();<br />  }<br />  public static User getUsers(int page , int count) {<br />    return User<br />      .all(User.class)<br />      .fetch(count,(page-1)*count);<br />  }<br />}<br />Don't forget war/WEB-INF/appengine-web.xml<br />$ play gae:deploy <br />Done !<br />
  105. 105. Play on GAE<br /><ul><li>Simplest way to deploy Java Apps on GAE !
  106. 106. Shortest cold start time
  107. 107. Less than 10 seconds
  108. 108. Cache is wrapped to GAE's memcache
  109. 109. Mail is wrapped to GAE's mail service</li></li></ul><li>Issue : Portal-like Page<br /><ul><li>Many blocks query DB in every page
  110. 110. Passing these query results in every action is cumbersome
  111. 111. Solution : @Before and renderArgs.put()</li></ul>@Before<br />static void addDefaults() {<br />  renderArgs.put("brands", Brand.all().fetch());<br />  renderArgs.put("forums", Forum.getAll()); <br />  renderArgs.put("tags" , Tag.getAll());<br />}<br />
  112. 112. Issue : High Availability<br /><VirtualHost *:80><br /> ServerName myapp.com<br /> <Location /balancer-manager><br />  SetHandler balancer-manager<br />  Order Deny,Allow<br />  Deny from all<br />  Allow from .myapp.com<br /> </Location><br /> <Proxy balancer://mycluster><br />   BalancerMember http://localhost:9002<br />   BalancerMember http://localhost:9003 status=+H<br /> </Proxy><br /> <Proxy *><br />   Order Allow,Deny<br />   Allow From All<br /> </Proxy><br /> ProxyPreserveHost on<br /> ProxyPass /balancer-manager !<br /> ProxyPass / balancer://mycluster/<br /> ProxyPassReverse / http://localhost:9002/<br /> ProxyPassReverse / http://localhost:9003/<br /></VirtualHost><br />Apache Web Server<br />localhost:9002<br />localhost:9003<br />Same directory structures & application.secret , only different http.port<br />
  113. 113. Issue : Action Burst<br />controllers/App<br />controllers/App<br />login()<br />logout()<br />register()<br />myaccount()<br />mybooks()<br />index()<br />page()<br />search()<br />showbook()<br />login()<br />logout()<br />register()<br />myaccount()<br />mybooks()<br />index()<br />page()<br />search()<br />showBook()<br />listUsers()<br />editUser()<br />editBook()<br />controllers/Admin<br />listUsers()<br />editUser()<br />editBook()<br />
  114. 114. Issues : Validation Dilemma<br />Validation in controllers ?<br />validation in models ?<br />or hybrid ?<br />
  115. 115. Issue : DI<br />Dependency Injection is not so useful in Play’s Rich Domain Object environment<br />
  116. 116. Case Study : VAGTW.COM<br />VW/Audi Car Problem Stats<br />
  117. 117. vagtw.com Data Model<br />
  118. 118. VAGTW.com development<br /><ul><li>Dev in one month (Since 2010/4/1)
  119. 119. Modified from Play's YABE sample
  120. 120. 10 days learning Play! & modeling & coding
  121. 121. 20 days tuning HTML & CSS(3)
  122. 122. 2010/5/1 Debut
  123. 123. Peak 4x users in 15 mins
  124. 124. Indexed by Google in 2 days
  125. 125. Indexed by Yahoo in 2 weeks
  126. 126. Indexed by Bing after 2 months</li></li></ul><li>Conclusions<br />IS ...<br /><ul><li>A Glued Pure Web Framework
  127. 127. Loose
  128. 128. Shallow
  129. 129. non-Standardized
  130. 130. Page-based
  131. 131. Stateless</li></ul>IS-NOT ...<br /><ul><li>A Java library
  132. 132. Full-Fledged JavaEE stack
  133. 133. Standard
  134. 134. Strict
  135. 135. Defined-assembled by interfaces
  136. 136. Component-based
  137. 137. Stateful (Session-aware)</li></li></ul><li>Conclusions : Use Play! If You...<br />Have to prototype or build something quickly<br />Don’t want to buy high-priced Java application servers<br />Are not so OO-purism, feel OK without interfaces<br />Many Play’s “hook” are not enforced by abctract mathods or interfaces<br />Know JavaScript & other JS frameworks<br />You can build slick UIs without sluggish server-state implementation responses (Wicket/JSF...)<br />Feel OK about object inconsistences in cache<br />Want to develop GAE apps<br />Your team have a strong mendiator<br />Because programming in play is too unrestrained<br />Want to learn Scala<br />
  138. 138. 小心<br />回不去了<br />
  1. A particular slide catching your eye?

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

×