{"id":1826,"date":"2014-12-04T11:14:58","date_gmt":"2014-12-04T10:14:58","guid":{"rendered":"http:\/\/www.xenonique.co.uk\/blog\/?p=1826"},"modified":"2014-12-04T11:14:58","modified_gmt":"2014-12-04T10:14:58","slug":"coda-hale-dropwizard-and-scala","status":"publish","type":"post","link":"https:\/\/www.xenonique.co.uk\/blog\/2014\/12\/04\/coda-hale-dropwizard-and-scala\/","title":{"rendered":"Coda Hale, Dropwizard and Scala"},"content":{"rendered":"<p>I enjoyed working with Scala at my last client. One of the frameworks that we used there was <a href=\"https:\/\/www.linkedin.com\/in\/codahale\" title=\"Coda Hale's\"><strong>Coda Hale<\/strong><\/a>&#8216;s <a href=\"https:\/\/dropwizard.io\/manual\/core.html\" title=\"Drop Wizard IO Core\"><strong>Dropwizard framework<\/strong><\/a>. The Dropwizard project, itself, is written against Java, and provided a nice bunch of friendly open source frameworks and applications already integrated together in <em>read-to-run<\/em> server. The developer just writes configuration, resources and if necessary templates to plugin in the application framework. The great idea is that you can <em>dropped<\/em> in some code into the setup and you are generally on track with a monitoring, logging and healthy beating infrastructure. <\/p>\n<ul>\n<li><a href=\"https:\/\/www.eclipse.org\/jetty\/documentation\/current\/\" title=\"Jetty web servlet container\"><strong>Jetty<\/strong><\/a> for a lightweight Java EE 6 style Web Servlet container<\/li>\n<li><a href=\"https:\/\/jersey.java.net\/\" title=\"Jersey JAX-RS implementation\"><strong>Jersey<\/strong><\/a> JAX-RS for REST<\/li>\n<li><strong>Jackson<\/strong> for JSON serialization<\/li>\n<li>The incredible <a href=\"https:\/\/github.com\/dropwizard\/metrics\" title=\"Coda Hale's Metrics for the JVM\"><strong>Metrics<\/strong><\/a> library for handling all sorts of Developer\/Operation metrics<\/li>\n<li><a href=\"http:\/\/logback.qos.ch\/\" title=\"Logging service that improves on the older Log4j\"><strong>Logback<\/strong><\/a> and SLF4J for performance logging including integration to UNIX style SysLogs through a network port<\/li>\n<li><a href=\"http:\/\/hibernate.org\/validator\/\" title=\"The Bean Validation implementation from Hibernate\"><strong>Hibernate Validator<\/strong><\/a> 1.0 for bean validation <\/li>\n<li>Database help with <a href=\"http:\/\/jdbi.org\/\" title=\"Java Database Interface alternative to JDBC or JPA\"><strong>JDBI<\/strong><\/a> and <a href=\"https:\/\/www.liquibase.org\/\" title=\"Database refactoring tool\"><strong>Liquibase<\/strong><\/a><\/li>\n<li><a href=\"https:\/\/github.com\/google\/guava\" title=\"Google's Guava project of core utilities, functions and collections for Java\"><strong>Guava<\/strong><\/a> is useful for writing functional programming Java before Lambdas (Java SE 8)<\/li>\n<\/ul>\n<p>Coda Hale presented an interesting talk on the importance of measuring critical systems in an disparate and diverse architecture. He posited the idea that you need to know the <em>numbers<\/em> in order to make key decisions of your system. His talk is available on YouTube <a href=\"https:\/\/www.youtube.com\/watch?v=czes-oa0yik\" title=\"Metric, Metric are Everywhere by Coda Hale\" target=\"_blank\">You Tube Metric, Metrics are Everywhere<\/a> (opens separate window) and the <a href=\"https:\/\/dl.dropbox.com\/u\/2744222\/2011-04-09-Metrics-Metrics-Everywhere.pdf\" title=\"Metrics Slide deck Coda Hale's talk\">slides are here<\/a>. <\/p>\n<p>I did say that Scala is being used in this blog entry. Dropwizard has a Scala module, which I saw definitely being used in the Registered Traveller project at GOV.UK. It made sense to really on pre-existing open source framework (NIH, DRY) based on sound ideas like health checks, pings and pongs and logging. You can build reasonable scalable, maintainable and robust Micro Services in Java and Scala with this integration of configuration and resources. <\/p>\n<p>The issues with Dropwizard are that some of the modules are dated. In particular, the Jersey framework integrated is only 1.18, where as a recent check of MvnRepository.com already shows the latest Jersey version 2.13 or better. The latest version of Jersey provides Java EE 7 style API with the standardised JAX RS 2.0 API and the Client side API. If you want to use Java EE 7 then DropWizard is not yet capable of running against <a href=\"https:\/\/www.eclipse.org\/jetty\/documentation\/current\/jetty-javaee.html\" title=\"Jetty Current Release Docs\">Jetty 9<\/a>.<\/p>\n<p>I mentioned that there is a <a href=\"https:\/\/github.com\/bretthoerner\/dropwizard-scala\" title=\"Scala module for Dropwizard\" target=\"_blank\"><strong>Scala module for Dropwizard<\/strong><\/a>, which is a fork on the original unmaintained project. <strong>Brett Hoerner<\/strong> maintains this <a href=\"https:\/\/github.com\/bretthoerner\/dropwizard-scala\" title=\"Dropwizard Scala module\" target=\"_blank\"><strong>Github project<\/strong><\/a>. The module does work with Scala 2.11 even though the original fork dates back to Scala 2.9. There are some clunky expositions of Guava and Java that seep through to the Scala side. Ok the Java framework is not written in Scala, but Drop Wizard solves a pressing issue with bundling working application\/infrastructure that almost ready to go for the enterprise. There could be more Scala style library API, but most of all it would great of the Java framework was upgraded to latest Java EE 7 features and frameworks.<\/p>\n<p>I believe that sometimes people forget that Scala is hybrid of object-oriented programming and functional programming. That is exactly what the <a href=\"https:\/\/typesafe.com\/company\/news\/scala-creator-martin-odersky-and-creator-of-spring-rod-johnson-to-deliver-keynotes-at-fourth-annual-scala-days-conference\" title=\"Martin Odersky, Chief Architect at Typesafe\"><strong>inventor of Scala<\/strong><\/a> wanted to achieve on the JVM. Therefore there will be people will prefer a one of these directions and just because that someone choses one these orthogonal does equate with ineptness or inferiority. To penalise somebody because, to date, they have had less experience of FP and more experience OOP or the other way around, in my mind at least, demonstrates elitism, contriteness and damn right stupidity. It more important to continuously improve on both axes as much as possible and we all have something to learn from each other.<\/p>\n<p>+PP+<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I enjoyed working with Scala at my last client. One of the frameworks that we used there was Coda Hale&#8216;s Dropwizard framework. The Dropwizard project, itself, is written against Java, and provided a nice bunch of friendly open source frameworks and applications already integrated together in read-to-run server. The developer just writes configuration, resources and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[28,164,129,117,110,6],"tags":[],"_links":{"self":[{"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/posts\/1826"}],"collection":[{"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=1826"}],"version-history":[{"count":6,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/posts\/1826\/revisions"}],"predecessor-version":[{"id":1835,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/posts\/1826\/revisions\/1835"}],"wp:attachment":[{"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=1826"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=1826"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=1826"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}