Why doesn't MatterJS make more use of the prototype pattern?
See original GitHub issuePlop,
We use the MatterJS objects as follow:
var myEngine = Matter.Engine.create(...);
Matter.Engine.run(myEngine);
I personally love the prototype pattern, which would allow to write myEngine.run()
instead of going through Matter.Engine
again. Why doesn’t MatterJS use it? I’m just curious about it.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Javascript prototype subtleties: why 'new' matters
The second pattern was designed to make prototypal inheritance look like classical inheritance. It's only used in JavaScript and it hides the way...
Read more >Prototype Pattern in TypeScript - Medium
The Prototype design pattern is good for when creating new objects requires more resources than you want to use or have available.
Read more >Prototype Design Pattern in JavaScript | DigitalOcean
The prototype model is used mainly for creating objects in performance-intensive situations. The objects created are clones (shallow clones) of ...
Read more >Why did JavaScript creators decide to use the prototype ...
The gang of four book clearly mentions that prototype pattern shines best in ... point where you can make a bunch of snap...
Read more >Landslide size matters: A new data-driven, spatial prototype
Many more applications should be successfully validated before considering ... However, no data of landslide dynamics (e.g., kinetic energy) are currently ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
15 days later, and after reading a good dozen of articles, I still don’t understand why MatterJS is using this kind of code rather than using the Prototype chain. In my own limited vision of it, it’s just inducing more code to write and not using one of JS most powerful feature. The articles that @marlonicus provided rather speak for the prototype pattern, not for the namespace use.
If this is not the right place to discuss it, please accept my apologies and close as resolved.
Well THANK YOU, I wanted to be productive today. GUESS NOT.
Thanks for the links. To me, it kinda seems like a pointless excess of code, so I’m definitely missing something. Coming back here tonight when I have read all that.