So many patterns. Which ones do you use most? Source code at: github.com/JasperKent/The-Flyweight-Pattern Remember to subscribe at ua-cam.com/channels/qWQzlUDdllnLmtgfSgYTCA.html And if you liked the video, don't forget to click the button.
Performance is always going to depend on the specific circumstances. The example is to simple for any benefits to really show. It's worth noting that as well as the memory benefit, there can also be a performance benefit, since reference comparison can be used as a quick check as the first stage of value comparison.
@@CodingTutorialsAreGo Not you specifically but it seems like most c# tutorials that suggest speed improvements don't use big datasets. Think about using /bchavez/Bogus (github) great faux data creator so we can see a scaled version and see the performance increase. BenchmarkDotNet then is like unit tests for performance testing.
Thats another very good Video. I have to try this Pattern in future Projects. Could you please make a video about the Repository and UnitOf Work Pattern? Sidenote: If I am not wrong you don't need the "else" Statement because if the item is found you return it immediately.
There are similarities, but they're not exactly the same. The purpose of a cache is to store things in memory in order to save repeatedly loading them from a slower data source (such as a database). But a cache doesn't necessarily do anything to merge identical objects. Flyweight does not have two separate levels of storage. The two can quite commonly be combined.
So many patterns. Which ones do you use most?
Source code at: github.com/JasperKent/The-Flyweight-Pattern
Remember to subscribe at ua-cam.com/channels/qWQzlUDdllnLmtgfSgYTCA.html
And if you liked the video, don't forget to click the button.
Nice so its a kind of recycling. Did you tried some stress testing with a high count of items? I am curious how the performance would improve.
Performance is always going to depend on the specific circumstances. The example is to simple for any benefits to really show. It's worth noting that as well as the memory benefit, there can also be a performance benefit, since reference comparison can be used as a quick check as the first stage of value comparison.
@@CodingTutorialsAreGo Not you specifically but it seems like most c# tutorials that suggest speed improvements don't use big datasets. Think about using /bchavez/Bogus (github) great faux data creator so we can see a scaled version and see the performance increase. BenchmarkDotNet then is like unit tests for performance testing.
Waiting for more design patterns.
Thats another very good Video. I have to try this Pattern in future Projects.
Could you please make a video about the Repository and UnitOf Work Pattern?
Sidenote: If I am not wrong you don't need the "else" Statement because if the item is found you return it immediately.
The use of else there is purely a matter of personal style. I prefer it because it keeps the code symmetrical.
Thank you for the video! Can we say that flyweight pattern and cache are the same things?
There are similarities, but they're not exactly the same.
The purpose of a cache is to store things in memory in order to save repeatedly loading them from a slower data source (such as a database). But a cache doesn't necessarily do anything to merge identical objects.
Flyweight does not have two separate levels of storage.
The two can quite commonly be combined.
@@CodingTutorialsAreGo Ok, now I get it. Thanks!