16.18: Polymorphism in JavaScript - Topics of JavaScript/ES6

  Рет қаралды 65,227

The Coding Train

The Coding Train

Күн бұрын

Пікірлер: 80
@wepranaga
@wepranaga 5 жыл бұрын
I wish you had a podcast. I'd listen to it all day :))
@jaredreyes7455
@jaredreyes7455 3 жыл бұрын
Yes please!
@jhack89
@jhack89 5 жыл бұрын
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.
@leandroaraujo4201
@leandroaraujo4201 5 жыл бұрын
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.
@MFBA
@MFBA 5 жыл бұрын
you are
@benjaminoechsle2091
@benjaminoechsle2091 5 жыл бұрын
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! :)
@lindascoon4652
@lindascoon4652 5 жыл бұрын
Never seen anyone more excited about OOP. I feel excited now.
@entalpa
@entalpa 5 жыл бұрын
Use TypeScript if you want to be more excited :)
@TheCodingTrain
@TheCodingTrain 5 жыл бұрын
😂
@0xTim
@0xTim 5 жыл бұрын
*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*
@djtygre
@djtygre 5 жыл бұрын
no one cares about type casting. he runs loose. if you prefer the C++ environment, declare yourself. it's a common comment, and super annoying, strict, ridiculous, etc. the whole thing he built avoids this banality of this classist syntax, some things to consider when you make your own speech. you can build you own programs bro!
@djtygre
@djtygre 5 жыл бұрын
also. use python since you like it so much pretty simple syntax huh? i use python to control rasp pi. sort of a crap language to processing but hey, get strict.
@andrewkiminhwan
@andrewkiminhwan 5 жыл бұрын
leave it to Daniel to simple explain concepts like this that have evaded my grasp for years
@lankanathdiaspitawalage7783
@lankanathdiaspitawalage7783 3 жыл бұрын
excellent work. I come from a Java background and your explanation cleared me from many misconceptions. Thank you So MUCH
@SimonTiger
@SimonTiger 5 жыл бұрын
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.
@kathanshah5613
@kathanshah5613 5 жыл бұрын
You are making my day very creative Thanks alot
@shogunz
@shogunz 5 жыл бұрын
Thank you man now with all your tutorials I can code
@lukasluftlaufer1093
@lukasluftlaufer1093 4 жыл бұрын
mind = blown! What a cool idea to inherit the vector class this way!
@cani8846
@cani8846 5 жыл бұрын
I love your es6 videos
@limitless1692
@limitless1692 4 жыл бұрын
The way thatt you corected yourself with that clip was pretty wow i mean WOW :)
@yves2522
@yves2522 4 жыл бұрын
Just amazing how you explain things...You're great ;-)
@flat9safety
@flat9safety 5 жыл бұрын
Awesome video. Thanks Daniel!
@oussamasethoum2755
@oussamasethoum2755 4 жыл бұрын
i can't seem to find a way to make encapsulation in ES6 using the class keyword !
@adarshsoni5323
@adarshsoni5323 5 жыл бұрын
Please make in depth course on JavaScript
@DawutMuhammetgurbanow
@DawutMuhammetgurbanow 10 ай бұрын
Why you dont explaining about your last video codes. You are showing them but i dont know what do some methods of your code of last video.
@grainfrizz
@grainfrizz 5 жыл бұрын
Everything extends Object. #life
@leandroaraujo4201
@leandroaraujo4201 5 жыл бұрын
Yes, you can also say: class blahblahblah extends null {} doing so, clears the object's prototype
@kiwi1361
@kiwi1361 5 жыл бұрын
except death
@seddikibelgacem2393
@seddikibelgacem2393 5 жыл бұрын
Thank you shiffman your the best
@Gaprop
@Gaprop 5 жыл бұрын
At around 7:00 when you wrote this.vel = p5.Vector.random2D(); Couldn’t you have said this.vel = super.random2D(); instead?
@TheCodingTrain
@TheCodingTrain 5 жыл бұрын
Great question! random2D() is actually a "static" function so is called by the class name itself.
@Itscheho
@Itscheho 5 жыл бұрын
Just wanted to mention that polymorphism can also refer to polymorphic functions/methods which is something implemented in javascript as far as i know.
@TheCodingTrain
@TheCodingTrain 5 жыл бұрын
Oh, thank you!
@Itscheho
@Itscheho 5 жыл бұрын
@@TheCodingTrain oh just realized after seeing you reply that i have a typo there.. Should be "... something NOT implemented..."
@giorgibatsiashvili4270
@giorgibatsiashvili4270 5 жыл бұрын
More JS OOP Stuff please Sensei
@m.b786
@m.b786 5 жыл бұрын
crystal clear ! give that to my stud
@getrundelthd9807
@getrundelthd9807 5 жыл бұрын
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.
@seancpp
@seancpp 5 жыл бұрын
+1 underrated comment
@TheCodingTrain
@TheCodingTrain 5 жыл бұрын
Ah, thank you for this. Excellent clarification and explanation! I wish I could pin two comments! If you'd like to write this up somewhere I could link to it from the description? Or perhaps I should make a follow-up video to go through all these terms: * strongly vs weakly * static vs dynamic * explicit vs implicit
@olgamazurenko8142
@olgamazurenko8142 5 жыл бұрын
Super understandable. Thank you a lot!
@GuilhermeBorgesCunha
@GuilhermeBorgesCunha 5 жыл бұрын
Question: on Java, if wanted to use polymorphism, would I need to declare two methods with the Override statement? I noticed that on JavaScript you haven't to implement two methods, you used exactly the same.
@oofusmcdoofus
@oofusmcdoofus 5 жыл бұрын
Watch the processing videos on polymorphism
@stevegalili355
@stevegalili355 5 жыл бұрын
Great video Dan!!
@MegaMadness
@MegaMadness 5 жыл бұрын
Hey, could you make a new Vector tutorial for p5? Thanks!
@oofusmcdoofus
@oofusmcdoofus 5 жыл бұрын
Watch the processing videos theyre just about the same just the syntax is a bit different
@grainfrizz
@grainfrizz 5 жыл бұрын
Publish in 2:1 please?
@diogoalmeida762
@diogoalmeida762 5 жыл бұрын
Hi! i'm making a litlle game in processing...But i got a problem that is i dont know how to set the coordinates to be the same on every monitor type using fullscreen...like in a 1920x1080 the coordinates are different from a 1600 x 900. Can anyone help?
@BoJaN4464
@BoJaN4464 5 жыл бұрын
If you're doing UI, think of the UI elements as being "attached" to a side of the screen. For example, if you want an ammo indicator in the bottom right, draw it at {x: screen.width - ammo.width, y: screen.height - ammo.height} so instead of being relative to the top left(0,0) it's now relative to the bottom right(width,height) You can also treat your screen coordinates as being between 0 and 1 and then multiplying them by width and height but then you have to deal with scaling and it's honestly a huge hastle.
@kiwi1361
@kiwi1361 5 жыл бұрын
I love you, thank you for explaining this
@kustomweb
@kustomweb 5 жыл бұрын
Function isAppreciated(you,byme) { return true; }
@geoffwagner4935
@geoffwagner4935 Жыл бұрын
wow, if you thought these videos were incredible the first time. try a second time some time later.
@lumschente
@lumschente 5 жыл бұрын
Accidentally liked, but it's ok xD
@tahsincesur1927
@tahsincesur1927 5 жыл бұрын
i can feel my brain got bigger 👌👌
@kiwi1361
@kiwi1361 5 жыл бұрын
i can feel your brain getting bigger too (?)
@5head924
@5head924 5 жыл бұрын
Hi i was watching your p5 series on 3:3 you show how to do key pressed and I was wondering how I get that to to work on a specific key. Help from anyone would appreciated 😃
@TheCodingTrain
@TheCodingTrain 5 жыл бұрын
if (key == 'a') is for the a key. For more, would you mind asking at discourse.processing.org/! It's a better platform for Processing and p5.js related code questions. You can share code there easily! Feel free to link from here to your post.
@5head924
@5head924 5 жыл бұрын
The Coding Train ok thank you
@toastyPredicament
@toastyPredicament 2 жыл бұрын
Ya I made an qbit thing but it's not stable because I'm at room temperature but it's a physical qbit
@miscellaneous9932
@miscellaneous9932 5 жыл бұрын
This is gold!
@uovo
@uovo 5 жыл бұрын
i enjoy your videos more than the stupid dumb videos i watched before i discovered your channel, that is impressive
@slyer7695
@slyer7695 5 жыл бұрын
Love from Italy!!!! ❤️❤️❤️❤️ 🇮🇹 #LoveFromItaly9
@vladimiroganesov1249
@vladimiroganesov1249 3 жыл бұрын
The guy is amazing! =)
@princeshukla3095
@princeshukla3095 5 жыл бұрын
Very useful video
@jonathan-._.-
@jonathan-._.- 5 жыл бұрын
polymorphism in javascript seems kinda useless oO ? i mean you could jsut push any object into the array that has a show and update function and it would still work its not like javascripthas such a thing as typed arrays
@HayderAmeenDoctor
@HayderAmeenDoctor 4 жыл бұрын
AMAZING VIDEOES
@kingykronous2284
@kingykronous2284 5 жыл бұрын
Is that a double upload? I need to start learning to keep up Well, really I still haven't really learned to make a simple game, just some moving shapes, but still...
@TheCodingTrain
@TheCodingTrain 5 жыл бұрын
Save this for later, you don't need it now if you are just starting out!
@kingykronous2284
@kingykronous2284 5 жыл бұрын
@@TheCodingTrain Yeah that's true. I also have a question. Which would you recommend for a beginner, p5js or processing 3? I have learned a little in p5js but it's not a problem to instead learn java and use processing 3. I've heard sometimes that java is a great beginner language, especially if you want to learn something like C# and the fact that processing 3 has it's own program rather than needing one for writing code. Javascript has been pretty simple for me and easy to learn especially with your channel and the p5js reference library. Edit: Too late I've switched you can't stop me now
@kingykronous2284
@kingykronous2284 5 жыл бұрын
I'd also like to say that your tutorials are great for beginners and being able to talk with you, ask you questions makes your channel a lot better.
@toastyPredicament
@toastyPredicament 2 жыл бұрын
Pls be ok
@davidascholer
@davidascholer 4 жыл бұрын
Not sure why, but him jumping into the screen w him in the background kinda freaked me out.
@HHJoshHH
@HHJoshHH 8 ай бұрын
🔥
@kathychung6026
@kathychung6026 3 жыл бұрын
I noticed that you had a longer neck and rounder face in the other video -- both cute, don't get me wrong. That's right, I got side-tracked.
@alinawaz4034
@alinawaz4034 5 жыл бұрын
first
@lumschente
@lumschente 5 жыл бұрын
Nice, I hope you enjoy it.
@toastyPredicament
@toastyPredicament 2 жыл бұрын
I want to be a good girl
@Pizzaguy2
@Pizzaguy2 5 жыл бұрын
can u adopt me ?
16.3: ES6 Arrow Function - Topics of JavaScript/ES6
22:32
The Coding Train
Рет қаралды 273 М.
Coding Challenge 180: Falling Sand
23:00
The Coding Train
Рет қаралды 1 МЛН
Каха и дочка
00:28
К-Media
Рет қаралды 3,1 МЛН
16.10: Particle System with JS Array Functions - Topics of JavaScript/ES6
20:20
Coding Challenge 183: Paper Marbling Algorithm
32:10
The Coding Train
Рет қаралды 80 М.
16.1: let vs var - Topics of JavaScript/ES6
12:20
The Coding Train
Рет қаралды 223 М.
Fundamental Concepts of Object Oriented Programming
9:16
Computer Science Lessons
Рет қаралды 964 М.
5 Tips For Object-Oriented Programming Done Well - In Python
16:08
16.7: Array Functions: reduce() - Topics of JavaScript/ES6
14:40
The Coding Train
Рет қаралды 133 М.
Prototypes in JavaScript
14:05
Sam Meech-Ward
Рет қаралды 2,7 М.
16.12: Promises Part 2 - Topics of JavaScript/ES6
11:50
The Coding Train
Рет қаралды 103 М.