java - qcon san francisco · 2013-05-20 · • large scale socket management using nio ... a day...

215
Java.next QConSF, November 2011 Erik Onnen Wednesday, November 16, 2011

Upload: others

Post on 13-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Java.nextQConSF, November 2011

Erik Onnen

Wednesday, November 16, 2011

Page 2: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

About Me

• Director of Architecture at Urban Airship (1 year)

• Previously Principal Engineer at Jive Software (3 years)

• 13 years writing Java, Python, C++

• Decent amount of hacking in Scala, Clojure, Ruby

Wednesday, November 16, 2011

Page 3: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Caveats

Wednesday, November 16, 2011

Page 4: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Caveats

• I like lots of things about Scala, Clojure and Groovy

Wednesday, November 16, 2011

Page 5: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Caveats

• I like lots of things about Scala, Clojure and Groovy

• I am not a programming language student, author or expert

Wednesday, November 16, 2011

Page 6: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Caveats

• I like lots of things about Scala, Clojure and Groovy

• I am not a programming language student, author or expert

• I am a practitioner

Wednesday, November 16, 2011

Page 7: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Caveats

• I like lots of things about Scala, Clojure and Groovy

• I am not a programming language student, author or expert

• I am a practitioner

• Write lots of code quickly with good tools

Wednesday, November 16, 2011

Page 8: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Caveats

• I like lots of things about Scala, Clojure and Groovy

• I am not a programming language student, author or expert

• I am a practitioner

• Write lots of code quickly with good tools

• Move quickly when troubleshooting production code

Wednesday, November 16, 2011

Page 9: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Caveats

• I like lots of things about Scala, Clojure and Groovy

• I am not a programming language student, author or expert

• I am a practitioner

• Write lots of code quickly with good tools

• Move quickly when troubleshooting production code

• Move quickly when re-engaging with code

Wednesday, November 16, 2011

Page 10: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

In this Talk

• About Urban Airship

• Java at Urban Airship

• Java and the JVM

• Dat Tool

• Come at me Troll!

• What do we need to improve?

• What does the language need to improve?

Wednesday, November 16, 2011

Page 11: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What is an Urban Airship?

• Hosting for mobile services that developers should not build themselves

• Unified API for services across platforms

• SLAs for throughput, latency

Wednesday, November 16, 2011

Page 12: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

FACT

Wednesday, November 16, 2011

Page 13: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

FACT

• Over 50 Java services in production

Wednesday, November 16, 2011

Page 14: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

FACT

• Over 50 Java services in production

• HTTP endpoints

Wednesday, November 16, 2011

Page 15: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

FACT

• Over 50 Java services in production

• HTTP endpoints

• Databases

Wednesday, November 16, 2011

Page 16: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

FACT

• Over 50 Java services in production

• HTTP endpoints

• Databases

• Message routing and delivery

Wednesday, November 16, 2011

Page 17: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

FACT

• Over 50 Java services in production

• HTTP endpoints

• Databases

• Message routing and delivery

• Large scale socket management using NIO

Wednesday, November 16, 2011

Page 18: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

FACT

• Over 50 Java services in production

• HTTP endpoints

• Databases

• Message routing and delivery

• Large scale socket management using NIO

• Large scale data analysis

Wednesday, November 16, 2011

Page 19: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

FACT

• Over 50 Java services in production

• HTTP endpoints

• Databases

• Message routing and delivery

• Large scale socket management using NIO

• Large scale data analysis

• We also eschew most “Enterprise” Java

Wednesday, November 16, 2011

Page 20: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

FACT

• Over 50 Java services in production

• HTTP endpoints

• Databases

• Message routing and delivery

• Large scale socket management using NIO

• Large scale data analysis

• We also eschew most “Enterprise” Java

• Everything in this talk we practice (and it works really well for us)

Wednesday, November 16, 2011

Page 21: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

FACT

46%

28%

3%

21%2%

A Day in UA Engineering

New Feature DevelopmentSustaining EngineeringIRC TomfooleryProduction SupportBeer/Pong

Wednesday, November 16, 2011

Page 22: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Use The JVM?

Wednesday, November 16, 2011

Page 23: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Use The JVM?

• Fast.

Wednesday, November 16, 2011

Page 24: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Use The JVM?

• Fast.

• Networking, disk I/O, maths

Wednesday, November 16, 2011

Page 25: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Use The JVM?

• Fast.

• Networking, disk I/O, maths

