Turning Ideas Into Code Faster

  • 419 views
Uploaded on

I presented these slides as a lightning talk at the EclipseCon Europe 2013 …

I presented these slides as a lightning talk at the EclipseCon Europe 2013
http://www.eclipsecon.org/europe2013/lightning-talks

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
419
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
8
Comments
0
Likes
2

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. turn ideas into code faster Moritz Eysholdt itemis AG
  • 2. turn ideas into code faster ! Java Moritz Eysholdt itemis AG
  • 3. ! Java
  • 4. ! Java
  • 5. immutability dispatch data_extraction polymorphism caching data_transformation ! Java design_patterns state null_state events persistence localization
  • 6. immutability for dispatch data_extraction caching if implements extends polymorphism data_transformation ! Java design_patterns while state null_state events break ; persistence localization return fields variables
  • 7. immutability dispatch caching data_transformation if for implements data_extraction polymorphism ! state null_state events localization persistence design_patterns extends Java while break variables fields ; return
  • 8. ! Xtend Java
  • 9. functional_programming dispatch templates ! Xtend lambdas extension_methods active_annotations Java
  • 10. functional_programming dispatch templates ! Xtend lambdas extension_methods active_annotations Java
  • 11. Java for-if-spaghetti List<String> result = new ArrayList<String>(); for(Integer integer: integers) { if(integer > 10) { result.add(“Int: ” + integer); } } val result = integers.filter[it > 10].map[“Int” + it] Xtend functional programming
  • 12. Java if-else-spaghetti String result = null; if(foo != null) { result = foo.value; } String result; if(bar != null) { result = bar; } else { result = “unset”; } val result = foo?.value val result = bar ?: “unset” Xtend null-safe operators
  • 13. Java call non-member methods backwards(reading(are(you(“X”)))) “X”.you.are.reading.backwards Xtend extension methods
  • 14. Java type-def boilerplate Map<String, Set<Integer>> ints = new HashMap<String, Set<Integer>>(); val ints = new HashMap<String, Set<Integer>> Xtend type inference
  • 15. Java if-else-instanceof-spaghetti if(shape instanceof Rect) return ((Rect) shape).width * ((Rect) shape).height; else if(shape instanceof Circle) return ((Circle) shape).radius * 2 * PI; else return 0; return switch shape { Rect: shape.width * shape.height Circle: shape.radius * 2 * PI default: 0 } Xtend smart switch expression
  • 16. Java if-else-instanceof-spaghetti Xtend public double surface(Shape shape) { if(shape instanceof Rect) return surface((Rect) shape); else if(shape instanceof Circle) return surface((Circle) shape); return 0; } protected double surface(Rectangle rect) { return rect.width * rect.height; } protected double surface(Circle circle) { return circle.radius * 2 + PI; } dispatch methods def dispatch surface(Rectangle rect) { rect.width * rect.height; } def dispatch surface(Circle circle) { circle.radius * 2 + PI; }
  • 17. Java immutable class boilerplate @Data class Point { int x int y } public class Point { private final int x; private final int y; public public public public public public Foo(int x, int x) { ... } int getX() { ... } int getY() { ... } int hashCode() { ... } boolean equals(Object obj) { ... } String toString() { ... } } Xtend @Data annotation
  • 18. Java getter/setter boilerplate public class Point { private int x; private int y; public public public public int getX() { ... int getY() { ... void setX(int x) void setY(int y) } } { ... } { ... } class Point { @Property int x @Property int y } } Xtend @Property annotation
  • 19. Java boilerplate or design pattern public class MyClass { ... ... ... ... ... ... ... ... ... ... ... ... { { { { ... ... ... ... } } } } @MyAnnotation class MyClass { ... } } Xtend active annotation
  • 20. EOF