java vs oop

27
/27 @yegor256 1 Java vs OOP Yegor Bugayenko

Upload: yegor-bugayenko

Post on 16-Jan-2017

858 views

Category:

Software


1 download

TRANSCRIPT

/27@yegor256 1

Java vs OOP

Yegor Bugayenko

/27@yegor256 2

long video showing Clojure 8000+ lines Java

class

/27@yegor256 3

Javabooks

frameworks

Google

OOP

/27@yegor256 4

if it works, it’s good

if it’s good, it works

/27@yegor256 5

“Just make $1B with something instead of ORM and you will be right”

— Victor

/27@yegor256 6

enemy #1:

books

/27@yegor256 7

“Objects may contain data, in the form of fields, often known as attributes; and code, in the form of procedures, often known as methods”

/27@yegor256 8

“Each object looks quite a bit like a little computer — it has a state, and it has operations that you can ask it to perform” - page 16

/27@yegor256 9

“A class is a collection of data fields that hold values and methods that operate on those values” - page 98

/27@yegor256 10

“An object is some memory that holds a value of some type” - page 40

/27@yegor256 11

“An object consists of some private memory and a set of operations.” - page 6

/27@yegor256 12

“An object is the equivalent of the quanta from which the universe is constructed” - page 66

/27@yegor256 13

enemy #2:

languages

/27@yegor256 14

static

publicnull

final

return

instanceof

.class

@

/27@yegor256 15final

- immutability - setters - anemic model - data structures - procedural thinking

/27@yegor256 16

static

- utility classes - singletons - procedural thinking

/27@yegor256 17

instanceof

- reflection API - no polymorphism - no encapsulation - procedural thinking

.class

/27@yegor256 18

@

- split objects apart - anemic model - procedural thinking

/27@yegor256 19

enemy #3:

frameworks

/27@yegor256 20

JAX-RSJPAPlay

Spring

JavaBeans

Apache Commons

Guava

JDK JAXB

/27@yegor256 21

JAX-RS

@Path(“/”) public class Index { @GET @Produces(“text/plain”) public String get() { return “hello, world!”; } }

/27@yegor256 22

Apache Commons

text = FileUtils.readFileToSTring(f); StringUtils.abbreviate(“hello, world!”); DigestUtils.md5(“some text”);

/27@yegor256 23

JPA

@Entity(table = “book”) public class Book { @Id public int id; @Column public String title; }

/27@yegor256 24

enemy #4:

Google

/27@yegor256 25

Android SDK

android.app.Activity

200+ methods

it’s a shame

/27@yegor256 26

time to change sides!

/27@yegor256 27

$20

for JavaDay

[email protected]