Top Banner
NEW PERSPECTIVE Asher Barak
66

Sofware Craftsmanship Code Complete

Dec 15, 2014

Download

Technology

Asher Barak

Writing better code and managing complexity following the principals of the all times programming classic Code Complete by Steve McConnell

Check out the video: http://goo.gl/hbXLPZ
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Sofware Craftsmanship Code Complete

NEW PERSPECTIVE

Asher Barak

Page 2: Sofware Craftsmanship Code Complete

PART ONEne principle to rule them all

Page 3: Sofware Craftsmanship Code Complete

1920 - 2012

 one of the founders of the cognitive psychology field

GEORGE A.

MILLER

Page 4: Sofware Craftsmanship Code Complete

THE

MAGICAL

NUMBER

±27

Page 5: Sofware Craftsmanship Code Complete

1930 - 2002

Dutch computer scientist

Edsger W.

Dijkstra

Go To Statement Considered Harmful

Page 6: Sofware Craftsmanship Code Complete

SOFTWARE Is Too

ComplexFor Our

BRAIN

Any

Any

Page 7: Sofware Craftsmanship Code Complete

MANAGING

COMPLEXITY

Your #1 goal should be

Page 8: Sofware Craftsmanship Code Complete

ARISTOTLE

Geek philosopher

384 – 322 BCE

Page 9: Sofware Craftsmanship Code Complete

Essential

Accidental

vs

Page 10: Sofware Craftsmanship Code Complete

SOFTWARE COMPLEXITY

• Computers speak a binary language

• Computers are batch machines

• There is a wide gap between coding

and running software

• Computers are terrible with

concurrency

• Computers have physical limitations

• Computer software model a complex

world

Accid

entalEssential

Page 11: Sofware Craftsmanship Code Complete

ONE THING AT A TIME

Page 12: Sofware Craftsmanship Code Complete

CARE ABOUT LESS

• Do as little as possible

• Divide (& conquer)

• Hide the details - Work with layered abstractions

• Reduce the noise

Page 13: Sofware Craftsmanship Code Complete

LANGUAGE

FUNDAMENTALS

Page 14: Sofware Craftsmanship Code Complete

Class

Method

Procedural Code

Page 15: Sofware Craftsmanship Code Complete

Layer

Module

Class

Page 16: Sofware Craftsmanship Code Complete

USE INTERFACES• Do as little as possible

• Divide (And Conquer)

• Hide the details - Work with layered abstractions

• Reduce the noise

Page 17: Sofware Craftsmanship Code Complete

CODING PRACTICE

S

Page 18: Sofware Craftsmanship Code Complete

THINK OF YOUR AUDIENCE

(It’s not the compiler)

Always

Page 19: Sofware Craftsmanship Code Complete

NAME STUFF•With the right name

• In a standard way

•Methods – For what they do

• Functions – For what they return

• Classes – For what they represent

•Modules – For what they pack

Page 20: Sofware Craftsmanship Code Complete

USE CONVENTIONS

Any convention is better than no convention

Every convention is one less thing to think about

Page 21: Sofware Craftsmanship Code Complete

USE CONVENTIONS• Naming Conventions

•Method parameters conventions

• Resources placing conventions

• Documenting conventions

• Code layout conventions

•Meeting conventions

• Everything conventions

Page 22: Sofware Craftsmanship Code Complete

USE CONVENTIONS

Interface

Event Args

Constant Class

Local Variable Static Property

Instance Property

Exception

Istance

Class Variable

Page 23: Sofware Craftsmanship Code Complete

USE DESIGN PATTERNS• They represent a higher

abstraction over coding details

• They simplify communications in the team

• They are conceptual standard reusable units

Page 24: Sofware Craftsmanship Code Complete

TDD• Promotes better divisions

• Promotes better abstractions

• Promotes better documentation

• Promotes better personal character

• Restrains complexity

Page 25: Sofware Craftsmanship Code Complete

DESIGN BEST

PRACTICES

Page 26: Sofware Craftsmanship Code Complete

• Do as little as possible

• Divide (And Conquer)

• Hide the details - Work with layered abstractions

• Reduce the noise

Page 27: Sofware Craftsmanship Code Complete

• Do as little as possible

• Divide (And Conquer)

• Hide the details - Work with layered abstractions

• Reduce the noise

Page 28: Sofware Craftsmanship Code Complete

• Do as little as possible

• Divide (And Conquer)

• Hide the details - Work with layered abstractions

• Reduce the noise

Page 29: Sofware Craftsmanship Code Complete

• Do as little as possible

• Divide (And Conquer)

• Hide the details - Work with layered abstractions

• Reduce the noise

Page 30: Sofware Craftsmanship Code Complete

• Do as little as possible

• Divide (And Conquer)

• Hide the details - Work with layered abstractions

• Reduce the noise

Page 31: Sofware Craftsmanship Code Complete

• Do as little as possible

• Divide (And Conquer)

• Hide the details - Work with layered abstractions

• Reduce the noise

Page 32: Sofware Craftsmanship Code Complete

• Do as little as possible

• Divide (And Conquer)

