Download - Pure Java RAD and Scaffolding Tools Race
Pure Java RAD and Scaffolding Tools
Race@Drorbr@jbaruch
#javarad
That’s
us!
Twitter tag!
Your Speakers
Dror Bereznitsky @drorbrDevelopment Division
ManagerTangram-Soft
Baruch Sadogursky
@jbaruchInnovation
ExpertBMC Software
AgendaBla-bla-bla (AKA Overview)
Yadda-yadda-yadda (Aka Summary)
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 }
RAD
WHAT?Speaking of R
AD,
4gl were rad!
FYI, Java
is 3gl
Rapid Application Development
Oracle Forms
MagicBMC Action
Request
Opposite to old-school
slow j2ee
Rapid Application Development
Why Slow?Any Java Enterprise
application:
– Setup project
– Get the
dependencies
straight
– Setup database
& server
– Write model
classes
Inte
gra
tion
==
pain
!Spring application:
–Map model to
storage (JPA/Hibernate/NoSQL
)–
Write POJO DAOs and
Services–
Write Spring Web
UI (E.G. JSP)
–Write some xmls
(web.xml, beans.xml)
or configure with
Java classes
–Deploy to Servlet
Container
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
Java W
eb
Frw
ks s
uck
!
Scaffolding
They create:– Jar dependencies– Configuration files (e.g. web.xml)– Controller classes
– Views (e.g. jsp)– Static Resources (imgs, css, js)
– I18n (properties files)
~.domain.Tal
k roo> contr
oller all --
package
~.web
You Type:
Ease w
eb
development
Modules
Ease In
tegra
tion
They create:– Jar dependencies– Persistence.xml– Database properties– configurations
roo> jpa set
up --provide
r HIBERNATE
--database
HYPERSONIC_I
N_MEMORY
You Type:
1 @Async 2 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 documents 14 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 }
Modules
Ease
Integra
tion
They create:– configurations
roo> solr
setup
You Type: They create:
~.domain.Talk roo> solr
add
You Type:
Writing your own module
Module
s
Generate codeGenerate configuration filesGenerate testing code
Change project structure
Add dependencies
Change existing
code
Inject content
Convention…
Over…
Configuration
Showtime!
JBOSS SEAM FORGEOn the Left lane:
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)Persistence
JPA major 4 providers
Seam Persistence
only Hibernate
currently supported
JCR
DB Reverse
Engineering
WEBMetawidget
JSF & RIchfaces
JavaSCriptInfrastructureJavabean validationJboss asGlassfish ASApache Maven
Developing Pluginuse “forge.api”
facet to access forge API
Use forge’s project
object to access
dependencies,
packaging, etc.
Modular application ==
Classpath hell
Use standard java ee cdi TO access container services
Demo!
Pros
Scaffolding
Java ee 6 integration
Seam framework
integration
Clean, simple, standard
code generation
COns
Early daysNo separation between
generated and user data
Lack of documentation
No nosql support
Pros and Cons
SPRING ROOOn the Middle lane:
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
1 @RooJavaBean 2 @RooToString 3 @RooEntity 4 public class Speaker { 5 6 @NotNull 7 private String firstName; 8 9 @NotNull 10 private String lastName; 11 12 private String email; 13 14 @ManyToMany(cascade = CascadeType.ALL) 15 private Set<Talk> talks = new HashSet(); 16 }
Inter-type declarationsYour Class:
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 }
ITD:
1 privileged aspect Speaker_Roo_Entity { 2 3 declare @type: Speaker: @Entity; 4 5 @PersistenceContext 6 transient EntityManager Speaker.entityManager; 7 8 @Id 9 @GeneratedValue(strategy = GenerationType.AUTO) 10 @Column(name = "id") 11 private Long Speaker.id; 12 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 }
1 @RooJavaBean 2 @RooToString 3 @RooEntity 4 public class Speaker { 5 6 @NotNull 7 private String firstName; 8 9 @NotNull 10 private String lastName; 11 12 private String email; 13 14 @ManyToMany(cascade = CascadeType.ALL) 15 private Set<Talk> talks = new HashSet(); 16 }
Inter-type declarationsYour Class:
ITD:
Look, ma,
active record!
BMP Entity EJB
1.0 FTW!
add-ons (AKA Modules)
Persistence
JPA major 4 providers
Incremental DB Reverse
Engineering
WEBSpring MVC
over JSPXGWTREST & JSON
JavaSCriptInfrastructure
Javabean validationCloud Foundry and GAEEmbedded Jetty
Apache MAVEN
SOLRJUNIT and seleniumOSGi
Modular application ==
Classpath hell
Developing add-onuse “Add-on creator” add-on to
generate the add-on
Use Roo’s Services to:
Change The
POM.xml
Create/edit
Properties files
Add new types
Add new Itds
Annotate existing
types
Add static content
Add-on is Spring bean. nuff said.
Demo!
Pros
Separation of concerns
Spring framework
integration
Full text search
Good usage of OSGi
ConsAspectj magic
No nosql supportNo DAO option
Pros and Cons
PLAY! FRAMEWORKOn the Right lane:
Obvious and trivial Play! Facts
Developed 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?
No Ui Is the sameSo why bother?
The other “rapid”
On-the-fly compile
No recompile
No redeploy
No server restart
More unusual stuff Not using servlet APIBuild and deployment handled by Python scripts Static controllers“Share nothing” architectureJSP-LIKE templating engine (based on Groovy)Admin area otf generation Graphical Test runner
Modules
Persistence
JPA over Hibernate
Morphia over
MongoDB
Siena (Relational DBs
and GAE)
WEBJSP-like templates
REST-easy (REST & JSON)
GWTScaffolding*InfrastructureScalaEclipse CompilerGAEJBoss Netty
ElasticSearch and LuceneJUNIT and seleniumOAuth
*Yap, we lied
Developing module
Module is (part of) play!
Application.
Nuff said.
Developing module
OK, Here’s
more:
Modular application ==
Classpath hell
Create module with “play new-
module” command
Modules are loaded from
“Modules” directory
Repo: www.playframework.org/modules
Demo!
Pros
Productivity boost with
OTF compile
Full text search, NOSQL,
SCALA
NIO Server (Netty)
Stateless model - share
nothing
Full Stack Solution
ConsProprietaryScaffolding not
in coreClasspath hell
Pros and Cons
HEAD
TO
HEAD!
Let’s ru
mble!
Feature Seam Forge
Spring Roo
Play!
Scaffolding One-Time Continuous One-time(as module)
OTF compile
No No Yes
Persistence JPA JPA JPAMorphia
User interface
JSF Spring-MVCGWT
HOME-Grown(JSP-like)
Full Text Search
No Solr ElasticSearchLucene
REST support
No Spring-rest Rest-easy
Deployment JBOss ASGlassfish AS
Servlet containerGAECloud Foundry
Embedded nettyGaeServlet 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”Early access
“Introducing the Play Framework”
License LGPL Apache 2 Apache 2
Mailing List 6 messages in last month
132 messages in last month
~550 messages in last month*
*Inc. announcements on usage, etc.
Thank you!Q&A
TIME
…