DEV Community

Cover image for [JavaScript] 7 OOP fundamentals you will need!

[JavaScript] 7 OOP fundamentals you will need!

Yuma-Tsushima on June 30, 2021

Object Oriented Programming is one of the most popular ways in programming. Before OOP’s, list of instructions will be executed one by one. But in ...
Collapse
 
michaeljota profile image
Michael De Abreu

Although, legacy patterns should be studied, I think is important to understand that modern Javascript does have full support for almost all of the OOP patterns that you are using, and you should at least mention that in your post, so newcomers know there is a modern alternative, and it is the preferred way to do it.

Collapse
 
yumatsushima07 profile image
Yuma-Tsushima

Good point :)
I will add it on.

Collapse
 
yumatsushima07 profile image
Yuma-Tsushima

Good point.
I will add it on.

Collapse
 
jwp profile image
John Peters
Collapse
 
yumatsushima07 profile image
Yuma-Tsushima

Damn that's my 3 am mistake .
Thanks for catching me out.
I will add that on too.

Collapse
 
urielsouza29 profile image
Uriel dos Santos Souza
Collapse
 
yumatsushima07 profile image
Yuma-Tsushima

ah i didnt know that

Collapse
 
urielsouza29 profile image
Uriel dos Santos Souza

I prefer Functional :)

Thread Thread
 
ericdecol profile image
punk croc

i would say to stick to functional too, OOP just for case studies

Thread Thread
 
yumatsushima07 profile image
Yuma-Tsushima

hummm yeah !!

Thread Thread
 
urielsouza29 profile image
Uriel dos Santos Souza • Edited

TypeScript force OOP
TC39 force OOP, class, static and private
forcing oop like JAVA and C# (help programmers who don't want to learn JS rsrsrsrs)

More functional JS better, TC39

Thread Thread
 
yumatsushima07 profile image
Yuma-Tsushima

Ahhh ..

Collapse
 
ericdecol profile image
punk croc • Edited

Please try not to use constructors, since they are badly scalable, just imagine if you object grows and suddently you have to adjust you constructor in 18 different places. Rather use the BUILDER pattern for that, nothing will break changes only where needed. Just as when passing multiple arguments through parameter, build an object that contains those (and in the future, more or less) variables.

Collapse
 
yumatsushima07 profile image
Yuma-Tsushima

Good point!!

Collapse
 
mistycoruscate profile image
mistycoruscate

I will keep your suggestions in mind while writing the next post.

Collapse
 
yumatsushima07 profile image
Yuma-Tsushima

What's your next post about?

Collapse
 
efpage profile image
Eckehard

As I said earlier there are no classes in JavaScript as it is Prototype based language.

Maybe you should update your post to ES6?