Saturday, December 24, 2011

[Play!] tips

  1. If you do as many tasks as possible such as validation in the application instead of the database it is always easier to scale.
  2. Do not use something like the DAO pattern in Play, as this is not natural for the framework and would pretty much break its flow. The anemic domain model—pulling logic from the object into data access objects—should be an absolute no-go when developing with Play.
  3. Every HTML file in the app/views/tags directory is automatically used as a tag (such as #{loginStatus /}, which makes creating tags pretty simple.
  4. Be aware that the session referenced in the code is actually not a HttpSession as in almost all other Java based frameworks. It is not an object stored on the server side, but rather its contents are stored as an encrypted cookie on the client side. This means you cannot store an arbitrary amount of data in it.
  5. If you need more performance, there is a mechanism called FastTags inside of Play. These tags are actually compiled, as they are written in pure Java. This speeds up execution time.



No comments: