clean web

33
CLEAN WEB SEDA YALÇIN & ÖMER TAŞKIN

Upload: seda-yalcin

Post on 12-Jul-2015

70 views

Category:

Engineering


2 download

TRANSCRIPT

Page 1: CLEAN WEB

CLEAN WEB

SEDA YALÇIN & ÖMER TAŞKIN

Page 2: CLEAN WEB

Outline

ü  About Us

ü  Meaningful Names

ü  Functions

ü  Comments

ü  Formatting

ü  Questions

Page 3: CLEAN WEB

ABOUT US, ABOUT YOU?

Software Engineer@GG

Seda Yalçın

Software Engineer@GG

Ömer Taşkın

Page 4: CLEAN WEB

Why Clean Web?

Remembrance

Just for being in a better Web World

Just for being a better programmer

Just for next programmer

Just for us

Page 5: CLEAN WEB

What is Clean Code about?

If (((!about getting artistic points)

||

(!about being a nerd one))

&&

(about a well disciplined programmer)) {...}

Page 6: CLEAN WEB

Meaningful Names

What is meaningful name? Small answer of the big question. Small warning of the big danger.

Not your tongue-twister.

Not your shopping list.

Don’t be lazy or shy.

Show your intent!

Page 7: CLEAN WEB

Meaningful Names

Use intention-revealing names

Page 8: CLEAN WEB

Meaningful Names  

Page 9: CLEAN WEB

Meaningful Names  

VENDETTA!!!

Page 10: CLEAN WEB

Meaningful Names  

Avoid disinformation

Page 11: CLEAN WEB

Meaningful Names  

Page 12: CLEAN WEB

Meaningful Names

Use pronounceable & searchable names

 

Page 13: CLEAN WEB

Meaningful Names

Avoid mental mapping

Page 14: CLEAN WEB

Meaningful Names  

Don’t be cute

Pick One Word per Concept

Page 15: CLEAN WEB

Functions

Small      

Page 16: CLEAN WEB

Functions

Keep it small

Do one thing

Blocks and Indenting

Page 17: CLEAN WEB

Functions

Function Arguments

Page 18: CLEAN WEB

Functions

Don’t repeat yourself Have No Side Effects

Page 19: CLEAN WEB

Functions

ü  Don’t return null ü  Causes dirty null checks!

ü  Forgotten nullchecks causes NullPointerException!

Page 20: CLEAN WEB

Functions

ü  Don’t return null ü  Causes dirty null checks!

ü  Forgotten nullchecks causes NullPointerException!

Page 21: CLEAN WEB

Functions

Prefer Exceptions  

Page 22: CLEAN WEB

Functions

Prefer Exceptions  

Page 23: CLEAN WEB

Functions

Overloading is good but!  

Page 24: CLEAN WEB

Comments

Do not write comment for bad code!

Make it clean!

Page 25: CLEAN WEB

Comments

TODO Comments

Subversion system and IDE will warn you about TODO comment

Page 26: CLEAN WEB

Comments

Journal Comments

Page 27: CLEAN WEB

Comments

Commented Out Codes

if its unnecessary; Don’t fear, delete it!

Page 28: CLEAN WEB

Comments

Noise Comment

Page 29: CLEAN WEB

Formatting

Formatting

ü  You should have code standards. ü  IDE’s have formatting tool. ü  You can define special format on IDE

Page 30: CLEAN WEB

Code Smells

Page 31: CLEAN WEB

Wake Up!

Page 32: CLEAN WEB

Here we are!

Page 33: CLEAN WEB

References

Clean  Code,  A  Handbook  of  Agile  Software  Craftmanship  Robert  C.  Martin  

https://class.stanford.edu/c4x/Engineering/CS144/asset/Naming.pdf