16.18: Polymorphism in JavaScript - Topics of JavaScript/ES6

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


References:

Videos:

Timestamps:
0:00 Hello!
0:13 Encapsulation and Inheritance
0:57 What is polymorphism?
1:31 Strongly typed and explicit typing
2:42 When does this matter?
3:49 Let's make an array with multiple types of particles.
5:41 Extending classes you didn't write like p5.Vector!
8:59 Thanks for watching!

Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound

#polymorphism #oop #classes #javascript
Рекомендации по теме
Комментарии
Автор

I wish you had a podcast. I'd listen to it all day :))

wepranaga
Автор

Cristal clear explanation! I will definitely be watching your other videos on ES6 classes. Once I saw your video I suddenly felt the concept of ES6 OOP is simple and I could clearly see how it mimics the way things work in languages like C++ and Java also in polymorphism. Still, there are very few tutorials mentioning how it works as explicitly and in detail, and I always had doubts. Thank you so much!
I can really feel that you care about us understanding, and that makes the whole difference! By the way, your code is super clean! I really like your style of coding, and I will make a point of learning from it.

jhack
Автор

Dan, you are such a wonderful teacher. I love watching coding train videos and learning so much from you. Keep up your fantastic work and your nice spirit. The coding train is by far the best channel on youtube! :) <3

benjaminoechsle
Автор

Never seen anyone more excited about OOP. I feel excited now.

lindascoon
Автор

1:35 That was a great way to correct your mistake haha, I was wondering how you would fix that mistake during the livestream. Btw this video was interesting to watch!!! I like the way you teach, and explain things. I wish I was your student hehe.

leandroaraujo
Автор

excellent work. I come from a Java background and your explanation cleared me from many misconceptions. Thank you So MUCH

lankanathdiaspitawalage
Автор

leave it to Daniel to simple explain concepts like this that have evaded my grasp for years

andrewkiminhwan
Автор

*Type Systems*

In languages such as Java, a variable must be *explicitly* given a type, e.g. _int num = 42;_ in other languages, such as Python, the type is *implicitly* determined using type inference, e.g. _num = 42_ ( _num_ has type _int_ ).

With *static* typing, the type of a variable is already known at compile time. In the Java example above, the compiler already knows that num has the type _int_ . In a *dynamically* typed language, on the other hand, type checks only happen at runtime.

If a language treats types strictly it is *strongly* typed as opposed to *weakly* typed. A relevant characteristic is whether data types are implicitly converted. In JavaScript, for example, the comparison _2=="2"_ gives _true_ ( *weak* ), while _2==="2"_ gives _false_ ( *strong* ). In the first case, the types are converted accordingly.

EDIT: *See also GetrundeltHD's comment*

xTim
Автор

mind = blown! What a cool idea to inherit the vector class this way!

lukasluftlaufer
Автор

Thank you man now with all your tutorials I can code

shogunz
Автор

You are making my day very creative
Thanks alot

kathanshah
Автор

The way thatt you corected yourself with that clip was pretty wow i mean WOW :)

limitless
Автор

Just amazing how you explain things...You're great ;-)

yves
Автор

Compilers


C: Compiled to machine code beforehand, and then run.
Python / JavaScript: Interpreted as it's run, and executed that way.
Java: Very confusing. It's compiled down beforehand, but not to machine code. But to an intermediate language called ByteScript. Then, that ByteScript code is interpreted and executed.

SimonTiger
Автор

I think you've made a mistake with your explanation of strongly typed. Strongly typed does not mean that the type of a variable has to stay the same during the programs execution. This behaviour refers to statically typed and in fact Java is statically typed so you can't change a variables type but in Python you can so Python isn't statically typed. Strongly typed means you can't treat the same location in memory as the same type. In Python you can't do that you have to convert variables so that you can treat them as a different type because you have no direct memory access via pointers. Same holds for Java. In C you have pointers and you can cast e.g. a string pointer to an int pointer. That means you can treat the same location in memory as 2 different types and therefore C is weakly typed.

getrundelthd
Автор

Super understandable. Thank you a lot!

olgamazurenko
Автор

Please make in depth course on JavaScript

adarshsoni
Автор

I love you, thank you for explaining this

kiwi
Автор

Just wanted to mention that polymorphism can also refer to polymorphic functions/methods which is something implemented in javascript as far as i know.

Itscheho
Автор

Love from Italy!!!! ❤️❤️❤️❤️ 🇮🇹 #LoveFromItaly9

slyer
visit shbcf.ru