Introduction
In this post, we are going to present the fundamental tips and advice to generate clean code focusing on the element that a...
For further actions, you may consider blocking this person and/or reporting abuse
I really like this series
Thank you very much!
I have already thought up to 6 parts for it!
I do not want to extend too much in the series but I want to see the beauty of clean code.
A greeting!
Would really love to see more!
Love it how you keep it precise and illustrate with examples :-)
the one problem with default parameters in a function is that it only works if the parameter is
undefined
.If the parameter is
null
, then the default parameter isn't applied; Default parameters don't strictly behave as a truthy check.e.g.
So, even with default parameters, you still have to be careful
I agree in part, because generally speaking you shouldn't pass null as param, and functions shouldn't return null
Of course, I'm only pointing out the negatives and none of the many positives...
You made a big no-no with some of your functions by NOT naming them as VERBS. "newBurger" is NOT a good function name. What? Are you "newing" it??? How about, "createBurger"? NOW that IS a VERB -- much better!
Also, it is a good thing to implement METHOD CHAINING in your CLASSES, but I see chains used TOO MUCH. My rule, if it's a void return then it should instead return
this
. However, your example above fortotal
chains.map
&.reduce
. Instead, you should have 2 variables:prices
(mapped) &total
(reduced). That way, when more functionality around pricing is added, another [Jr] dev doesn't come along and writevar prices = items.map( ({ price }) => price )
-- adding another full iteration to the operation. It's also more informative when we're "reducing prices" rather than "reducing [structure]".Moreover, JavaScript is both Functional AND OOP, and if you're not using both you're just not going to write good code. Why encourage only Functional? Jr devs automatically, naturally gravitate toward writing Functional code, why not encourage more OOP? That would probably benefit a dev much more.
Thanks for the article, it's really useful.
Thanks!!
This is a post series about my experience develop using JavaScript.
Wow ok. This is indeed a great series, I will also share it with my team. How the hell did I miss the ES6 default arguments thingy...
Pretty impressed with the quality of this post.
With your permission, I'm sharing it with my team, tocayo :)
It is a great honor for me to share my content :-).
Hopefully we can devirtualize in some event, some day!
Cheers!
Congratulations Carlos!
Really good article that resumes the core points of the Clean Code book!
The tips you describe here are pretty big deal for newcomers and even for the senior developers!
Thanks! 💪💪
A simple thank you can't express my gratitude. Bring more
How can I even begin to thank you, man, speechless on the quality of your post. My gratitude and I would like to share with my team the knowledge learned here.
Thanks! 🔥🔥
"Without wanting to enter into debate between programming paradigms"
Boldly enters into debate between programming paradigms...