The First Rule of Comments in Code

  Рет қаралды 1,322

Bran van der Meer

Bran van der Meer

Күн бұрын

// 😧 Sometimes I believe the compiler ignores all my comments
/* Comments have the tendency to become unhelpful: outdated and incorrect. Why does this happen, and what to do about it? 🤔 */
0:00 Intro
0:17 Unhelpful
3:29 The first rule
4:12 How to avoid comments

Пікірлер: 12
@markusfreericks5766
@markusfreericks5766 8 ай бұрын
Comments are useful to explain the "why" of a function, or a data structure; commenting the "how" should not be necessary when variables and functions are well named.
@GerardoFurtado
@GerardoFurtado 8 ай бұрын
Great points. We all write comments to other people, but because I work in a small JavaScript team (it's only me!), I normally write comments to a special kind of other people: myself in the future. Sometimes I am told to refactor a code I wrote months or years ago, and it's like someone else wrote it, I have to spend time reading it and remembering its flow... in these cases the comments from my old self are really helpful.
@thomvandenhil4717
@thomvandenhil4717 8 ай бұрын
You truly deserve more recognition for the amazing content you create. Keep up the good work!
@EnergyCreator05
@EnergyCreator05 8 ай бұрын
Comment why not how.
@SRG-Learn-Code
@SRG-Learn-Code 7 ай бұрын
I love to find comments in repos I want to use. You might (no, you absolutely are) be a better code than me and just understand what is happening, but I need those comments to follow.
@Fearthelettuce
@Fearthelettuce 7 ай бұрын
I tried to leave a comment, but then you told me that comments were bad...
@dapodix
@dapodix 8 ай бұрын
Love this - it resonates so much with me having to explain these to trammates who seem to fear the absence of comments. If only this video was available in a blog post form for reference? 🤔
@branvandermeer
@branvandermeer 8 ай бұрын
@dapodix: I just published the article version of the same content on my website!
@goosydev
@goosydev 8 ай бұрын
Exactly, i see too many videos explaining how to write good comments, while that still brings value when you really need to write comments, most are really unnecessary. I think the only good place to comment is when you're learning something new, especially when you're new to programming. Otherwise I try to avoid them entirely because they are so unpredictable and from my experience almost always wrong.
@SRG-Learn-Code
@SRG-Learn-Code 7 ай бұрын
What if you make Jsdocs works like typescript? Are you testing your comments?\
@principleshipcoleoid8095
@principleshipcoleoid8095 8 ай бұрын
1:08 rust has doc comments that can be tested :p
@branvandermeer
@branvandermeer 8 ай бұрын
Sure, fair enough. But most of us are mere mortals, not using rust for our day jobs ;) ... and not the whole comment can be tested.
Ubiquitous Language, simplified
9:25
Bran van der Meer
Рет қаралды 944
Dependency Injection, simplified
9:55
Bran van der Meer
Рет қаралды 3,8 М.
Вечный ДВИГАТЕЛЬ!⚙️ #shorts
00:27
Гараж 54
Рет қаралды 13 МЛН
Always be more smart #shorts
00:32
Jin and Hattie
Рет қаралды 41 МЛН
When You Get Ran Over By A Car...
00:15
Jojo Sim
Рет қаралды 7 МЛН
The day of the sea 🌊 🤣❤️ #demariki
00:22
Demariki
Рет қаралды 95 МЛН
Driver/Navigator style of Pair Programming
15:17
Bran van der Meer
Рет қаралды 2 М.
How to CQS: splitting the Read from the Write
11:52
Bran van der Meer
Рет қаралды 1 М.
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 766 М.
How to Avoid Refactoring Legacy Code HELL
35:57
ArjanCodes
Рет қаралды 35 М.
How to run a Post-Mortem meeting, step-by-step
8:03
Bran van der Meer
Рет қаралды 710
The Simplest Design Pattern: Facade
8:43
Bran van der Meer
Рет қаралды 3,1 М.
Don't Write Comments
5:55
CodeAesthetic
Рет қаралды 775 М.
Svelte 5 Is A Triumph
22:04
Joy of Code
Рет қаралды 59 М.
If I Started Learning TypeScript, I'd Do This
6:12
Josh tried coding
Рет қаралды 35 М.
Игровой Комп с Авито за 4500р
1:00
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 1,7 МЛН
Что не так с яблоком Apple? #apple #macbook
0:38
Не шарю!
Рет қаралды 241 М.