Design-Patterns icon indicating copy to clipboard operation
Design-Patterns copied to clipboard

Flyweight

Open pedrodaviddev opened this issue 7 years ago • 10 comments

Edit by @tonilopezmr: Solved #19

Implemented flyweight pattern. Maybe you are thinking... why are you merging with state branch??? This is because the great @tonilopezmr said that Flyweight can be implemented with State, so I make pull to see if this can be done. And I cant see the similaritys between these patterns so, here's my version of flyweight! So much love <3

pedrodaviddev avatar Mar 30 '17 09:03 pedrodaviddev

@Cotel Seems ok overall?

tonilopezmr avatar Mar 30 '17 18:03 tonilopezmr

Seems okay if you want to treat Kotlin like oldstyle Java, thats why I told him to update his code 🤣

Cotel avatar Mar 30 '17 18:03 Cotel

I don't understand anything of this pattern. I've been reading but it is still unclear to me. Can you explain it? I need to know how to review this before I get to it 😵

Cotel avatar Mar 31 '17 13:03 Cotel

https://en.wikipedia.org/wiki/Flyweight_pattern

https://sourcemaking.com/design_patterns/flyweight

And this is very good explanation 👍 http://www.arquitecturajava.com/java-flyweight-pattern-rendimiento/

tonilopezmr avatar Mar 31 '17 14:03 tonilopezmr

The last one explains what is, in resume, when you have a data structs with duplicates, you remove all your object duplication and share with other objects.

In the @Nhemesy example, he wanted to have a Soldiers that if are the same "type" (same soldier) only create once because are two object with the same values.

tonilopezmr avatar Mar 31 '17 14:03 tonilopezmr

@Nhemesy What do you think? you need see the last changes.

We need merge this

tonilopezmr avatar Apr 18 '17 14:04 tonilopezmr

@Nhemesy please

tonilopezmr avatar Apr 21 '17 22:04 tonilopezmr

Don't forget add Flyweight in README and complete with an example

tonilopezmr avatar Apr 25 '17 10:04 tonilopezmr

@tonilopezmr

@Cotel

@Nhemesy

tonilopezmr avatar May 13 '17 16:05 tonilopezmr

We are back! 💪

Cotel avatar Jun 14 '17 14:06 Cotel