Pure Java RAD and Scaffolding Tools Race
Upcoming SlideShare
Loading in...5
×
 

Pure Java RAD and Scaffolding Tools Race

on

  • 7,801 views

Rapid application development techniques, favoring rapid prototyping over intensive planning, have become popular in the last few years. Although the "old-school" Java Web frameworks (such as Struts ...

Rapid application development techniques, favoring rapid prototyping over intensive planning, have become popular in the last few years. Although the "old-school" Java Web frameworks (such as Struts and JSF) are well suited for enterprise projects, their development cycle is often too slow and complicated for prototyping. Due to their nature, dynamic languages such as Ruby, Python, and Groovy are natural for fast prototyping and scaffolding. But is there a way to benefit the Java ecosystem without compromising simplicity and productivity? This presentation tries to answer this question by comparing, head-to-head, three leading Java RAD tools—SeamForge, Play, and Roo—by writing a full-blown Web application in each of them, comparing the pros and cons along the way.

Statistics

Views

Total Views
7,801
Views on SlideShare
7,225
Embed Views
576

Actions

Likes
6
Downloads
80
Comments
0

2 Embeds 576

http://lanyrd.com 575
http://s.medcl.net 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • Presentation of the speakers – background, twitter, etc.
  • Explain agenda:Background and overview on what RAD isFor each framework:Overview Interesting features Extension capabilitiesDemoPros and consSummary and comparisonQ&A
  • Fourth-generation-languages tried to move away from the machine towards business problems. They failed being too restrictive.
  • Overview on what RAD is:Opposite to slow J2EE, will explain why slow in next slidesPopularized by RoRCommon features:Scaffolding (will be explained in following slides)Modularity (will be explained in the following slides)CLI (shell)
  • Why traditional J2EE apps are slow to delevop? Mainly 2 reasons:Integration of a lot of stuff (see next slides)Java web frameworks are suboptimal (see next slides)
  • What is scaffolding? Generation of UI from entities
  • modules are used to add functionality to project.They ease integration by generating configurations.E.g. all the ORM configurations are generated
  • Lot’s of modules are like scaffolding. They generate functionality based on existing entitiesE.g. solr add-on, which generate the configuration, and lots of indexing and searching logic based on the entity
  • Simple to use, lot’s of reasonabledefaults are assumed and hidden.
  • Full power at your hand comes with tedious configuration and setup.Simple example of COC is Hibernate 2 hbm.xml, which named each and every persistent property vs. Hibernate annotations (or JPA), in which all the properties are persistent by default unless otherwise stated.
  • Metawidget – UI generation framework. Supports various backends, inc. JPA, Hibernate, Seam, etc. and various frontends, inc. Android, GWT, Spring MVC, Swing, SWT and JSF.In theory, selecting Metawidget as the scaffolding tool should give the ability to provide all those UIs. In practice, only JSF is supported
  • Promisesabstractions for Persistence as a general concept (JDBC, JPA, Hibernate, NoSQL, and JDO). For now only JPA is implemented
  • Seam Persistence supports for no-sql, currently implemented only JPAMetawidget supports GWT, Spring MVC, Struts, Swing and SWT, currently implemented only JSF
  • Developing plugin is easy, project created automatically, use standard Java EE to perform operations, use Forge API to do stuff to project. Full support for CLI.Not using OSGi, so plugins run in same classloader, which creates classpath hell. Current workaround is maven shade plugin with relocation.
  • Pros – Scaffolding with JSF – easy to create JSF UIHeavily based on Java EE 6 and Seam framework.Cons – Early days, only limited amount of features implemented (e.g. Metawidget only for JSF), bugs and failures.Generated classes are editable by user, regeneration destroys the changes. That limits the usage to project bootstrap stage only.Classpath hell ugly workaround for plugins creation
  • Standard AspectJ technique for separation of conserns. Used inRoo to separate auto-generated content from user-editable contentAlso fights some Java boilerplate – here it hides the getters and setters from JavaBean
  • Here is adds the JPA stuff to entity, both technical details of entity itself (like ID and Version) and the active record nature (persist, merge, find)
  • Variosaddons include full text search, REST support with JSON, GWT UI, deployment to cloud factory and other fancy stuffJPA providers – Hibernate, EclipseLink, OpenJPA, DataNecleus
  • Creation of add-on is simple and convenient:Use add-on creator add-onInject the services for manipulating the project, generate code and ITDs, access application contextAdd-on is regular Spring bean, everything works.Roo is running inside OSGi container (Apache Felix), the add-ons are bundles. That solves the classpath issues better way than Seam Forge does. The OSGi complexity is hidden from add-on developer.
  • Pros – Separation of user-authored code from autogenerated code. That allows Roo to manage the application even after the user started to change the code in IDE.Tight integration with Spring Framework, allowing easy usage of all the features.Solr add-onGood usage of OSGi to solve classpath issues with add-ons. The complexity of OSGi is well hidden.Cons – Most of the code is in ITDs. They are almost Java, but not quite. Looks like magic.No support for NoSQL persistence. We’d expect it to present due to excellent SpringData project. Work in progress.We can’t say Active Record as it is implemented in Roo is a con, but absence of DAO option is. Debates in progress.
  • Play does not support scaffolding by default. So, is it still Rapid Application Development Tool?
  • Yes. It uses other technique to achieve rapid development – the on-the-fly compile. It saves recompile-redeploy-restart cycle and speeds up the development.
  • Play also differs from other tools in:Not using Servlet API, it uses Netty (NIO) directlyNot using Maven, but bunch of Python scriptsAll the methods in controllers are static Uses “Share nothing” architecture to be totally statelessUses its own templating engine, the improved JSP, written in Groovy
  • Various add-ons include mongoDB, Rest-Easy for REST over JSON, Scaffolding (not as default, but in add-on) , Scala support, deployment to GAE, full text search etc.
  • A module is just another Play application.
  • Special command for bootstrapping module developmentModules are automatically loaded from the /modules directory of the applicationModules are less restricted than application , e.g. module doesn’t have application.conf file. Everything in module is optional.Public module repo exists, your module can be there after a short review of the core team.The classpath hell is not tackled. Ivy is used for dependency management, so ivy.xml should sort out all the jar conflicts.
  • Pros – OTF compile gives great productivity boostFansy modules, like full text search, MongoDB and even ScalaNIO server based on NettyCons – Scaffolding as module with questionable qualityClasspath hell in module development

Pure Java RAD and Scaffolding Tools Race Pure Java RAD and Scaffolding Tools Race Presentation Transcript

  • Pure Java RAD and Scaffolding Tools Race@Drorbr@jbaruch #javarad
  • Your SpeakersDror Bereznitsky Baruch Sadogursky@drorbr @jbaruchDevelopment Division Manager Innovation ExpertTangram-Soft BMC Software
  • AgendaBla-bla-bla (AKA Overview) 1 Framework[] frameworks = new Framework[]{ 2 seamForge, springRoo, playFramework}; 3 for (Framework fw : frameworks) { 4 fw.showOverview(); 5 fw.hightlightFeatures(); 6 fw.runDemo(); 7 fw.showProsAndCons(); 8 }Yadda-yadda-yadda (Aka Summary)
  • Rapid Application Development
  • Rapid Application Development
  • Why Slow? Integration == pain!Java Web Frwks suck! Java EE application – Map model to relational (JPA) – Write Session EJBs for DAOs and Services – Write JSF UI (E.g.JSP) – Write bunch of xmls (persistence, web, jsf, server specific) – Deploy to JEE server
  • Scaffolding
  • Modules
  • Modules1 @Async2 public static void Talk.indexTalks(Collection<Talk> talks) {3 List<SolrInputDocument> documents = new ArrayList<SolrInputDocument>();4 for (Talk talk : talks) {5 SolrInputDocument sid = new SolrInputDocument();6 sid.addField("id", "talk_" + talk.getId());7 sid.addField("talk.id_l", talk.getId());8 sid.addField("talk.code_l", talk.getCode());9 sid.addField("talk.title_s", talk.getTitle());10 sid.addField("talk.track_t", talk.getTrack());11 sid.addField("talk.category_t", talk.getCategory());12 sid.addField("talk.speaker_t", talk.getSpeaker());13 // Add summary field to allow searching documents14 sid.addField("talk_solrsummary_t", new StringBuilder().15 append(talk.getId()).append(" ").append(talk.getCode()).16 append(" ").append(talk.getTitle()).append(" ").17 append(talk.getTrack()).append(" ").18 append(talk.getCategory()).append(" ").19 append(talk.getSpeaker()));20 documents.add(sid);21 }22 try {23 SolrServer solrServer = solrServer();24 solrServer.add(documents);25 solrServer.commit();26 } catch (Exception e) {27 e.printStackTrace();28 }29 }
  • Writing your own module
  • Convention…
  • Over…
  • Configuration
  • On the Left lane:JBOSS SEAM FORGE
  • Obvious and trivial jboss SEAM FORGE FactsDeveloped by JBOSS (surprise!)Heavily based on JBOSS SEAM (surprise!)Heavily based on MavenUses standard java ee 6 featuresEvolved from seam-gen project in August 2010latest version 1.0.0-beta1
  • Interesting stuff
  • Interesting stuff
  • Plugins (aka Modules) Infrastructure Javabean validation Jboss as Glassfish AS Apache Maven
  • Developing Plugin Use standard java ee cdi TO access container services
  • Demo!
  • Pros and Cons
  • On the Middle lane:SPRING ROO
  • Obvious and trivial Spring ROO Facts Developed by springsource (surprise!) Heavily based on the Spring framework (surprise!) revealed @ SpringOne Europe on 27 April 2009 latest version 1.1.5
  • Inter-type declarations1 @RooJavaBean2 @RooToString3 @RooEntity4 public class Speaker {56 @NotNull7 private String firstName;89 @NotNull10 private String lastName;1112 private String email;1314 @ManyToMany(cascade = CascadeType.ALL)15 private Set<Talk> talks = new HashSet();16 } 1 privileged aspect Speaker_Roo_JavaBean { 2 3 public String Speaker.getFirstName() { 4 return this.firstName; 5 } 6 7 public void Speaker.setFirstName(String firstName) { 8 this.firstName = firstName; 9 } 10 … 11 }
  • Inter-type declarations1 @RooJavaBean2 @RooToString3 @RooEntity4 public class Speaker { 1 privileged aspect Speaker_Roo_Entity {5 26 @NotNull 3 declare @type: Speaker: @Entity;7 private String firstName; 48 5 @PersistenceContext9 @NotNull 6 transient EntityManager Speaker.entityManager;10 private String lastName; 711 8 @Id12 private String email; 9 @GeneratedValue(strategy = GenerationType.AUTO)13 10 @Column(name = "id")14 @ManyToMany(cascade = CascadeType.ALL) 11 private Long Speaker.id;15 private Set<Talk> talks = new HashSet(); 1216 } 13 @Version 14 @Column(name = "version") 15 private Integer Speaker.version; 16 17 @Transactional 18 public void Speaker.persist() { 19 this.entityManager.persist(this); 20 } 21 22 public static long Speaker.countSpeakers() { 23 return entityManager().createQuery( 24 "SELECT COUNT(o) FROM Speaker o", 25 Long.class).getSingleResult(); 26 } 27 … 28 }
  • add-ons (AKA Modules) InfrastructureJavabean validation SOLRCloud Foundry and GAE JUNIT and seleniumEmbedded Jetty OSGiApache MAVEN
  • Developing add-on
  • Demo!
  • Pros and Cons
  • On the Right lane:PLAY! FRAMEWORK
  • Obvious and trivial Play! FactsDeveloped by guillaume bort, supported by zenexityFirst signs of life from 12 may 2007latest version 1.2.3
  • Not your grandpa’s RAD Tool So, what gives?
  • The other “rapid”
  • More unusual stuffNot using servlet APIBuild and deployment handled by Python scriptsStatic controllers“Share nothing” architectureJSP-LIKE templating engine (based on Groovy)Admin area otf generationGraphical Test runner
  • Modules Infrastructure Scala ElasticSearch and Lucene Eclipse Compiler JUNIT and selenium GAE OAuth JBoss Netty*Yap, we lied
  • Developing module
  • Developing module
  • Demo!
  • Pros and Cons
  • Feature Seam Forge Spring Roo Play!Scaffolding One-Time Continuous One-time (as module)OTF compile No No YesPersistence JPA JPA JPA MorphiaUser interface JSF Spring-MVC HOME-Grown GWT (JSP-like)Full Text Search No Solr ElasticSearch LuceneREST support No Spring-rest Rest-easyDeployment JBOss AS Servlet container Embedded netty Glassfish AS GAE Gae Cloud Foundry Servlet container
  • Feature Seam Forge Spring Roo Play! Backed up JBOss Springsource zenexity Maturity Low High high Documentation Low Medium Medium Books NO “Roo in action” “Introducing the Early access Play Framework” License LGPL Apache 2 Apache 2 Mailing List 6 messages in 132 messages in ~550 messages in last month last month last month**Inc. announcements on usage, etc.