You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Learn with Jquery how to use the vanilla javascript #293
The goal isn't to philosophize, it's "Software engineering principles, from Robert C. Martin's book Clean Code, adapted for JavaScript." I'll make this more clear in a CONTRIBUTING.md document!
The "document.getElementById" repetition, it's "old habits of those who read the book, and has not mastered any principle. Because not use where could use to make the code cleaner.
But I agree that, my point is really another question, that does not make this principles more clear.
Thinking well, I don't always agree with Robert C. Martin's
Because "avoiding" and "preferring" is not "always avoiding" and "always preferring".
Avoid Mental Mapping. Explicit is better than implicit. (By Robert C. Martin)
bad
locations.forEach(l => { good
locations.forEach(location => {
Avoid Sesquipedalianism when Less is More. (Gurigraphics)
bad
sesquipedalianisms.forEach(sesquipedalianism => { good
items.forEach(i=> {
The more you need use a name, the lower the weight of the name that you need to carry in your memory. It is because mathematicians prefer "+", "-", "/", "x", "y" that "quantumSpinLeft" dividedBy "quantumSpinRight".
"You should not have to read the body of a function to know what it does. Functions in small scopes should have long and precise names".( By Robert C. Martin)
bad
parseColumnHeader() good
gatherFunctionsAndVariablesFromColumnHeader()
If "Familiarity admits brevity"( Golang principle )
&& "Convention over configuration"(Ruby on Rails principle)
Then => Prefer Mnemonics Conventions that Mental Mapping and Sesquipedalianism
bad
document.getElementById
document.getElementsByClassName good
$("#")
$(".")
Activity
ryanmcdermott commentedon Jan 22, 2020
Hey there! I only want to add subsections that have a corresponding one in the book Clean Code. I don't think this one does.
Gurigraphics commentedon Jan 22, 2020
Is the goal to write cleaner code, or philosophize about the book?
ryanmcdermott commentedon Jan 22, 2020
The goal isn't to philosophize, it's "Software engineering principles, from Robert C. Martin's book Clean Code, adapted for JavaScript." I'll make this more clear in a CONTRIBUTING.md document!
Gurigraphics commentedon Jan 22, 2020
My point is that:
But I agree that, my point is really another question, that does not make this principles more clear.
Thinking well, I don't always agree with Robert C. Martin's
Because "avoiding" and "preferring" is not "always avoiding" and "always preferring".
Avoid Mental Mapping. Explicit is better than implicit. (By Robert C. Martin)
bad
locations.forEach(l => {
good
locations.forEach(location => {
Avoid Sesquipedalianism when Less is More. (Gurigraphics)
bad
sesquipedalianisms.forEach(sesquipedalianism => {
good
items.forEach(i=> {
The more you need use a name, the lower the weight of the name that you need to carry in your memory. It is because mathematicians prefer "+", "-", "/", "x", "y" that "quantumSpinLeft" dividedBy "quantumSpinRight".
"You should not have to read the body of a function to know what it does. Functions in small scopes should have long and precise names".( By Robert C. Martin)
bad
parseColumnHeader()
good
gatherFunctionsAndVariablesFromColumnHeader()
If "Familiarity admits brevity"( Golang principle )
&& "Convention over configuration"(Ruby on Rails principle)
Then => Prefer Mnemonics Conventions that Mental Mapping and Sesquipedalianism
bad
document.getElementById
document.getElementsByClassName
good
$("#")
$(".")