10 things i'd tell my younger self about java web development

Post on 03-Jul-2015

1.019 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

DESCRIPTION

Video: https://www.youtube.com/watch?v=tBDrcbTDtIw 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

10 things I’d tell my younger self about

(Java) Web Development

younger

Confidential :)

Struts 1, Struts 2 or Spring MVC?

Struts 1, Struts 2 or Spring MVC?

learning curve, available materials

Paradox of choice

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

depression affecting much of the Western world.”

1) Web Framework litmus test

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

Does it hide HTTP?

Does it hide HTTP?

Ignore

Yes

Does it hide HTTP?

Maybe useful Ignore

NoYes

Be of the Web, not just on the Web

request.toString()

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

Learn HTML, CSS, JS

2) Concurrency model

thread per request

non-blocking event loop

Click Callback

Touch Callback

Ajax Callback

Click Callback

Touch Callback

Ajax Callback

Mouse Click Event

Click Callback

Touch Callback

Ajax Callback

Data from server

Click Callback

Touch Callback

Ajax Callback

Data from serverData from serverData from server

Everything except your code is executing in parallel

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

which one?

lots of I/O operations

CPU heavy

3) Dependency Injection

back to the roots

new project

DI/IoC container is optional

DI/IoC container is optional

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

when to use containers?

when to use containers?

massive codebase

when to use containers?

massive codebase injection points to a library

how I found my favorite container?

kobi story

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

epiphany

request scope?application scope?

simplicity vs features

XML

annotations

David and Goliath

4) Web Servers

the powerful and the strong are

not always what they seem

Embedded web servers

dev-prod parity

startup times in ms

JDK HttpServer

simple framework

embedded jetty

no free lunch

no free lunchadmin

consolesmore

memory automation

5) Template engines - less is more

logic/view separation

more features?

shape the path

logic-less templates

candidates

testable

6) logging

the disciplined pursuit of less

Treat logs like event streams

stdout and stderr

myapp >> /var/log/myapp.log

logrotate

myapp | logger

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

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

7) Pragmatic Web Testing

8) Dependencies

be careful who you invite to the party

classpath party

classpath party

JAR JAR

JAR JAR

JAR

JAR JAR

JAR

classpath party

JAR JAR

JAR JAR

JAR

JAR JAR

JAR

JAR JAR

JAR JAR

JAR

JAR

JAR

JARJAR

JAR

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

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

no transitive dependencies?

bring the pain forward

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

S.Levitt, S.Dubner

What’s under the hood?

what are your values and principles?

what are your values and principles?

simplicity over

familiarity

what are your values and principles?

quick feedback over

features

simplicity over

familiarity

what are your values and principles?

quick feedback over

features

explicit code over

annotations/xml

simplicity over

familiarity

what are your values and principles?

quick feedback over

features

explicit code over

annotations/xml

single purpose over

full stack

simplicity over

familiarity

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

we’re all biased

it’s ok to start with familiar

9) steal like an artist

10) Think like a freak

top related