JavaScript Clean Code

preview_player
Показать описание

📱 Follow Codevolution

JavaScript Clean Code
Writing clean code in JavaScript
Рекомендации по теме
Комментарии
Автор

Summary of video:
01. Avoid magic numbers.
02. Avoid additional context.
03. Use default arguments instead of short circuits.
04. Restrict function arguments to three(3).
05. Function should do one thing.
06. Avoid Boolean flags as parameters.
07. Encapsulate conditionals.
08. Avoid contractions while naming.
09. Use a prefix when naming Boolean variables (i.e is*, has*)
10. Use a verb when naming functions(get, set, reset, fetch, remove, delete and handle etc).

Make sure you write better code today than yesterday.

I.A.S.
Автор

Very good tips!
In #3 though we could also write
discount ?? 10
This yields 0 also when discount is 0.

ScriptRaccoon
Автор

Finally someone showing REAL clean code. I didn't agree that much with the last one, but I think it's a nice idea

GoWokeGoBroke
Автор

For avoiding additional context, does that translate to folder structures?

Games
— Fun Games
— My Games
— Complex Games

This would look pretty funny like this:

Games
— Fun
— My
— Complex

Think there’s some subtle grammatical rules in play here.

justingiovanetti
Автор

Few things to add, 1. Don't overuse comments instead try to write intuitive code.
2. Prefer functional to imperative styles (you may have to deal with performance issues sometimes)
3. Use typescript if you haven't started yet.
4. Don't overuse optional chaining(?.) or short-circuiting...as u may miss potential errors.

Nikhilsharma-dptw
Автор

with es6 rest operator, is it a bad idea to use ...rest arguments instead of the object ?

mentoriii
Автор

Good one. single responsibility principle is great, but is it a good approach to have so many functions(as mentioned in #5)

Nikhilsharma-dptw
Автор

Hi Vishwas, Thanks for your tutorial on React, its direct and explanatory. I will so appreciate if you could make something for react native

kingsleyezenna
Автор

In 6 part may be fisrt get discont and then cost price? It's equal SRP and DRY. Now in 6 part we repeat same code in both functions, it's violates DRY.

alienspro
Автор

Thank you for these tips!
I have a question:

In #1, you write const MIN_PASSWORD_LENGTH = 8 and in #6 const MEMBER_DISCOUNT = 0.30
Why do you use uppercase?

antjeplatte
Автор

Really usefull, even for experienced developers, thanx a lot

cyril
Автор

Hey Vishwas, thanks for the great video as always. 👍

brandonwie
Автор

Great suggestions. Thank you.

1 suggestion: adding timestamp in your videos will be more helpful to go through.

Many thanks,
P.

PratikSoni
Автор

Good video but I'm requesting u to upload JavaScript course please

kirant
Автор

Can i video of get Angular cleaner code ??

balajeebala
Автор

Sir your voice is really effective. From your name it looks like you're from India l, but from your voice it looks like you're from abroad. What's actually? I'm eager to know.

husler
Автор

Please make a tutorial on firebase auth and firestore, I've seen some tutorials but can't wrap my head around on this. I believe if you make a tutorial series on these topics then I will definitely understand it.

devdive
Автор

Useful, thanks. But you need work on your speech.

dyroblesmercedes
welcome to shbcf.ru