“To #comment or not?”
A data-driven look at conflicting attitudes towards commenting and documentation!
@veronica_hanus
#RemotePythonPizza
Documentation can
cause or relieve
programmer pain!
@veronica_hanus
are documentation?
What if
#COMMENTS
DUN DUN DUN…!
@veronica_hanus
#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
When does #REFACTORING happen?
Too often...
✓
✓
✓
✓
✓
✓
Refactor when….
Finally, time to refactor!
@veronica_hanus
Outdated comments
can mislead.
Well-placed comments can protect critical code from errors.
@veronica_hanus
@veronica_hanus
@veronica_hanus
v
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
And the best (WORST)
advice goes to...
Just
@veronica_hanus
Code
Better
(Thanks a lot, Internet)
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
Comments can:
Comments can:
@veronica_hanus
# 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
@veronica_hanus
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
@veronica_hanus
@veronica_hanus
@veronica_hanus
@veronica_hanus
“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
Comments
teach us
about ourselves
@veronica_hanus
What can we do?
Goal: Support learners where they are at, praising their accomplishments, while pointing them gently toward the future
What can we say? What do they need?
Rethink comments:
@veronica_hanus
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”
Learning Resources
@veronica_hanus
Credits
Make your own! https://www.ascii-art-generator.org/
@veronica_hanus
!@#$
$#!@
DON’T
REPEAT
YOURSELF!
KEEP IT D.R.Y.!
CODE
WITHOUT
DOCUMENTATION
IS UNUSABLE!
@veronica_hanus
Not certain
Each function
In-line
Unused code
@veronica_hanus
@veronica_hanus
@veronica_hanus
@veronica_hanus
Not certain
Each function
In-line
Unused code
@veronica_hanus
@veronica_hanus
@veronica_hanus
@veronica_hanus