1 of 38

“To #comment or not?”

A data-driven look at conflicting attitudes towards commenting and documentation!

@veronica_hanus

#RemotePythonPizza

2 of 38

Documentation can

cause or relieve

programmer pain!

@veronica_hanus

3 of 38

are documentation?

What if

#COMMENTS

DUN DUN DUN…!

@veronica_hanus

4 of 38

#COMMENTS get all the time.

SMACK-TALKED

Good C0DE

speaks for itself!!!! >:O

Comments rot :(

Keep it D.R.Y.!

Comments mean time to refactor

¯\_(ツ)_/¯

?

!

?

!

!

@veronica_hanus

5 of 38

When does #REFACTORING happen?

Too often...

  • New Work > Refactoring
  • Time for Feedback? No.
  • Feels like a “Nice to Have”

Refactor when….

  • Can’t Stand it Anymore
  • Problem Grows
  • Refactoring == Self-Care

Finally, time to refactor!

@veronica_hanus

6 of 38

Outdated comments

can mislead.

Well-placed comments can protect critical code from errors.

@veronica_hanus

7 of 38

@veronica_hanus

8 of 38

@veronica_hanus

9 of 38

v

10 of 38

We Can Usually Get Behind

Code is the “how”,

Comments are the “why

Don’t Waste Everyone’s Time

(WET)

Line-by-line shows a

Lack of Understanding

Docstrings should have

Inputs, Outputs, Transformation

Outdated Comments == Lies

Too Much is Too Much!

#BESTPRACTICES

@veronica_hanus

11 of 38

And the best (WORST)

advice goes to...

Just

@veronica_hanus

Code

Better

(Thanks a lot, Internet)

12 of 38

Typical Newbie Question on StackOverflow

@veronica_hanus

THOUGHTFULLY

ASKED QUESTION ON THE INTERWEBS

Translation: N00B, ur sTrUgGle bOrEs mE & u R a BAD pRoGrAMeR 😘

@veronica_hanus

13 of 38

Comments can:

  • Label
  • Questions
  • Notes
  • Outline
  • Storage
  • References
  • Support overwhelmed learners

Comments can:

  • Label
  • Questions
  • Notes
  • Outline
  • Storage
  • References
  • Support overwhelmed learners

@veronica_hanus

14 of 38

# V!: TODO� [........]

# Veronica was heree!

Move fast & break things write bad comments

1 # VeRoNiCa wuz here

2 #

3 # move fast & break

4 # things

5 #

6 # (I mean move fast &

7 # write bad comments)

8 #

@veronica_hanus

15 of 38

@veronica_hanus

16 of 38

A survey, now backed by non-trivial DATA!

AGREE/DISAGREE (1-5):

Comments:

Help me remember what my code does Clarify my thinking ✦ �Help me learn Save time Are deleted before projects is shared

Yes to function-level, no in-line Clear code is self-documenting

RADIAL CHOICES (Choose 1)

Current/Recent Use: Comment Uncertainty Function-Level Comments

Clarification Unused Code Other

When Comments Are Added: Scoping & Planning As Functions Written Pairing

As I Learn People Don’t Understand Clean-up

@veronica_hanus

17 of 38

@veronica_hanus

18 of 38

@veronica_hanus

19 of 38

@veronica_hanus

20 of 38

@veronica_hanus

21 of 38

“A global patchwork of Github & Gitlab repositories don’t just contain software-- they contain our shared understanding & collaboration around common interests & problem solving.”

Jono Bacon in his forward to

“The Business Value of Developer Relations”

@veronica_hanus

22 of 38

Comments

teach us

about ourselves

@veronica_hanus

23 of 38

What can we do?

Goal: Support learners where they are at, praising their accomplishments, while pointing them gently toward the future

  • Empathy can be hard!
  • Remember our overwhelmed learner
  • Advise current them, not future them!
  • Write w/ comments? Share them!
  • Suggest a deep dive & reading others’ code?

What can we say? What do they need?

  • Someone is learning their attitudes toward documentation from you

Rethink comments:

  • Comments == Docs?
  • Comments teach us about ourselves

@veronica_hanus

24 of 38

I tweet at @veronica_hanus

Non-tweeters 👋me@veronicahanus.com

Survey: http://bit.ly/comment-use

Video & Slides 🔜 http://veronicahanus.com/talks

🙌Write the comments you wish you had!

👇Is your company recruiting a

DevRel or Dev Advocate?👇

🙌@veronica_hanus🙌

A big thank you to

each of you for coming,

the Python Pizza organizing team for the opportunity and

the ~170 internet-folks who have shared their “comments on comments”

25 of 38

Learning Resources

@veronica_hanus

26 of 38

Credits

27 of 38

@veronica_hanus

28 of 38

29 of 38

!@#$

$#!@

DON’T

REPEAT

YOURSELF!

KEEP IT D.R.Y.!

CODE

WITHOUT

DOCUMENTATION

IS UNUSABLE!

@veronica_hanus

30 of 38

Not certain

Each function

In-line

Unused code

@veronica_hanus

31 of 38

@veronica_hanus

32 of 38

@veronica_hanus

33 of 38

34 of 38

@veronica_hanus

35 of 38

Not certain

Each function

In-line

Unused code

@veronica_hanus

36 of 38

@veronica_hanus

37 of 38

@veronica_hanus

38 of 38

@veronica_hanus