• Unless the GC is running :(

Wednesday, November 16, 2011

Page 26: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Use The JVM?

• Fast.

• Networking, disk I/O, maths

• Unless the GC is running :(

• Consistent, coherent memory model and concurrency - no “undefined behavior”

Wednesday, November 16, 2011

Page 27: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Use The JVM?

• Fast.

• Networking, disk I/O, maths

• Unless the GC is running :(

• Consistent, coherent memory model and concurrency - no “undefined behavior”

• Scalable NIO

Wednesday, November 16, 2011

Page 28: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Use The JVM?

• Fast.

• Networking, disk I/O, maths

• Unless the GC is running :(

• Consistent, coherent memory model and concurrency - no “undefined behavior”

• Scalable NIO

• Threading, with a clean signal and interrupt handling

Wednesday, November 16, 2011

Page 29: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Use The JVM?

• Fast.

• Networking, disk I/O, maths

• Unless the GC is running :(

• Consistent, coherent memory model and concurrency - no “undefined behavior”

• Scalable NIO

• Threading, with a clean signal and interrupt handling

• Introspect the runtime with little to no impact

Wednesday, November 16, 2011

Page 30: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Use The JVM?

• Fast.

• Networking, disk I/O, maths

• Unless the GC is running :(

• Consistent, coherent memory model and concurrency - no “undefined behavior”

• Scalable NIO

• Threading, with a clean signal and interrupt handling

• Introspect the runtime with little to no impact

• Snapshot the runtime under duress and analyze later

Wednesday, November 16, 2011

Page 31: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Use The JVM?

• Fast.

• Networking, disk I/O, maths

• Unless the GC is running :(

• Consistent, coherent memory model and concurrency - no “undefined behavior”

• Scalable NIO

• Threading, with a clean signal and interrupt handling

• Introspect the runtime with little to no impact

• Snapshot the runtime under duress and analyze later

• But - none of these are Java-specific

Wednesday, November 16, 2011

Page 32: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

Wednesday, November 16, 2011

Page 33: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

• There are many hammers available

Wednesday, November 16, 2011

Page 34: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

• There are many hammers available

• All are good at something

Wednesday, November 16, 2011

Page 35: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

• There are many hammers available

• All are good at something

• They are almost all interesting

Wednesday, November 16, 2011

Page 36: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

• There are many hammers available

• All are good at something

• They are almost all interesting

• Not all are OK at everything

Wednesday, November 16, 2011

Page 37: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

Wednesday, November 16, 2011

Page 38: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

• Java as a language is inherently simple - WYSIWYG (mostly)

Wednesday, November 16, 2011

Page 39: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

• Java as a language is inherently simple - WYSIWYG (mostly)

• Class behaviors are known by reading class code

Wednesday, November 16, 2011

Page 40: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

• Java as a language is inherently simple - WYSIWYG (mostly)

• Class behaviors are known by reading class code

• No multiple inheritance

Wednesday, November 16, 2011

Page 41: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

• Java as a language is inherently simple - WYSIWYG (mostly)

• Class behaviors are known by reading class code

• No multiple inheritance

• No monkey patching or trait collision rules to memorize

Wednesday, November 16, 2011

Page 42: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

• Java as a language is inherently simple - WYSIWYG (mostly)

• Class behaviors are known by reading class code

• No multiple inheritance

• No monkey patching or trait collision rules to memorize

• No hacking the global namespace or meta class munging

Wednesday, November 16, 2011

Page 43: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

• Java as a language is inherently simple - WYSIWYG (mostly)

• Class behaviors are known by reading class code

• No multiple inheritance

• No monkey patching or trait collision rules to memorize

• No hacking the global namespace or meta class munging

• No duck typing or hidden type coercion

Wednesday, November 16, 2011

Page 44: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

• Java as a language is inherently simple - WYSIWYG (mostly)

• Class behaviors are known by reading class code

• No multiple inheritance

• No monkey patching or trait collision rules to memorize

• No hacking the global namespace or meta class munging

• No duck typing or hidden type coercion

• Favors principle of least astonishment

Wednesday, November 16, 2011

Page 45: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

• Java as a language is inherently simple - WYSIWYG (mostly)

• Class behaviors are known by reading class code

• No multiple inheritance

• No monkey patching or trait collision rules to memorize

• No hacking the global namespace or meta class munging

• No duck typing or hidden type coercion

• Favors principle of least astonishment

“When you specifically try to dumb down good ideas for the masses, you reveal your contempt of said masses. Case study: Java.” - David Hansson

Wednesday, November 16, 2011

Page 46: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

Wednesday, November 16, 2011

Page 47: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

• Java is generally easy to read

Wednesday, November 16, 2011

Page 48: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

• Java is generally easy to read

• Easy to read means easy to maintain

Wednesday, November 16, 2011

Page 49: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

• Java is generally easy to read

• Easy to read means easy to maintain

Loop Recognition in C++/Java/Go/Scala - Robert Hundt, Google

Wednesday, November 16, 2011

Page 50: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

• Java is generally easy to read

• Easy to read means easy to maintain

Loop Recognition in C++/Java/Go/Scala - Robert Hundt, Google

Wednesday, November 16, 2011

Page 51: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

• Java is generally easy to read

• Easy to read means easy to maintain

Loop Recognition in C++/Java/Go/Scala - Robert Hundt, Google

Wednesday, November 16, 2011

Page 52: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

Wednesday, November 16, 2011

Page 53: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?• Almost no transparent performance degradation

Wednesday, November 16, 2011

Page 54: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?• Almost no transparent performance degradation

Wednesday, November 16, 2011

Page 55: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

Wednesday, November 16, 2011

Page 56: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?• No impedance with runtime introspection

Wednesday, November 16, 2011

Page 57: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?• No impedance with runtime introspection

• A thread dump is a thread dump

Wednesday, November 16, 2011

Page 58: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?• No impedance with runtime introspection

• A thread dump is a thread dump

• A heap dump is a heap dump

Wednesday, November 16, 2011

Page 59: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?• No impedance with runtime introspection

• A thread dump is a thread dump

• A heap dump is a heap dump

Wednesday, November 16, 2011

Page 60: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

Wednesday, November 16, 2011

Page 61: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?• Little idiomatic impedance with the runtime

Wednesday, November 16, 2011

Page 62: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?• Little idiomatic impedance with the runtime

http://dev.bizo.com/2010/01/scala-supports-non-local-returns.htmlWednesday, November 16, 2011

Page 63: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?• Little idiomatic impedance with the runtime

http://dev.bizo.com/2010/01/scala-supports-non-local-returns.htmlWednesday, November 16, 2011

Page 64: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?

Wednesday, November 16, 2011

Page 65: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?• The tools

Wednesday, November 16, 2011

Page 66: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?• The tools

• People have mixed reactions to refactoring tools

Wednesday, November 16, 2011

Page 67: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?• The tools

• People have mixed reactions to refactoring tools

• IDEs starting to “learn”

Wednesday, November 16, 2011

Page 68: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?• The tools

• People have mixed reactions to refactoring tools

• IDEs starting to “learn”

• Find Usages

Wednesday, November 16, 2011

Page 69: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?• The tools

• People have mixed reactions to refactoring tools

• IDEs starting to “learn”

• Find Usages

• The ecosystem

Wednesday, November 16, 2011

Page 70: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?• The tools

• People have mixed reactions to refactoring tools

• IDEs starting to “learn”

• Find Usages

• The ecosystem

• One of if not the largest collections of FOSS libraries in existence

Wednesday, November 16, 2011

Page 71: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Why Java on the JVM?• The tools

• People have mixed reactions to refactoring tools

• IDEs starting to “learn”

• Find Usages

• The ecosystem

• One of if not the largest collections of FOSS libraries in existence

• No language impedance

Wednesday, November 16, 2011

Page 72: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Dat Tool

Wednesday, November 16, 2011

Page 73: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Dat Tool

Wednesday, November 16, 2011

Page 74: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Dat Tool

Wednesday, November 16, 2011

Page 75: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Dat Tool

Wednesday, November 16, 2011

Page 76: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Dat Tool

Wednesday, November 16, 2011

Page 77: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Dat Tool

Wednesday, November 16, 2011

Page 78: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Dat Tool

Wednesday, November 16, 2011

Page 79: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Dat Tool

• Our job as developers is to implement something of business value

Wednesday, November 16, 2011

Page 80: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Dat Tool

• Our job as developers is to implement something of business value

• Things that make us more productive are good

Wednesday, November 16, 2011

Page 81: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Dat Tool

• Our job as developers is to implement something of business value

• Things that make us more productive are good

• It’s OK to use tools to help you build things if they improve your productivity and further the roles of a developer

Wednesday, November 16, 2011

Page 82: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Dat Tool

• Our job as developers is to implement something of business value

• Things that make us more productive are good

• It’s OK to use tools to help you build things if they improve your productivity and further the roles of a developer

• Most IDEs are completely misunderstood by someone who has never tried them - “I would miss my modal editing”

Wednesday, November 16, 2011

Page 83: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Come at me Troll!

Wednesday, November 16, 2011

Page 84: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Come at me Troll!

But Java doesn’t have closures!

Wednesday, November 16, 2011

Page 85: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Come at me Troll!

But Java doesn’t have closures!

• Java does have closures (imperfect closures to be exact)

Wednesday, November 16, 2011

Page 86: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Come at me Troll!

But Java doesn’t have closures!

• Java does have closures (imperfect closures to be exact)

• Java does not have lambda expressions (yet)

Wednesday, November 16, 2011

Page 87: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Come at me Troll!

But Java doesn’t have closures!

• Java does have closures (imperfect closures to be exact)

• Java does not have lambda expressions (yet)

• They’re nowhere near as painful as people claim

Wednesday, November 16, 2011

Page 88: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Come at me Troll!

But Java doesn’t have closures!

• Java does have closures (imperfect closures to be exact)

• Java does not have lambda expressions (yet)

• They’re nowhere near as painful as people claim

Wednesday, November 16, 2011

Page 89: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Come at me Troll!

Wednesday, November 16, 2011

Page 90: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Come at me Troll!

But Java makes me type so much and that hurts my delicate hands!

Wednesday, November 16, 2011

Page 91: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Come at me Troll!

But Java makes me type so much and that hurts my delicate hands!

• Stop pounding the nail with your head

Wednesday, November 16, 2011

Page 92: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Come at me Troll!

But Java makes me type so much and that hurts my delicate hands!

• Stop pounding the nail with your head

Wednesday, November 16, 2011

Page 93: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Come at me Troll!

Wednesday, November 16, 2011

Page 94: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Come at me Troll!

But Java makes me type so much and that hurts my delicate hands!

Wednesday, November 16, 2011

Page 95: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Come at me Troll!

But Java makes me type so much and that hurts my delicate hands!

• val numbers = Array[Integer](1,2,3,4)

Wednesday, November 16, 2011

Page 96: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Come at me Troll!

But Java makes me type so much and that hurts my delicate hands!

• val numbers = Array[Integer](1,2,3,4)

• val numbers = Array(1,2,3,4)

Wednesday, November 16, 2011

Page 97: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Come at me Troll!

But Java makes me type so much and that hurts my delicate hands!

• val numbers = Array[Integer](1,2,3,4)

• val numbers = Array(1,2,3,4)

• int[] numbers = new int[]{1,2,3,4};

Wednesday, November 16, 2011

Page 98: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Come at me Troll!

But Java makes me type so much and that hurts my delicate hands!

• val numbers = Array[Integer](1,2,3,4)

• val numbers = Array(1,2,3,4)

• int[] numbers = new int[]{1,2,3,4};

Hey, that example is not fair!

Wednesday, November 16, 2011

Page 99: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Come at me Troll!

But Java makes me type so much and that hurts my delicate hands!

• val numbers = Array[Integer](1,2,3,4)

• val numbers = Array(1,2,3,4)

• int[] numbers = new int[]{1,2,3,4};

Hey, that example is not fair!

• val str = “SPORTS!”

Wednesday, November 16, 2011

Page 100: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Come at me Troll!

But Java makes me type so much and that hurts my delicate hands!

• val numbers = Array[Integer](1,2,3,4)

• val numbers = Array(1,2,3,4)

• int[] numbers = new int[]{1,2,3,4};

Hey, that example is not fair!

• val str = “SPORTS!”

• final String str = “SPORTS!”;

Wednesday, November 16, 2011

Page 101: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Come at me Troll!

But Java has soooo much line noise it’s hard to read!

• Stop pounding the nail with your head

• The human brain simply doesn’t work like that

Wednesday, November 16, 2011

Page 102: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change

Wednesday, November 16, 2011

Page 103: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Java gets a bad rap, often for baggage in the ecosystem as a

whole rather than the language specifically

Wednesday, November 16, 2011

Page 104: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Java gets a bad rap, often for baggage in the ecosystem as a

whole rather than the language specifically

• Some of this is due to big vendors in the space

Wednesday, November 16, 2011

Page 105: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Java gets a bad rap, often for baggage in the ecosystem as a

whole rather than the language specifically

• Some of this is due to big vendors in the space

• Some of it is because of the bloat

Wednesday, November 16, 2011

Page 106: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Java gets a bad rap, often for baggage in the ecosystem as a

whole rather than the language specifically

• Some of this is due to big vendors in the space

• Some of it is because of the bloat

• But usually, it’s because we Java developers learn too slowly from things going on around us and get stuck in our ways

Wednesday, November 16, 2011

Page 107: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change

Wednesday, November 16, 2011

Page 108: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - view the world as a pattern waiting to happen

Wednesday, November 16, 2011

Page 109: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - view the world as a pattern waiting to happen

• Patterns, Enterprise Patterns, Anti-patterns and please yes, buy my book

Wednesday, November 16, 2011

Page 110: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - view the world as a pattern waiting to happen

• Patterns, Enterprise Patterns, Anti-patterns and please yes, buy my book

• Do - get your job done

Wednesday, November 16, 2011

Page 111: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - view the world as a pattern waiting to happen

• Patterns, Enterprise Patterns, Anti-patterns and please yes, buy my book

• Do - get your job done

• Your business sponsors don’t care that you used FlyweightSingletonFactoryDelegateVisitor.java

Wednesday, November 16, 2011

Page 112: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - view the world as a pattern waiting to happen

• Patterns, Enterprise Patterns, Anti-patterns and please yes, buy my book

• Do - get your job done

• Your business sponsors don’t care that you used FlyweightSingletonFactoryDelegateVisitor.java

• Of course, some usage is fine but focus on writing code - patterns don’t define correctness

Wednesday, November 16, 2011

Page 113: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change

Wednesday, November 16, 2011

Page 114: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - be afraid to have non-domain code in your code

Wednesday, November 16, 2011

Page 115: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - be afraid to have non-domain code in your code

• If latency to a system matters, measure that explicitly and overtly

Wednesday, November 16, 2011

Page 116: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - be afraid to have non-domain code in your code

• If latency to a system matters, measure that explicitly and overtly

• Be tempted into talk of AoP and cross-cutting concerns - your job isn’t just coding, it’s also sustaining and troubleshooting

Wednesday, November 16, 2011

Page 117: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - be afraid to have non-domain code in your code

• If latency to a system matters, measure that explicitly and overtly

• Be tempted into talk of AoP and cross-cutting concerns - your job isn’t just coding, it’s also sustaining and troubleshooting

• Concurrency doesn’t align w/ business concerns anyway

Wednesday, November 16, 2011

Page 118: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - be afraid to have non-domain code in your code

• If latency to a system matters, measure that explicitly and overtly

• Be tempted into talk of AoP and cross-cutting concerns - your job isn’t just coding, it’s also sustaining and troubleshooting

• Concurrency doesn’t align w/ business concerns anyway

• Business domain doesn’t have “logs” but OPS needs to

Wednesday, November 16, 2011

Page 119: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - be afraid to have non-domain code in your code

• If latency to a system matters, measure that explicitly and overtly

• Be tempted into talk of AoP and cross-cutting concerns - your job isn’t just coding, it’s also sustaining and troubleshooting

• Concurrency doesn’t align w/ business concerns anyway

• Business domain doesn’t have “logs” but OPS needs to

• Do - leverage proven, simple libraries to help

Wednesday, November 16, 2011

Page 120: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - be afraid to have non-domain code in your code

• If latency to a system matters, measure that explicitly and overtly

• Be tempted into talk of AoP and cross-cutting concerns - your job isn’t just coding, it’s also sustaining and troubleshooting

• Concurrency doesn’t align w/ business concerns anyway

• Business domain doesn’t have “logs” but OPS needs to

• Do - leverage proven, simple libraries to help

• Coda Hale’s metrics library out of Yammer is essential

Wednesday, November 16, 2011

Page 121: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - be afraid to have non-domain code in your code

• If latency to a system matters, measure that explicitly and overtly

• Be tempted into talk of AoP and cross-cutting concerns - your job isn’t just coding, it’s also sustaining and troubleshooting

• Concurrency doesn’t align w/ business concerns anyway

• Business domain doesn’t have “logs” but OPS needs to

• Do - leverage proven, simple libraries to help

• Coda Hale’s metrics library out of Yammer is essential

• Log4J, SLF4J, lots of good choices

Wednesday, November 16, 2011

Page 122: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change

Wednesday, November 16, 2011

Page 123: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - learn from Erlang’s immutable data structures

Wednesday, November 16, 2011

Page 124: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - learn from Erlang’s immutable data structures

• Move data using immutable models

Wednesday, November 16, 2011

Page 125: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - learn from Erlang’s immutable data structures

• Move data using immutable models

• Fast, efficient, easy to reason about, thread safe

Wednesday, November 16, 2011

Page 126: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - learn from Erlang’s immutable data structures

• Move data using immutable models

• Fast, efficient, easy to reason about, thread safe

• Easy to put down the wire (Jackson, PBs) or into a schema-less store

Wednesday, November 16, 2011

Page 127: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - learn from Erlang’s immutable data structures

• Move data using immutable models

• Fast, efficient, easy to reason about, thread safe

• Easy to put down the wire (Jackson, PBs) or into a schema-less store

• Just properties, no getFoo

Wednesday, November 16, 2011

Page 128: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - learn from Erlang’s immutable data structures

• Move data using immutable models

• Fast, efficient, easy to reason about, thread safe

• Easy to put down the wire (Jackson, PBs) or into a schema-less store

• Just properties, no getFoo

• No behaviors

Wednesday, November 16, 2011

Page 129: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - learn from Erlang’s immutable data structures

• Move data using immutable models

• Fast, efficient, easy to reason about, thread safe

• Easy to put down the wire (Jackson, PBs) or into a schema-less store

• Just properties, no getFoo

• No behaviors

• Do not - assume your classes need to model “real world” things

Wednesday, November 16, 2011

Page 130: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - learn from Erlang’s immutable data structures

• Move data using immutable models

• Fast, efficient, easy to reason about, thread safe

• Easy to put down the wire (Jackson, PBs) or into a schema-less store

• Just properties, no getFoo

• No behaviors

• Do not - assume your classes need to model “real world” things

• A class doesn’t exist in the “real world”, don’t try and make it look like that

Wednesday, November 16, 2011

Page 131: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - learn from Erlang’s immutable data structures

• Move data using immutable models

• Fast, efficient, easy to reason about, thread safe

• Easy to put down the wire (Jackson, PBs) or into a schema-less store

• Just properties, no getFoo

• No behaviors

• Do not - assume your classes need to model “real world” things

• A class doesn’t exist in the “real world”, don’t try and make it look like that

• Bob doesn’t have a save() methodWednesday, November 16, 2011

Page 132: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change

Wednesday, November 16, 2011

Page 133: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - create coarse grained, transaction-aligned APIs

Wednesday, November 16, 2011

Page 134: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - create coarse grained, transaction-aligned APIs

• Leave no ambiguity about what impact an operation has on a back-end data store

Wednesday, November 16, 2011

Page 135: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - create coarse grained, transaction-aligned APIs

• Leave no ambiguity about what impact an operation has on a back-end data store

• Measure latency to external services

Wednesday, November 16, 2011

Page 136: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - create coarse grained, transaction-aligned APIs

• Leave no ambiguity about what impact an operation has on a back-end data store

• Measure latency to external services

• Easier to reason about concurrency (implementation and consumption)

Wednesday, November 16, 2011

Page 137: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - create coarse grained, transaction-aligned APIs

• Leave no ambiguity about what impact an operation has on a back-end data store

• Measure latency to external services

• Easier to reason about concurrency (implementation and consumption)

• Go’s behavior separate from data

Wednesday, November 16, 2011

Page 138: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - create coarse grained, transaction-aligned APIs

• Leave no ambiguity about what impact an operation has on a back-end data store

• Measure latency to external services

• Easier to reason about concurrency (implementation and consumption)

• Go’s behavior separate from data

• Do not - use magic, code generating systems that hide transactions across APIs

Wednesday, November 16, 2011

Page 139: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - create coarse grained, transaction-aligned APIs

• Leave no ambiguity about what impact an operation has on a back-end data store

• Measure latency to external services

• Easier to reason about concurrency (implementation and consumption)

• Go’s behavior separate from data

• Do not - use magic, code generating systems that hide transactions across APIs

• Leaky abstraction - you call a method, a TXN happens

Wednesday, November 16, 2011

Page 140: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - create coarse grained, transaction-aligned APIs

• Leave no ambiguity about what impact an operation has on a back-end data store

• Measure latency to external services

• Easier to reason about concurrency (implementation and consumption)

• Go’s behavior separate from data

• Do not - use magic, code generating systems that hide transactions across APIs

• Leaky abstraction - you call a method, a TXN happens

• When performance suffers, you will want to know what is going on but can’t

Wednesday, November 16, 2011

Page 141: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change

Wednesday, November 16, 2011

Page 142: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - create coarse grained, transaction-aligned APIs operating on

immutable models

Wednesday, November 16, 2011

Page 143: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - create coarse grained, transaction-aligned APIs operating on

immutable models

• Learn from Go’s keeping operations separate from data

Wednesday, November 16, 2011

Page 144: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - create coarse grained, transaction-aligned APIs operating on

immutable models

• Learn from Go’s keeping operations separate from data

• Return clones of data but nothing that has ties back in to a data store

Wednesday, November 16, 2011

Page 145: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - create coarse grained, transaction-aligned APIs operating on

immutable models

• Learn from Go’s keeping operations separate from data

• Return clones of data but nothing that has ties back in to a data store

• Easier to reason about, no ambiguity, pass as messages

Wednesday, November 16, 2011

Page 146: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - create coarse grained, transaction-aligned APIs operating on

immutable models

• Learn from Go’s keeping operations separate from data

• Return clones of data but nothing that has ties back in to a data store

• Easier to reason about, no ambiguity, pass as messages

• Do not - use magic, code generating systems that hide transactions across APIs

Wednesday, November 16, 2011

Page 147: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - create coarse grained, transaction-aligned APIs operating on

immutable models

• Learn from Go’s keeping operations separate from data

• Return clones of data but nothing that has ties back in to a data store

• Easier to reason about, no ambiguity, pass as messages

• Do not - use magic, code generating systems that hide transactions across APIs

• A class doesn’t exist in the “real world”, don’t try and make it look like the real world

Wednesday, November 16, 2011

Page 148: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - create coarse grained, transaction-aligned APIs operating on

immutable models

• Learn from Go’s keeping operations separate from data

• Return clones of data but nothing that has ties back in to a data store

• Easier to reason about, no ambiguity, pass as messages

• Do not - use magic, code generating systems that hide transactions across APIs

• A class doesn’t exist in the “real world”, don’t try and make it look like the real world

• Bob doesn’t have a save() method

Wednesday, November 16, 2011

Page 149: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - create coarse grained, transaction-aligned APIs operating on

immutable models

• Learn from Go’s keeping operations separate from data

• Return clones of data but nothing that has ties back in to a data store

• Easier to reason about, no ambiguity, pass as messages

• Do not - use magic, code generating systems that hide transactions across APIs

• A class doesn’t exist in the “real world”, don’t try and make it look like the real world

• Bob doesn’t have a save() method

• Nest models in behaviors, in models in behaviorsWednesday, November 16, 2011

Page 150: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change

Wednesday, November 16, 2011

Page 151: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - be afraid to write SQL or actually new an object

Wednesday, November 16, 2011

Page 152: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - be afraid to write SQL or actually new an object

• Executing an SQL query is about the easiest thing you can do

Wednesday, November 16, 2011

Page 153: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - be afraid to write SQL or actually new an object

• Executing an SQL query is about the easiest thing you can do

• Mapping it to some data isn’t all that hard either

Wednesday, November 16, 2011

Page 154: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - be afraid to write SQL or actually new an object

• Executing an SQL query is about the easiest thing you can do

• Mapping it to some data isn’t all that hard either

• Test it and move on

Wednesday, November 16, 2011

Page 155: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - be afraid to write SQL or actually new an object

• Executing an SQL query is about the easiest thing you can do

• Mapping it to some data isn’t all that hard either

• Test it and move on

• Do - question configuration complexity and network abstractions

Wednesday, November 16, 2011

Page 156: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - be afraid to write SQL or actually new an object

• Executing an SQL query is about the easiest thing you can do

• Mapping it to some data isn’t all that hard either

• Test it and move on

• Do - question configuration complexity and network abstractions

• If you go to the wire, that should be in your face

Wednesday, November 16, 2011

Page 157: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - be afraid to write SQL or actually new an object

• Executing an SQL query is about the easiest thing you can do

• Mapping it to some data isn’t all that hard either

• Test it and move on

• Do - question configuration complexity and network abstractions

• If you go to the wire, that should be in your face

• XML configurations are an immediate indicator of impending complexity

Wednesday, November 16, 2011

Page 158: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - be afraid to write SQL or actually new an object

• Executing an SQL query is about the easiest thing you can do

• Mapping it to some data isn’t all that hard either

• Test it and move on

• Do - question configuration complexity and network abstractions

• If you go to the wire, that should be in your face

• XML configurations are an immediate indicator of impending complexity

• Realize IoC is not in and of itself a bad thing but you don’t need a framework to accomplish it

Wednesday, November 16, 2011

Page 159: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change

Wednesday, November 16, 2011

Page 160: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - use XML for anything. Ever.

Wednesday, November 16, 2011

Page 161: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - use XML for anything. Ever.

• XML is pretty much good at nothing other than cementing unnecessary complexity at every level

Wednesday, November 16, 2011

Page 162: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - use XML for anything. Ever.

• XML is pretty much good at nothing other than cementing unnecessary complexity at every level

• XML is not code!

Wednesday, November 16, 2011

Page 163: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - use XML for anything. Ever.

• XML is pretty much good at nothing other than cementing unnecessary complexity at every level

• XML is not code!

• Do - use simple, standard mechanisms

Wednesday, November 16, 2011

Page 164: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - use XML for anything. Ever.

• XML is pretty much good at nothing other than cementing unnecessary complexity at every level

• XML is not code!

• Do - use simple, standard mechanisms

• For configuration files, use properties files

Wednesday, November 16, 2011

Page 165: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - use XML for anything. Ever.

• XML is pretty much good at nothing other than cementing unnecessary complexity at every level

• XML is not code!

• Do - use simple, standard mechanisms

• For configuration files, use properties files

• Easier to use in modern automation environments like Puppet

Wednesday, November 16, 2011

Page 166: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - use XML for anything. Ever.

• XML is pretty much good at nothing other than cementing unnecessary complexity at every level

• XML is not code!

• Do - use simple, standard mechanisms

• For configuration files, use properties files

• Easier to use in modern automation environments like Puppet

• Commons Config rocks

Wednesday, November 16, 2011

Page 167: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - use XML for anything. Ever.

• XML is pretty much good at nothing other than cementing unnecessary complexity at every level

• XML is not code!

• Do - use simple, standard mechanisms

• For configuration files, use properties files

• Easier to use in modern automation environments like Puppet

• Commons Config rocks

• For wire data, use PBs or JSON

Wednesday, November 16, 2011

Page 168: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change

Wednesday, November 16, 2011

Page 169: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - accept the “Enterprise” mentality

Wednesday, November 16, 2011

Page 170: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - accept the “Enterprise” mentality

• Just say no to EARs, EJBs, and mostly WARs

Wednesday, November 16, 2011

Page 171: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - accept the “Enterprise” mentality

• Just say no to EARs, EJBs, and mostly WARs

• More XML, complex build process, complex deploy process

Wednesday, November 16, 2011

Page 172: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - accept the “Enterprise” mentality

• Just say no to EARs, EJBs, and mostly WARs

• More XML, complex build process, complex deploy process

• Generally prohibit important things

Wednesday, November 16, 2011

Page 173: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - accept the “Enterprise” mentality

• Just say no to EARs, EJBs, and mostly WARs

• More XML, complex build process, complex deploy process

• Generally prohibit important things

• Not needed for scale

Wednesday, November 16, 2011

Page 174: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - accept the “Enterprise” mentality

• Just say no to EARs, EJBs, and mostly WARs

• More XML, complex build process, complex deploy process

• Generally prohibit important things

• Not needed for scale

• Do - write small, discrete, stand-alone services

Wednesday, November 16, 2011

Page 175: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - accept the “Enterprise” mentality

• Just say no to EARs, EJBs, and mostly WARs

• More XML, complex build process, complex deploy process

• Generally prohibit important things

• Not needed for scale

• Do - write small, discrete, stand-alone services

• Easier to operate

Wednesday, November 16, 2011

Page 176: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - accept the “Enterprise” mentality

• Just say no to EARs, EJBs, and mostly WARs

• More XML, complex build process, complex deploy process

• Generally prohibit important things

• Not needed for scale

• Do - write small, discrete, stand-alone services

• Easier to operate

• Easier to reason about

Wednesday, November 16, 2011

Page 177: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - accept the “Enterprise” mentality

• Just say no to EARs, EJBs, and mostly WARs

• More XML, complex build process, complex deploy process

• Generally prohibit important things

• Not needed for scale

• Do - write small, discrete, stand-alone services

• Easier to operate

• Easier to reason about

• Strive for consistent approaches to all Java services

Wednesday, November 16, 2011

Page 178: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change

Wednesday, November 16, 2011

Page 179: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - stop making web development so complicated

Wednesday, November 16, 2011

Page 180: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - stop making web development so complicated

• Conventional approaches are too difficult, especially for APIs

Wednesday, November 16, 2011

Page 181: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - stop making web development so complicated

• Conventional approaches are too difficult, especially for APIs

• Consider Play or simply just embedding Jetty

Wednesday, November 16, 2011

Page 182: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - stop making web development so complicated

• Conventional approaches are too difficult, especially for APIs

• Consider Play or simply just embedding Jetty

• Embedding Jetty takes 16 lines of real code, add Jersey Annotations for fast, strongly typed HTTP endpoints and profit!

Wednesday, November 16, 2011

Page 183: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - stop making web development so complicated

• Conventional approaches are too difficult, especially for APIs

• Consider Play or simply just embedding Jetty

• Embedding Jetty takes 16 lines of real code, add Jersey Annotations for fast, strongly typed HTTP endpoints and profit!

• Do not - assume you need a WAR in a container to deliver or scale

Wednesday, November 16, 2011

Page 184: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - stop making web development so complicated

• Conventional approaches are too difficult, especially for APIs

• Consider Play or simply just embedding Jetty

• Embedding Jetty takes 16 lines of real code, add Jersey Annotations for fast, strongly typed HTTP endpoints and profit!

• Do not - assume you need a WAR in a container to deliver or scale

• Sites of massive scale succeed without these mechanisms

Wednesday, November 16, 2011

Page 185: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - stop making web development so complicated

• Conventional approaches are too difficult, especially for APIs

• Consider Play or simply just embedding Jetty

• Embedding Jetty takes 16 lines of real code, add Jersey Annotations for fast, strongly typed HTTP endpoints and profit!

• Do not - assume you need a WAR in a container to deliver or scale

• Sites of massive scale succeed without these mechanisms

• Big vendors push a false sense of security

Wednesday, November 16, 2011

Page 186: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change

Wednesday, November 16, 2011

Page 187: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - abuse final

Wednesday, November 16, 2011

Page 188: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - abuse final

• Simplifies closures, predicates, etc.

Wednesday, November 16, 2011

Page 189: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - abuse final

• Simplifies closures, predicates, etc.

• Avoid public APIs relying on subclassing

Wednesday, November 16, 2011

Page 190: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - abuse final

• Simplifies closures, predicates, etc.

• Avoid public APIs relying on subclassing

• Clear expression of intent - you shall not change!

Wednesday, November 16, 2011

Page 191: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - abuse final

• Simplifies closures, predicates, etc.

• Avoid public APIs relying on subclassing

• Clear expression of intent - you shall not change!

• Do not - do it for performance reasons

Wednesday, November 16, 2011

Page 192: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - abuse final

• Simplifies closures, predicates, etc.

• Avoid public APIs relying on subclassing

• Clear expression of intent - you shall not change!

• Do not - do it for performance reasons

• Your code may perform better but that’s not the point

Wednesday, November 16, 2011

Page 193: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - abuse final

• Simplifies closures, predicates, etc.

• Avoid public APIs relying on subclassing

• Clear expression of intent - you shall not change!

• Do not - do it for performance reasons

• Your code may perform better but that’s not the point

• Fall victim to the maybe extend effect

Wednesday, November 16, 2011

Page 194: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change

Wednesday, November 16, 2011

Page 195: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - use checked exceptions

Wednesday, November 16, 2011

Page 196: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - use checked exceptions

• No single non-Java language on the JVM honors them

Wednesday, November 16, 2011

Page 197: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - use checked exceptions

• No single non-Java language on the JVM honors them

• Too prone to flow control by exception

Wednesday, November 16, 2011

Page 198: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - use checked exceptions

• No single non-Java language on the JVM honors them

• Too prone to flow control by exception

• Terrible APIs

Wednesday, November 16, 2011

Page 199: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - use checked exceptions

• No single non-Java language on the JVM honors them

• Too prone to flow control by exception

• Terrible APIs

• Do - have clean, expressive return types that indicate when something can go wrong that a consumer cares about

Wednesday, November 16, 2011

Page 200: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - use checked exceptions

• No single non-Java language on the JVM honors them

• Too prone to flow control by exception

• Terrible APIs

• Do - have clean, expressive return types that indicate when something can go wrong that a consumer cares about

• Make exceptions truly Exceptional - no catch blocks

Wednesday, November 16, 2011

Page 201: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - use checked exceptions

• No single non-Java language on the JVM honors them

• Too prone to flow control by exception

• Terrible APIs

• Do - have clean, expressive return types that indicate when something can go wrong that a consumer cares about

• Make exceptions truly Exceptional - no catch blocks

• Document what can go wrong in APIs

Wednesday, November 16, 2011

Page 202: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - use checked exceptions

• No single non-Java language on the JVM honors them

• Too prone to flow control by exception

• Terrible APIs

• Do - have clean, expressive return types that indicate when something can go wrong that a consumer cares about

• Make exceptions truly Exceptional - no catch blocks

• Document what can go wrong in APIs

• Return tuples (GO’s value + error)

Wednesday, November 16, 2011

Page 203: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do not - use checked exceptions

• No single non-Java language on the JVM honors them

• Too prone to flow control by exception

• Terrible APIs

• Do - have clean, expressive return types that indicate when something can go wrong that a consumer cares about

• Make exceptions truly Exceptional - no catch blocks

• Document what can go wrong in APIs

• Return tuples (GO’s value + error)

• Google language design and C++ standards

Wednesday, November 16, 2011

Page 204: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change

Wednesday, November 16, 2011

Page 205: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - monitor every single thing you may find interesting

Wednesday, November 16, 2011

Page 206: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - monitor every single thing you may find interesting

• Metrics and statistics are critical - 50th, 90th, 99th percentiles

Wednesday, November 16, 2011

Page 207: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - monitor every single thing you may find interesting

• Metrics and statistics are critical - 50th, 90th, 99th percentiles

• Log files still matter - metrics and statistics need context

Wednesday, November 16, 2011

Page 208: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - monitor every single thing you may find interesting

• Metrics and statistics are critical - 50th, 90th, 99th percentiles

• Log files still matter - metrics and statistics need context

• Do not - monitor JMX directly

Wednesday, November 16, 2011

Page 209: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - monitor every single thing you may find interesting

• Metrics and statistics are critical - 50th, 90th, 99th percentiles

• Log files still matter - metrics and statistics need context

• Do not - monitor JMX directly

• Most FOSS platforms are terrible at this, Most commercial ones too

Wednesday, November 16, 2011

Page 210: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - monitor every single thing you may find interesting

• Metrics and statistics are critical - 50th, 90th, 99th percentiles

• Log files still matter - metrics and statistics need context

• Do not - monitor JMX directly

• Most FOSS platforms are terrible at this, Most commercial ones too

• JConsole is an awesome tool but not a monitoring or alerting platform

Wednesday, November 16, 2011

Page 211: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - monitor every single thing you may find interesting

• Metrics and statistics are critical - 50th, 90th, 99th percentiles

• Log files still matter - metrics and statistics need context

• Do not - monitor JMX directly

• Most FOSS platforms are terrible at this, Most commercial ones too

• JConsole is an awesome tool but not a monitoring or alerting platform

• Do not - Assume “I can just hook up a profiler later”

Wednesday, November 16, 2011

Page 212: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can Change• Do - monitor every single thing you may find interesting

• Metrics and statistics are critical - 50th, 90th, 99th percentiles

• Log files still matter - metrics and statistics need context

• Do not - monitor JMX directly

• Most FOSS platforms are terrible at this, Most commercial ones too

• JConsole is an awesome tool but not a monitoring or alerting platform

• Do not - Assume “I can just hook up a profiler later”

• Do not - Worry about performance of these things

Wednesday, November 16, 2011

Page 213: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

What We Can’t Change

• No first class functions

• Lambda expressions

• Long GC Pauses

• Bad LCD choices

• Two reflections operations on private fields to get an FD? Really?

• Spawning a process is painful compared to Python

• Type erasure

Wednesday, November 16, 2011

Page 215: Java - QCon San Francisco · 2013-05-20 · • Large scale socket management using NIO ... A Day in UA Engineering New Feature Development Sustaining Engineering IRC Tomfoolery Production

Thanks!

• Urban Airship: http://urbanairship.com/

• We’re hiring! http://urbanairship.com/company/jobs/

• Me @eonnen or erik at ☝

Wednesday, November 16, 2011