small, simple and smelly: what we can learn from examining end-user artifacts?

141
Small, Simple & Smelly: What we can learn from examining end-user artifacts? @Felienn e

Upload: felienne-hermans

Post on 16-Apr-2017

303 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Small, simple and smelly: What we can learn from examining end-user artifacts?

Small, Simple & Smelly:

What we can learn from examining end-user

artifacts?@Felienne

Page 2: Small, simple and smelly: What we can learn from examining end-user artifacts?

Ehm? DSLs and End-

Users?

Page 3: Small, simple and smelly: What we can learn from examining end-user artifacts?

Ehm? DSLs and End-

Users?

Page 4: Small, simple and smelly: What we can learn from examining end-user artifacts?

Ehm? DSLs and End-

Users?

Page 5: Small, simple and smelly: What we can learn from examining end-user artifacts?

“In the future, everyone will be a programmer for 15

minutes” @Felienne

Page 6: Small, simple and smelly: What we can learn from examining end-user artifacts?
Page 7: Small, simple and smelly: What we can learn from examining end-user artifacts?

1968

Page 8: Small, simple and smelly: What we can learn from examining end-user artifacts?

1974

Internet

Page 9: Small, simple and smelly: What we can learn from examining end-user artifacts?

1991

The web

Page 10: Small, simple and smelly: What we can learn from examining end-user artifacts?

2005

YouTube

Page 11: Small, simple and smelly: What we can learn from examining end-user artifacts?

“In the future, everyone will be a programmer for 15

minutes”

Page 12: Small, simple and smelly: What we can learn from examining end-user artifacts?

What are the tools

needed to make this

prediction true?

Page 13: Small, simple and smelly: What we can learn from examining end-user artifacts?

We are almost there already!

Page 14: Small, simple and smelly: What we can learn from examining end-user artifacts?

95% of all U.S. firms use

spreadsheets for financial reporting

Page 15: Small, simple and smelly: What we can learn from examining end-user artifacts?

54% of Dutch citizens

can use Excel formulas

Page 16: Small, simple and smelly: What we can learn from examining end-user artifacts?

54% of Dutch citizens

can use Excel formulas

was 44% 10 years

ago

Page 17: Small, simple and smelly: What we can learn from examining end-user artifacts?

“Spreadsheets are not programming”

Page 18: Small, simple and smelly: What we can learn from examining end-user artifacts?

Spreadsheets are code

Page 19: Small, simple and smelly: What we can learn from examining end-user artifacts?

Used for similar

problems

Page 20: Small, simple and smelly: What we can learn from examining end-user artifacts?
Page 21: Small, simple and smelly: What we can learn from examining end-user artifacts?

Formulas are Turing

complete

Page 22: Small, simple and smelly: What we can learn from examining end-user artifacts?
Page 23: Small, simple and smelly: What we can learn from examining end-user artifacts?

Have typical software problems

Page 24: Small, simple and smelly: What we can learn from examining end-user artifacts?

Spreadsheets live

5 years on average

Page 25: Small, simple and smelly: What we can learn from examining end-user artifacts?

Are used by 12 different

people

Page 26: Small, simple and smelly: What we can learn from examining end-user artifacts?

Only 33% of spreadsheets has a manual

Page 27: Small, simple and smelly: What we can learn from examining end-user artifacts?

Spreadsheets are code

Similar activities, power and problems

Page 28: Small, simple and smelly: What we can learn from examining end-user artifacts?

But....

Page 29: Small, simple and smelly: What we can learn from examining end-user artifacts?

How to help everyone?

Page 30: Small, simple and smelly: What we can learn from examining end-user artifacts?

We know a thing or two about

programming

Page 31: Small, simple and smelly: What we can learn from examining end-user artifacts?

Object oriented

programming

Page 32: Small, simple and smelly: What we can learn from examining end-user artifacts?

Smells and refactoring

s

Page 33: Small, simple and smelly: What we can learn from examining end-user artifacts?

Can we apply those

to spreadsheets?

Page 34: Small, simple and smelly: What we can learn from examining end-user artifacts?

