Prototype design pattern which create object without NEW keyword | Design patterns you must know.

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


The prototype pattern is a creational design pattern in software development. It is used when the type of objects to create is determined by a prototypical instance, which is cloned to produce new objects. This pattern can use to avoid subclasses of an object creator in the client application like the factory method pattern what we discussed does. also avoid the inherent cost of creating a new object in the standard way (e.g., using the 'new' keyword) when it is prohibitively expensive for a given application.

The client, instead of writing code that invokes the "new" operator on a hard-coded class name, calls the clone() method on the prototype, calls a factory method with a parameter designating the particular concrete derived class desired, or invokes the clone() method through some mechanism provided by another design pattern.

This video explains how to implement this with real-world examples and explain how they avoid new keyword and how fain performance.

#krish #codelabs #prototype
Рекомендации по теме
Комментарии
Автор

My most expected playlist. Getting excellent clarity...

venkatprasad
Автор

Man, if possible, I would love to see a video series on system architecture design
Like including the database choices, microservice interactions, division of microservices, syncing process, gateway, and all other component stacks. I would prefer it if you can also explain the pros and cons of each and the best choices.
By any chance, have you planned to do such video?

bipinkhatiwada
Автор

Very useful vedio, thank you sir. But please use writeboard to describe description/introduction of the pattern. It is very useful for us than you tell.

thusharidananjani
Автор

Hello, this is nice video to see the impact of performance when we need same type of instance every time.

For more details can you provide the performance comparison for specific case when performance impact is high for new keyword and very less with clone.
E.x. It can be object with many other object creation inside it.
I am asking this to check what are the scenarios for which we should put efforts to create prototype pattern for specific instance.

technocrats
Автор

Excellent Krishantha ..waiting for next patterns

sandeepmk
Автор

So all the time I am making an object it will give the copy object becz all time getInstance returning cloned obj. Am i correct.

yatri
Автор

Thanks, sir, that was a very important lesson.

smartitprojects
Автор

I'm a little confused with this. Doesn't the clone method create a new object with 'new' under the hood?

brenol
Автор

In a real use case scenario, should the relevant Registry class be a Singleton?

anonymous
welcome to shbcf.ru