jdd2014: 10 things i'd tell my younger self about (java) web development - mateusz kwaśniewski

124
10 things I’d tell my younger self about (Java) Web Development younger

Upload: proidea

Post on 01-Jul-2015

75 views

Category:

Software


2 download

DESCRIPTION

Imagine you could go back in time. What advice would you give your younger self about how to do Java Web Development in a simpler and more effective way? What did you learn? What would you do differently? What would you like to forget? In this talk we will go back in time and give my younger self some advice on building a crazy web stack that I’d find shocking back then. A plethora of web frameworks, DI containers, template engines, build/deployment tools, dependency managers, web servers and testing strategies. Modern developers have more choice than ever before. I’ll share my thinking process and explain how my decision making has changed over time. With a little help from behavioural scientists, psychologists, hot dog eating contestants and my programming mentors we’ll learn how to think like a freak.

TRANSCRIPT

Page 1: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

10 things I’d tell my younger self about

(Java) Web Development

younger

Page 2: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

Confidential :)

Page 3: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 4: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 5: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 6: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

Struts 1, Struts 2 or Spring MVC?

Page 7: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

Struts 1, Struts 2 or Spring MVC?

learning curve, available materials

Page 8: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 9: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 10: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 11: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 12: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

Paradox of choice

Page 13: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

“...increased choice may actually contribute to the recent epidemic of clinical

depression affecting much of the Western world.”

Page 14: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 15: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

1) Web Framework litmus test

http://cdn8.triplepundit.com/wp-content/uploads/2010/08/litmus-test.jpg

Page 16: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

Does it hide HTTP?

Page 17: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

Does it hide HTTP?

Ignore

Yes

Page 18: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

Does it hide HTTP?

Maybe useful Ignore

NoYes

Page 19: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

Be of the Web, not just on the Web

Page 20: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

request.toString()

Page 21: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

org.apache.catalina.core.ApplicationHttpRequest@10e37618

Page 22: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 23: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

Learn HTML, CSS, JS

Page 24: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

2) Concurrency model

Page 25: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

thread per request

Page 26: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

non-blocking event loop

Page 27: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 28: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

Click Callback

Touch Callback

Ajax Callback

Page 29: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

Click Callback

Touch Callback

Ajax Callback

Mouse Click Event

Page 30: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

Click Callback

Touch Callback

Ajax Callback

Data from server

Page 31: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

Click Callback

Touch Callback

Ajax Callback

Data from serverData from serverData from server

Page 32: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

Everything except your code is executing in parallel

http://kunkle.org/nodejs-explained-pres/#/title

Page 33: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

which one?

Page 34: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

lots of I/O operations

Page 35: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

CPU heavy

Page 36: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

3) Dependency Injection

back to the roots

Page 37: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

new project

Page 38: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

DI/IoC container is optional

Page 39: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

DI/IoC container is optional

Page 40: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 41: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

“...if you use IoC containers, your code becomes, frankly, a lot harder to read”

Page 42: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

when to use containers?

Page 43: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

when to use containers?

massive codebase

Page 44: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

when to use containers?

massive codebase injection points to a library

Page 45: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

how I found my favorite container?

Page 46: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

kobi story

https://c2.staticflickr.com/4/3004/2706713453_4420661f8e_b.jpg

Page 47: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

epiphany

Page 49: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 50: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 51: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 52: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 53: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 54: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

request scope?application scope?

Page 55: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 56: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 57: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 58: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 59: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

simplicity vs features

Page 60: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 61: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 62: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

XML

Page 63: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

annotations

Page 64: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

David and Goliath

Page 65: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

4) Web Servers

the powerful and the strong are

not always what they seem

Page 66: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 67: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

Embedded web servers

Page 68: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

dev-prod parity

Page 69: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

startup times in ms

JDK HttpServer

simple framework

embedded jetty

Page 70: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

no free lunch

Page 71: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

no free lunchadmin

consolesmore

memory automation

Page 72: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

5) Template engines - less is more

Page 73: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

logic/view separation

Page 74: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

more features?

Page 75: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

shape the path

Page 76: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

logic-less templates

Page 77: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

candidates

Page 78: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

testable

Page 79: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

6) logging

the disciplined pursuit of less

Page 81: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

Treat logs like event streams

Page 82: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

stdout and stderr

Page 83: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

myapp >> /var/log/myapp.log

Page 84: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

logrotate

Page 85: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

myapp | logger

Page 86: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

myapp | tee /var/log/myapp.log | logger

Page 88: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

“Expect the output of every program to become the input to another, as yet unknown, program.”

Page 89: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

7) Pragmatic Web Testing

Page 90: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 91: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 92: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 93: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 94: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 95: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 96: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 97: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 98: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 99: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 100: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 101: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

8) Dependencies

be careful who you invite to the party

Page 102: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

classpath party

Page 103: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

classpath party

JAR JAR

JAR JAR

JAR

JAR JAR

JAR

Page 104: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

classpath party

JAR JAR

JAR JAR

JAR

JAR JAR

JAR

JAR JAR

JAR JAR

JAR

JAR

JAR

JARJAR

JAR

Page 105: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

classpath party

JAR JAR

JAR JAR

JAR

JAR JAR

JAR

JAR JAR

JAR JAR

JAR

JAR

JAR

JARJAR

JAR

JAR JAR

JAR JAR

JAR

JAR

JAR JAR JAR

Page 106: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

classpath party

JAR JAR

JAR JAR

JAR

JAR JAR

JAR

JAR JAR

JAR JAR

JAR

JAR

JAR

JARJAR

JAR

JAR JAR

JAR JAR

JAR

JAR

JAR JAR

JAR

Page 107: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 108: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 109: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

no transitive dependencies?

Page 110: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

bring the pain forward

Page 111: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

“When people don’t pay the true cost of something, they tend to consume it inefficiently”

S.Levitt, S.Dubner

Page 112: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

What’s under the hood?

Page 113: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski
Page 114: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

what are your values and principles?

Page 115: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

what are your values and principles?

simplicity over

familiarity

Page 116: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

what are your values and principles?

quick feedback over

features

simplicity over

familiarity

Page 117: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

what are your values and principles?

quick feedback over

features

explicit code over

annotations/xml

simplicity over

familiarity

Page 118: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

what are your values and principles?

quick feedback over

features

explicit code over

annotations/xml

single purpose over

full stack

simplicity over

familiarity

Page 119: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

what are your values and principles?

quick feedback over

features

explicit code over

annotations/xml

single purpose over

full stack

go with the Web, not against it

simplicity over

familiarity

Page 120: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

we’re all biased

Page 121: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

it’s ok to start with familiar

Page 122: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

9) steal like an artist

Page 123: JDD2014: 10 things I'd tell my younger self about (JAVA) web development - Mateusz Kwaśniewski

10) Think like a freak