Java Code Generation for Productivity

download Java Code Generation for Productivity

If you can't read please download the document

Transcript of Java Code Generation for Productivity

Practical Code Generation:
Java Productivity Enhancement

David Noble

[email protected]

Sr. Solutions Architect, Exist Global

San Gabriel Valley Java Users Group

http://www.sgvjug.org/

February 25, 2008

Target

Faster development

Less defects

http://flickr.com/photos/ntang/21736774

Target

http://flickr.com/photos/ntang/21736774

ToolsPracticesProductivity

Java

public List getIds(List items) {

List result = new ArrayList();

Iterator itemIterator = items.iterator();

while (itemIterator.hasNext()) {

item = (Item) itemIterator.next();

result.add(item.getId());

}

return result;

}

Example from Matt Good @ matt-good.net

Java

public List getIds(List items) {

List result = new ArrayList();

for (Item item : items) {

result.add(item.getId());

}

return result;

}

Example from Matt Good @ matt-good.net

Python

def get_ids(items):

return [item.id for item in items]

Verbosity

Succinctness is power

Paul Graham[1]

Case study [citation needed]

Yellowpages.com

Originally in Java: 100 KLOC

Converted to Rails: 10 KLOC

[1] http://www.paulgraham.com/power.html

Defect Rates

Bugs/LOC is basically constant

CMU study [citation needed]

LOC/day is basically constant

Fred Brooks

Syntax

Declarations

Casting

Generics

Data structures

Helper classes

Meta-programming Issues

Annotations

Reflection

Aspect-Oriented Programming (AOP)

Bytecode manipulation

Startup Weekend

One weekend to launch

Over a dozen companies started

Only 1 chose Java

DEMO
Rails web application

Rails Productivity

Project generation

File generation

Model-driven framework

Meta-programming

DEMO
Basic Java application

Java Productivity: IDE

Project generation

File generation

Code snippet generation

Java Productivity: Language

Annotations (JSR 175)

Metadata

Design time for tools

Execution time

Java Productivity: Framework

Model-driven frameworks

Grails

Wicket

NakedObjects

OpenXava

Java Productivity: AOP

Aspect - feature

Advice - behavior

Joinpoint - execution trigger

Pointcut - set of joinpoints

Targets - objects to apply aspects to

Introduction - add methods to object

Bytecode Manipulation

Example: persistence injection

Hibernate

TopLink

Libraries, etc

ASM, BCEL, CGLIB, Javassist, JiBX

DEMO
AppFuse

DEMO
GUI Builder

SOAP Web Services

WSDL to Java

Java to WSDL

Application Generators

CASE revisited

Resources

Resources

Code Generation Network

http://codegeneration.net/

Resources

Eclipse macros

Window > Preferences > Java > Editor > Templates

Annotations

http://java.sun.com/javase/6/docs/technotes/guides/language/annotations.html

http://www.developer.com/java/other/article.php/3556176

http://jcp.org/en/jsr/detail?id=175

Maven archetypes

http://maven.apache.org/guides/introduction/introduction-to-archetypes.html

Resources

AppFuse

http://appfuse.org/display/APF/AppFuse+Maven+Plugin

GWT

http://code.google.com/webtoolkit/

Resources

Wicket

http://wicket.apache.org/

Grails

http://grails.org/

NakedObjects

http://www.nakedobjects.org/

Resources

Metro (JAX-WS et al)

https://metro.dev.java.net/

Axis2

http://ws.apache.org/axis2/

CXF (formerly XFire)

http://cxf.apache.org/

Resources

Netbeans Matisse

http://www.netbeans.org/features/java/swing.html

Eclipse VE

http://wiki.eclipse.org/VE

Resources

AOP (Aspect Oriented Programming)

AspectJ

http://www.eclipse.org/aspectj/

JBoss AOP

http://www.jboss.org/jbossaop/

Spring

http://springframework.org/about

Resources

Eclipse JET

http://www.eclipse.org/modeling/m2t/?project=jet

Eclipse EMF

http://www.eclipse.org/modeling/emf/

Resources

Sculptor

http://fornax-platform.org/cp/display/fornax/Sculptor+(CSC)

http://www.theserverside.com/tt/articles/article.tss?l=ProductivityWithSculptor

OptimalJ

http://frontline.compuware.com/javacentral/tools/

Resources

MDA (model driven architecture)

http://www.omg.org/mda/

Executable UML

http://en.wikipedia.org/wiki/Executable_UML

DISCUSSION
Productivity, practices, tools

Thanks for coming!

David [email protected]

Click to edit the title text

Click to edit the outline text format

Second Outline Level

Third Outline Level

Fourth Outline Level

Fifth Outline Level

Sixth Outline Level

Seventh Outline Level

Eighth Outline Level

Ninth Outline Level

Click to edit the title text format

Click to edit the outline text format

Second Outline Level

Third Outline Level

Fourth Outline Level

Fifth Outline Level

Sixth Outline Level

Seventh Outline Level

Eighth Outline Level

Ninth Outline Level