“code smells” for

spreadsheet formulas

Page 35: Small, simple and smelly: What we can learn from examining end-user artifacts?

“Long method”

Page 36: Small, simple and smelly: What we can learn from examining end-user artifacts?

“Too many parameters”

Page 37: Small, simple and smelly: What we can learn from examining end-user artifacts?

Conditional complexity

Page 38: Small, simple and smelly: What we can learn from examining end-user artifacts?

Code clones

Page 39: Small, simple and smelly: What we can learn from examining end-user artifacts?

Code clones

Page 40: Small, simple and smelly: What we can learn from examining end-user artifacts?

Smells are common!

Page 41: Small, simple and smelly: What we can learn from examining end-user artifacts?

Smells are common!

42% of spreadsheets have smells

Detecting and Refactoring Code Smells in Spreadsheet Formulas, Hermans et al., Empirical Software Engineering, 2014

Page 42: Small, simple and smelly: What we can learn from examining end-user artifacts?

What are the tools needed to make this

prediction true?

Maybe smell detection

is a good tool....?

Page 43: Small, simple and smelly: What we can learn from examining end-user artifacts?

Can we start earlier?

Page 44: Small, simple and smelly: What we can learn from examining end-user artifacts?

Do code smells matter to kids?

Page 45: Small, simple and smelly: What we can learn from examining end-user artifacts?

The Scratch programming language

Page 46: Small, simple and smelly: What we can learn from examining end-user artifacts?

Do code smells matter to kids?

The Scratch programming language

Page 47: Small, simple and smelly: What we can learn from examining end-user artifacts?

Sprites

Page 48: Small, simple and smelly: What we can learn from examining end-user artifacts?

Scripts

Page 49: Small, simple and smelly: What we can learn from examining end-user artifacts?

Each sprite can have scripts

Page 50: Small, simple and smelly: What we can learn from examining end-user artifacts?

Do code smells matter to kids?

Page 51: Small, simple and smelly: What we can learn from examining end-user artifacts?

A simple game

Page 52: Small, simple and smelly: What we can learn from examining end-user artifacts?

One ‘good’ version

Page 53: Small, simple and smelly: What we can learn from examining end-user artifacts?

Two ‘smelly’ versions

Page 54: Small, simple and smelly: What we can learn from examining end-user artifacts?

Two ‘smelly’ versions

Long method

Duplicated code

Page 55: Small, simple and smelly: What we can learn from examining end-user artifacts?

Version N

Page 56: Small, simple and smelly: What we can learn from examining end-user artifacts?

Version D

Page 57: Small, simple and smelly: What we can learn from examining end-user artifacts?

Version D

Page 58: Small, simple and smelly: What we can learn from examining end-user artifacts?

Version D

Page 59: Small, simple and smelly: What we can learn from examining end-user artifacts?

Version D

Page 60: Small, simple and smelly: What we can learn from examining end-user artifacts?

Version D

Page 61: Small, simple and smelly: What we can learn from examining end-user artifacts?

Version D

Page 62: Small, simple and smelly: What we can learn from examining end-user artifacts?

Version N

Page 63: Small, simple and smelly: What we can learn from examining end-user artifacts?

Version N

Page 64: Small, simple and smelly: What we can learn from examining end-user artifacts?

Version L

Page 65: Small, simple and smelly: What we can learn from examining end-user artifacts?

Do code smells

matter to kids?

Page 66: Small, simple and smelly: What we can learn from examining end-user artifacts?

tl;drYes

Page 67: Small, simple and smelly: What we can learn from examining end-user artifacts?

tl;drYes

Kids performed significantly better on the non-smelly program

Page 68: Small, simple and smelly: What we can learn from examining end-user artifacts?

tl;drYes

But, differences tasks are impacted differently

Page 69: Small, simple and smelly: What we can learn from examining end-user artifacts?

Let’s take a closer look!

Page 70: Small, simple and smelly: What we can learn from examining end-user artifacts?

Version N

“When have you won the

game?”

Page 71: Small, simple and smelly: What we can learn from examining end-user artifacts?

Version L

