Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

JDD2014: JEE'ish development without hassle - Jakub Marchwicki

375 views

Published on

This happens in every community: You don’t need Rails, to build a web application in Ruby. You don’t need templating engine for PHP - PHP is a templating language! We over engineer and over engineer, again and again.
Same happens in Java. Hibernate + EJB + JSF is not the only blessed stack for development of web application… one can argue it’s the worst. Same with Spring; no longer lighweight, no so robust - still powerful but not necessary the easiest. So what are the options for an average Java developer?
In this talk I’ll walk through multiple options, for modern Java web development: easy, quick, flexible and still state of an art. Starting for just obvious unknowns like embedded jetty, though micro pure-webframeworks, smaller and bigger swiss army knifes, which try to promise both: cover most of the application stack, still keeping things robust.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

JDD2014: JEE'ish development without hassle - Jakub Marchwicki

  1. 1. JEE’ish development without hassle : ! geecon Kuba Marchwicki - @kubem
  2. 2. Java Developer archetype
  3. 3. Java Developer archetype
  4. 4. Standard corporate project
  5. 5. Every project has some principles
  6. 6. Every project has some principles JEE = = EJB
  7. 7. Every project has some principles JEE = = EJB cause we do EJB
  8. 8. Every project has some principles JEE = = EJB SPRING FRAMEWORK
  9. 9. Every project has some principles JEE = = EJB cause we do EJB SPRING FRAMEWORK we are lightweight, with 60MB war
  10. 10. Every project has some principles JEE = = EJB cause we do EJB SPRING FRAMEWORK we are lightweight, with 60MB war JPA
  11. 11. Every project has some principles JEE = = EJB cause we do EJB SPRING FRAMEWORK we are lightweight, with 60MB war JPA object map everything
  12. 12. “ Insanity is doing the same thing over and over again and expecting different results. — Albert Einstein
  13. 13. What’s the project about? Database MySQL seem good enough Data access get the data BUSINESS IOgIC anemic CRUD A control Ier in a few different ways VIEWS backbone. js
  14. 14. _ 1, IX‘ X ‘,1, ; IL 1‘ W'. I _i: -ii E , I'M I‘, E» till i ~:
  15. 15. TodoMVCResource. java @Path(u/ u) @Produces(MediaType. APPLICATION_JSON) public class TodoMVCResource { private final Store store; @GET public List<Todo> getAll() { return store. getAll(); } / /.. / /methods omitted for brevity } runner. sh { ~ } » java -jar tomee-embedded. jar --path my-application war
  16. 16. TodoMVCController. java @RestController public Class TmJuHVflynliu ‘Hi { private final Store store; @Autowired public TodoMVCController(Store store) { this. store = store; } @RequestMapping(value = “/ todos“, method = RequestMethod. GET, produces = MediaType. APPLICATION JSON VALUE) public List<Todo> getAllTodos() { return store. getAll(); }
  17. 17. Seem
  18. 18. SerVIet starting point
  19. 19. SerVIet starting point R€SpOnSe Jackson / Jettison
  20. 20. SerVIet starting point Response Mapping Jackson/ Jettison Dispatcher Spring / Container JEE
  21. 21. S€I"VI€t starting point Response Mapping Jackson/ Jettison Dispatcher Spring / Container JEE Dependency Container Spring/ CDI
  22. 22. S€I'VI€'I: starting point Response Mapping Jackson/ Jettison Dispatcher Spring / Container JEE Dependency Container Spring/ CDI TransactionManager
  23. 23. SEFVIEII starting point RESPONSE Jackson/ Jettison Dispatcher spring / Container JEE Dependency Container Spring/ CDI TransactionManager ORM (EntityManager)
  24. 24. SEFVIEII starting point RESPONSE Jackson / Jettison Dispatcher spring / Container JEE Dependency Container Spring/ CDI TransactionManager ORM (EntityManager) Resu| tSet JDBC
  25. 25. SEFVIEII starting point RESPONSE Jackson / Jettison Dispatcher spring / Container JEE Dependency Container Spring/ CDI TransactionManager ORM (EntityManager) Resu| tSet JDBC DataSource
  26. 26. SEI'VIEt starting point Response Mapping Jackson / Jettison Dispatcher spring / Container JEE Dependency Container Spring/ CDI TransactionManager ORM (EntityManager) Resu| tSet JDBC DataSource SQL
  27. 27. Servlet Response Mapping Dispatcher / Container Dependency Container TransactionManager ORM (EntityManager) Resu| tSet DataSource SQL
  28. 28. More robust?
  29. 29. More robust? DrOPWIZard Jetty + Jersey + jDB|
  30. 30. More robust? Dropwizard Jetty + Sql2o
  31. 31. More robust? Dropwizard Jetty + Sql2o Jetty + RESTeasy + MyBatis
  32. 32. More robust? Dropwizard Jetty + Sql2o Jetty + RESTeasy + MyBatis Spark + jOOQ
  33. 33. More robust? Dropwizard Jetty + Sql2o Jetty + RESTeasy + MyBatis Spark + jOOQ Webbit + jDBl
  34. 34. Dropwizard Jetty + Sql2o Jetty + RESTeasy + MyBatis Spark + jOOQ Webbit + jDBl
  35. 35. DROPWIZARD Dropwizard is a Java framework for developing ops-friendly, high-performance, RESTful web services. Dropwizard pulls together stable, mature libraries from the Java ecosystem into a simple, light-weight package that lets you focus on getting things done.
  36. 36. Dropwizard Jetty + Sql2o Jetty + RESTeasy + MyBatis Spark + jOOQ Webbit + jDBl
  37. 37. JETTY Small footprint web server and javax. serv| et container SQL2O Sql2o is a small java framework that makes it easy to execute sql statements on your JDBC compliant database from java.
  38. 38. Method Duration Hand coded Resultset 60ms Sql2o 75ms i: _~s» 7 rl Apache DbUti| s 98ms ‘7 JDBI 197ms I . .. . MyBatis 293msi ii ~ jOOQ 447ms I Hibernate 494ms . . 4 ii Spring JdbcTemp| ate 636ms iI"r§l,1‘ i i _ sql2o/ PojoPerformanceTest. java --> http: //goo. gl/ cwNkRN
  39. 39. Dropwizard Jetty + Sql2o Jetty + RESTeasy + MyBatis Spark + jOOQ Webbit + jDBl
  40. 40. RESTEASY RESTEasy is a JBoss project that provides various frameworks to help you build RESTfu| Web Services and RESTfu| Java applications MYBATIS MyBatis is a first class persistence framework with support for custom SQL, stored procedures and advanced mappings
  41. 41. Dropwizard Jetty + Sql2o Jetty + RESTeasy + MyBatis Spark + jOOQ Webbit + jDBl
  42. 42. SPARK A Sinatra inspired micro web framework for quickly creating web applications in Java with minimal effort JOOQ jOOQ generates Java code from your database and lets you build typesafe SQL queries through its fluent API
  43. 43. Dropwizard Jetty + Sql2o Jetty + RESTeasy + MyBatis Spark + jOOQ Webbit + jDBl
  44. 44. WEBBIT An event-based, single threaded WebSocket and HTTP server in Java JDBI jDB| is a SQL convenience library for Java. It attempts to expose relational database access in idiommatic Java, using collections, beans, and so on, while maintaining the same level of detail as JDBC. It exposes two different style APls, a fluent style and a sql object style.
  45. 45. Instead of wrap-up Whybother?
  46. 46. Questions? JD @kubem
  47. 47. Links and other goodies http: //speakerdeck. com/ kubamarchwicki/ jee—without—hass1e-pl Follow me on twitter @kubem Project with examples https: //github. com/ kubamarchwicki/ micro-java Frontend from here: https: //github. com/ tastejs/ todomvc Some inspirations: https: //github. com/ kouphax/ todomvc-server This presentation was made with AsciiDoctor http: //asciidoctor. org/ https: //github. com/ kubamarchwicki/ presentations/ web http: //www. ec1ipse. org/ jetty/ http: //resteasy. Jboss. org/ http: //www. sparkjava. com/ http: //webbitserver. org/ http: //dropwizard. io/ Database http: //sq12o. org/ http: //mybatis. github. io/ mybatis-3/ http: //j0oq. org/ http: //]db1.org/

×