Using Flyweight pattern in Java project

Publicado el: 15 septiembre 2020
en el canal de: Improve Your Programming skills
103
3

The flyweight pattern (structural design pattern) is used when we need to create many similar objects. Using Flyweight pattern, we reduce the creation of multiple objects. It help save memory and improve performance

If we build a game that creates 1000 soldiers. There are two types of soldier: Sniper and Commando. When using Flyweight pattern, we create 2 objects only. No need to create 1000 objects

Implementation steps:
1. Create an abstract class Soldier
2. Create CommandoSoldier class that extends Soldier
3. Create SniperSoldier class that extends Soldier
4. Create SoldierFactory


En esta página del sitio puede ver el video en línea Using Flyweight pattern in Java project de Duración hora minuto segunda en buena calidad , que subió el usuario Improve Your Programming skills 15 septiembre 2020, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 103 veces y le gustó 3 a los espectadores. Disfruta viendo!