code review (i)

Post on 14-Feb-2017

124 Views

Category:

Engineering

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Code Review(I)➔Tsai Chia-Ping

➔chia7712@gmail.com

1

Agenda

• Specific Case Pattern

• Decorate Pattern

• JAVA Optional and Generic

2/15

YOU HATE the STATEMENT

3/15

You must lock the resource before opening …

YOU KILL the

STATEMENT

4/15

Replace the null value by a do-nothing class

?

Engineer is always

SINGLETON

5/15

Singleton

pattern

Singleton

pattern ?

Coding is YOUR

life

6/15

Query the data with

3 optional arguments

1) filter

2) limit

3) offset

YOU always work

for the

OLDER SPEC

7/15

WAIT...The order should be

1) limit

2) filter

3) offset ? ? ?

8/15

YOU have a DREAM

9/15

Query the data with

3 optional arguments

1) filter

2) limit

3) offset

Iterator<T> iter = …

iter = withFilter(iter);

iter = withLimit(iter);

iter = withOffset(iter);

return iter

WAIT...The order should be

1) limit

2) filter

3) offset

Iterator<T> iter = …

iter = withLimit(iter);

iter = withFilter(iter);

iter = withOffset(iter);

return iter

10/15

God could not be everywhere, and therefore

he made ENGINEER

11/15

WAIT...The order should be

1) limit

2) filter

3) offset

Query the data with

3 optional arguments

1) filter

2) limit

3) offset

What can We do for this code (1/2)

12/15

Redundant Statement

13/15

What can We do for this code (2/2)

14/15

Compiler is

your best

FRIEND

15/15

1. Unchecked type

2. The input argument is checked

java.lang.ClassCastException

(Dataset.Column cannot be cast to java.lang.Integer)

QA

top related