• Hide the details - Work with layered abstractions

• Reduce the noise

Page 33: Sofware Craftsmanship Code Complete
Page 34: Sofware Craftsmanship Code Complete

• Do as little as possible

• Divide (And Conquer)

• Hide the details - Work with layered abstractions

• Reduce the noise

Page 35: Sofware Craftsmanship Code Complete

• Do as little as possible

• Divide (And Conquer)

• Hide the details - Work with layered abstractions

• Reduce the noise

Page 36: Sofware Craftsmanship Code Complete

• Do as little as possible

• Divide (And Conquer)

• Hide the details - Work with layered abstractions

• Reduce the noise

Page 37: Sofware Craftsmanship Code Complete

• Do as little as possible

• Divide (And Conquer)

• Hide the details - Work with layered abstractions

• Reduce the noise

Page 38: Sofware Craftsmanship Code Complete

• Do as little as possible

• Divide (And Conquer)

• Hide the details - Work with layered abstractions

• Reduce the noise

Page 39: Sofware Craftsmanship Code Complete

PART TWOMake it your own

Page 40: Sofware Craftsmanship Code Complete

PROGRAMMING IS DONE SOLO

Creating a culture requires communication

Page 41: Sofware Craftsmanship Code Complete

FACE THE TRUTH

Some people program

for the wrong reasons

Page 42: Sofware Craftsmanship Code Complete

ACTIVELY ENCOURAGE SOCIALIZINGPreferably of people who like

their job

Page 43: Sofware Craftsmanship Code Complete

TALK ABOUT THE

PROCESS

Page 44: Sofware Craftsmanship Code Complete

BE OPENLY EXCITED ABOUT

GOOD CRAFTSMANSHIP(With tears if

possible)

Page 45: Sofware Craftsmanship Code Complete

TALK ABOUT READABILITYIs it good for readability or is it bad?

Page 46: Sofware Craftsmanship Code Complete

TALK ABOUT ABSTRACTIONS

Try splitting discussion the way code is split

Page 47: Sofware Craftsmanship Code Complete

ACTIVELY ENCOURAGE MORE DESIGNThis is hardly ever a problem

Page 48: Sofware Craftsmanship Code Complete

ACTIVELY ENCOURAGE

DESIGN CONSULTING

Everyone ends up smarter

Page 49: Sofware Craftsmanship Code Complete

PUT PERFORMANCE &

EFFICIENCY SECOND

Maintainability first

Page 50: Sofware Craftsmanship Code Complete

PUT PERFORMANCE &

EFFICIENCY SECOND

•We are not good at anticipating resources issues

•We are not good at anticipating performance issues

• KISS until otherwise proven

Page 51: Sofware Craftsmanship Code Complete

HAVE EXPECTATIONS• Read (and understand) error messages

• Read (and understand) compiler warning

• Document and read documentation

• Know (and avoid) code smells (Keep a document)

Page 52: Sofware Craftsmanship Code Complete

TALK ABOUT CONVENTIONS• Keep a document

•Make newbie's read the document

• Discuss conventions with your team

•Make any code feel at home to everyone in the company

Page 53: Sofware Craftsmanship Code Complete

TALK ABOUT CODE• Code reviews

• Code analysis sessions

• Talk about code when you give advice

• Talk about code when you take a break – be creative

Page 54: Sofware Craftsmanship Code Complete

TALK ABOUT CODE• Talk about your experience

with the code

• This made me expect that…

• From this I understood right away that…

• This was misleading/ did not follow the standard/ was too long / short

Page 55: Sofware Craftsmanship Code Complete

DON’TTALK ABOUT

CODEWhen you cannot understand it

Page 56: Sofware Craftsmanship Code Complete

USE TOOLING• To measure (size, relations complexity etc.) – do not count lines

• To enforce quality standards and conventions

• To boost productivity

• To avoid human errors

Page 57: Sofware Craftsmanship Code Complete

MAKE SURE

EVERYONE READS CODE COMPLETE

Page 58: Sofware Craftsmanship Code Complete

PART THREETrade secrets

Page 59: Sofware Craftsmanship Code Complete

CULTURE CLASH

SW Business and SW craftsmanship

are not the same

Page 60: Sofware Craftsmanship Code Complete

THINGS ARE IMPROVING• Human factor weighs in

• AGILE – development as a partnership

• Costs and benefits of quality are better understood

• SW management is more experienced

Page 61: Sofware Craftsmanship Code Complete

STILL, THIS

Is sometimes applicable to the quality of your code

Page 62: Sofware Craftsmanship Code Complete

USE YOUR BRAIN• Say what you think

• Stick to your estimates

• Accept lower qualityas a legitimate business decision

• Pick your battles

• Keep doing what you lovein acceptable conditions

Page 63: Sofware Craftsmanship Code Complete

KEEP CALM !!!

Page 64: Sofware Craftsmanship Code Complete

THANK YOU,

Page 66: Sofware Craftsmanship Code Complete

GET THE SLIDEShttp://goo.gl/AWWUKf

If you want to reuse the slides for your talk, Please contact me first.