“When have you won the

game?”

Page 72: Small, simple and smelly: What we can learn from examining end-user artifacts?

Let’s take a closer look!

Understanding seems affected more by the Long Method smell

Page 73: Small, simple and smelly: What we can learn from examining end-user artifacts?

Version N

“Make the game go to 10 points”

Page 74: Small, simple and smelly: What we can learn from examining end-user artifacts?

Version N

“Make the game go to 10 points”

Page 75: Small, simple and smelly: What we can learn from examining end-user artifacts?

Version D

Page 76: Small, simple and smelly: What we can learn from examining end-user artifacts?

Version D

Page 77: Small, simple and smelly: What we can learn from examining end-user artifacts?

Version D

Page 78: Small, simple and smelly: What we can learn from examining end-user artifacts?

Let’s take a closer look!

Modification is hampered most by Duplication

Page 79: Small, simple and smelly: What we can learn from examining end-user artifacts?

Smells are bad!

(also for kids)

Page 80: Small, simple and smelly: What we can learn from examining end-user artifacts?

Smells are bad!

(also for kids)

Are smells common?

Page 81: Small, simple and smelly: What we can learn from examining end-user artifacts?

Thanks MIT

Page 82: Small, simple and smelly: What we can learn from examining end-user artifacts?
Page 83: Small, simple and smelly: What we can learn from examining end-user artifacts?
Page 84: Small, simple and smelly: What we can learn from examining end-user artifacts?
Page 85: Small, simple and smelly: What we can learn from examining end-user artifacts?
Page 86: Small, simple and smelly: What we can learn from examining end-user artifacts?

How do kids code

in Scratch?

What do kids do in Scratch?

Page 87: Small, simple and smelly: What we can learn from examining end-user artifacts?

Let’s look at some

programs!

Page 88: Small, simple and smelly: What we can learn from examining end-user artifacts?

Downloaded all shared

programs for 24 hours

Page 89: Small, simple and smelly: What we can learn from examining end-user artifacts?

250.000 JSON files

Page 90: Small, simple and smelly: What we can learn from examining end-user artifacts?

Flattened into csv

Page 91: Small, simple and smelly: What we can learn from examining end-user artifacts?

Flattened into csv

Available on GitHub! https://github.com/TUDelftScratchLab/ScratchDataset

Page 92: Small, simple and smelly: What we can learn from examining end-user artifacts?

How do kids code

in Scratch?

What we found...

Page 93: Small, simple and smelly: What we can learn from examining end-user artifacts?

Many programs are

small...

Page 94: Small, simple and smelly: What we can learn from examining end-user artifacts?

Median program

Page 95: Small, simple and smelly: What we can learn from examining end-user artifacts?

Median program

2 sprites5 scripts29 blocks

Page 96: Small, simple and smelly: What we can learn from examining end-user artifacts?

But....

Page 97: Small, simple and smelly: What we can learn from examining end-user artifacts?

300 variables300

procedures100 events

Page 98: Small, simple and smelly: What we can learn from examining end-user artifacts?

And what about smells?

Page 99: Small, simple and smelly: What we can learn from examining end-user artifacts?

Duplicated Code

Page 100: Small, simple and smelly: What we can learn from examining end-user artifacts?

Duplicated Code

Page 101: Small, simple and smelly: What we can learn from examining end-user artifacts?

Duplicated Code

Across sprites: in 26% of the

projects

Within sprites: in 10% of the

projects

Page 102: Small, simple and smelly: What we can learn from examining end-user artifacts?

Large Script

Page 103: Small, simple and smelly: What we can learn from examining end-user artifacts?

Large Script

scripts with >18 blocks

in 30% of the

projects

Page 104: Small, simple and smelly: What we can learn from examining end-user artifacts?

1 2

3 4

Dead Code

Page 105: Small, simple and smelly: What we can learn from examining end-user artifacts?

3

1 2

4

Dead Code

Page 106: Small, simple and smelly: What we can learn from examining end-user artifacts?

3

1 2

4

Dead Code

24%

1%

8%24

%

