HNHacker News
TopNewBestAskShowJobs

Parsyval

59 karma · joined January 25, 2018

submissionscomments
Parsyval··on JavaScript: prototype vs. class
Well writing code is much simplier this, but devs that are familiar with 'classical' OOP languages will do a lot of mistakes because of what is in the article.
Parsyval··on JavaScript: prototype vs. class
Since I work with Typescript, I do the same with the TS playground, it's really usefull to learn that kind of stuff.
Parsyval··on Typescript: class vs. interface
'proper classes' no 'class' keyword syntaxical sugar, behind it's all prototypal. Please understand that if you are doing JS.
Parsyval··on Typescript: class vs. interface
Of course, you are right when you say "Once you create an instance of something [...] code will be created". But what I am pointing here is BEFORE you create any instance of anything.

You define a contract, what your object should look like. With an interface it's checked before runtime and then translates to no code. But using a class, you have code generated for the runtime.

Parsyval··on Typescript: class vs. interface
Thanks for this input, I'll see about that.
Parsyval··on Typescript: class vs. interface
"interfaces don't have a runtime representation" I was looking for a good way to say that while writing the article, this is a very good way ! Thanks Also I like that you think about the use of instanceof, I didn't really think of that, but some devs use this condition intensively.