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

Post on 16-Apr-2017

305 views 1 download

Transcript of 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

Ehm? DSLs and End-

Users?

Ehm? DSLs and End-

Users?

Ehm? DSLs and End-

Users?

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

minutes” @Felienne

1968

1974

Internet

1991

The web

2005

YouTube

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

minutes”

What are the tools

needed to make this

prediction true?

We are almost there already!

95% of all U.S. firms use

spreadsheets for financial reporting

54% of Dutch citizens

can use Excel formulas

54% of Dutch citizens

can use Excel formulas

was 44% 10 years

ago

“Spreadsheets are not programming”

Spreadsheets are code

Used for similar

problems

Formulas are Turing

complete

Have typical software problems

Spreadsheets live

5 years on average

Are used by 12 different

people

Only 33% of spreadsheets has a manual

Spreadsheets are code

Similar activities, power and problems

But....

How to help everyone?

We know a thing or two about

programming

Object oriented

programming

Smells and refactoring

s

Can we apply those

to spreadsheets?

“code smells” for

spreadsheet formulas

“Long method”

“Too many parameters”

Conditional complexity

Code clones

Code clones

Smells are common!

Smells are common!

42% of spreadsheets have smells

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

What are the tools needed to make this

prediction true?

Maybe smell detection

is a good tool....?

Can we start earlier?

Do code smells matter to kids?

The Scratch programming language

Do code smells matter to kids?

The Scratch programming language

Sprites

Scripts

Each sprite can have scripts

Do code smells matter to kids?

A simple game

One ‘good’ version

Two ‘smelly’ versions

Two ‘smelly’ versions

Long method

Duplicated code

Version N

Version D

Version D

Version D

Version D

Version D

Version D

Version N

Version N

Version L

Do code smells

matter to kids?

tl;drYes

tl;drYes

Kids performed significantly better on the non-smelly program

tl;drYes

But, differences tasks are impacted differently

Let’s take a closer look!

Version N

“When have you won the

game?”

Version L

“When have you won the

game?”

Let’s take a closer look!

Understanding seems affected more by the Long Method smell

Version N

“Make the game go to 10 points”

Version N

“Make the game go to 10 points”

Version D

Version D

Version D

Let’s take a closer look!

Modification is hampered most by Duplication

Smells are bad!

(also for kids)

Smells are bad!

(also for kids)

Are smells common?

Thanks MIT

How do kids code

in Scratch?

What do kids do in Scratch?

Let’s look at some

programs!

Downloaded all shared

programs for 24 hours

250.000 JSON files

Flattened into csv

Flattened into csv

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

How do kids code

in Scratch?

What we found...

Many programs are

small...

Median program

Median program

2 sprites5 scripts29 blocks

But....

300 variables300

procedures100 events

And what about smells?

Duplicated Code

Duplicated Code

Duplicated Code

Across sprites: in 26% of the

projects

Within sprites: in 10% of the

projects

Large Script

Large Script

scripts with >18 blocks

in 30% of the

projects

1 2

3 4

Dead Code

3

1 2

4

Dead Code

3

1 2

4

Dead Code

24%

1%

8%24

%

3

1 2

4

Dead Code

24%

1%

8%24

%

Any: 28% of the projects

Programs are simple

In summary...

But....

Smells are common

Now what?

A better language?

A better language?

Educate!

Retain flexibility

Education is possible!

Over 3000 kids

enrolled

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

What kids thought

they learned

What they really learned

Quality is not harder than

Coding!

*Paper Under Review

Taught in traditional way

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

Meet Dr.

Pigeon

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

Meet Dr.

Pigeon

coo!

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

Meet Dr.

Pigeon

75% correct after 2 weeks

Sparrow Decks

Song House

Sparrow Decks

Now:

• Q&A

Then:

• Hands on!!

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

minutes” @Felienne

More info?

• www.felienne.com

• github.com/TUDelftScratchLab

Want to connect?• mail@felienne.com

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

minutes” @Felienne

What are the tools needed to make this

prediction true?

Smell detection

& refactoring

support!

What are the tools needed to make this

prediction true?

Can we create an

IDE for the masses?