Page 107: Small, simple and smelly: What we can learn from examining end-user artifacts?

3

1 2

4

Dead Code

24%

1%

8%24

%

Any: 28% of the projects

Page 108: Small, simple and smelly: What we can learn from examining end-user artifacts?

Programs are simple

In summary...

Page 109: Small, simple and smelly: What we can learn from examining end-user artifacts?

But....

Page 110: Small, simple and smelly: What we can learn from examining end-user artifacts?

Smells are common

Page 111: Small, simple and smelly: What we can learn from examining end-user artifacts?

Now what?

Page 112: Small, simple and smelly: What we can learn from examining end-user artifacts?

A better language?

Page 113: Small, simple and smelly: What we can learn from examining end-user artifacts?

A better language?

Educate!

Page 114: Small, simple and smelly: What we can learn from examining end-user artifacts?

Retain flexibility

Page 115: Small, simple and smelly: What we can learn from examining end-user artifacts?

Education is possible!

Page 116: Small, simple and smelly: What we can learn from examining end-user artifacts?

Over 3000 kids

enrolled

Page 117: Small, simple and smelly: What we can learn from examining end-user artifacts?

1 2 3 4 5 6 7 8 9 1011121314151617181920210

50

100

150

200

250

300

Age

Num

ber

of s

tude

nts

75% between 7 and 11

Page 118: Small, simple and smelly: What we can learn from examining end-user artifacts?

What kids thought

they learned

Page 119: Small, simple and smelly: What we can learn from examining end-user artifacts?

What they really learned

Page 120: Small, simple and smelly: What we can learn from examining end-user artifacts?

Quality is not harder than

Coding!

*Paper Under Review

Page 121: Small, simple and smelly: What we can learn from examining end-user artifacts?

Taught in traditional way

Page 122: Small, simple and smelly: What we can learn from examining end-user artifacts?

*http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0141357

Meet Dr.

Pigeon

Page 123: Small, simple and smelly: What we can learn from examining end-user artifacts?

*http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0141357

Meet Dr.

Pigeon

coo!

Page 124: Small, simple and smelly: What we can learn from examining end-user artifacts?

*http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0141357

Meet Dr.

Pigeon

75% correct after 2 weeks

Page 125: Small, simple and smelly: What we can learn from examining end-user artifacts?

Sparrow Decks

Page 126: Small, simple and smelly: What we can learn from examining end-user artifacts?

Song House

Sparrow Decks

Page 127: Small, simple and smelly: What we can learn from examining end-user artifacts?
Page 128: Small, simple and smelly: What we can learn from examining end-user artifacts?
Page 129: Small, simple and smelly: What we can learn from examining end-user artifacts?
Page 130: Small, simple and smelly: What we can learn from examining end-user artifacts?
Page 131: Small, simple and smelly: What we can learn from examining end-user artifacts?
Page 132: Small, simple and smelly: What we can learn from examining end-user artifacts?
Page 133: Small, simple and smelly: What we can learn from examining end-user artifacts?
Page 134: Small, simple and smelly: What we can learn from examining end-user artifacts?
Page 135: Small, simple and smelly: What we can learn from examining end-user artifacts?

Now:

• Q&A

Then:

• Hands on!!

“In the future, everyone will be a programmer for 15

minutes” @Felienne

Page 136: Small, simple and smelly: What we can learn from examining end-user artifacts?

More info?

• www.felienne.com

• github.com/TUDelftScratchLab

Want to connect?• [email protected]

“In the future, everyone will be a programmer for 15

minutes” @Felienne

Page 137: Small, simple and smelly: What we can learn from examining end-user artifacts?
Page 138: Small, simple and smelly: What we can learn from examining end-user artifacts?
Page 139: Small, simple and smelly: What we can learn from examining end-user artifacts?

What are the tools needed to make this

prediction true?

Page 140: Small, simple and smelly: What we can learn from examining end-user artifacts?

Smell detection

& refactoring

support!

What are the tools needed to make this

prediction true?

Page 141: Small, simple and smelly: What we can learn from examining end-user artifacts?

Can we create an

IDE for the masses?