Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
-
mundo0349116y@DangerousDev there are prototype based languages, where JS is the most popular.
That word just reminded me to Object.prototype.bullshit from JS
Never heard of prototypes on other OO languages though. -
@mundo03 Yeah JS is prototypical by nature, but other OOP languages like C# and Java, though not prototypical, can use Prototype Design Pattern in required cases
You can give it a read if you like 🙂
https://exceptionnotfound.net/proto... -
@irene The pattern does come in handy when creating a new object requires a costly operation. Now, maybe u can use a cloning method like you said (have to try out how that work out practically though), but one main point is also to HIDE the mechanism of creating new instance, but rather copy an existing object!
-
@irene Nope. A cloning method has broader semantics, that is, the properties of one object instance are duplicated in a new instance in way that they have same state but occupy diff memory locations. And they can be used in many diff ways.
Prototype pattern sorta 'Uses' clone for sort of seperating object instantiation from object use. While implementing prototype pattern, you sorta make sure that only way of constructing a new object of particular behaviour is by cloning a particular instance, the Prototype Instance.
Related Rants
Before you're hired:
1. A binary tree?
2. Currying?
3. Higher-order function?
4. How does event loop work?
5. What is prototype?
6. What is encapsulation?
7. Can you draw an algorithm?
After you're hired:
1. Hey, can you add auth token and login to our app?
rant
real world
recruitments
interviews
devlife
devs