Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Design and Architecture
  4. flyweight design pattern - need some explanation

flyweight design pattern - need some explanation

Scheduled Pinned Locked Moved Design and Architecture
designregexarchitectureperformancehelp
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    D4rkTrick
    wrote on last edited by
    #1

    hi, I'm reading about the flyweight design pattern. In my understanding it's basically something like 'use shared pointers/references to big objects in order to safe memory'. Example: I'm writing a website, that contains 1MB pictures all over it. All the pictures are the same. Now, instead of transferring the picture x times, I. transfer it only once and let the website content always refer to that already transferred picture. Am I right about that? The often used example with the letters and glyph does really confuse me here, so I'd like to recheck. I can't understand, why it would be better to have a referred letter instead of a simple char inside a class... I really appreciate any help here!! regards

    L 1 Reply Last reply
    0
    • D D4rkTrick

      hi, I'm reading about the flyweight design pattern. In my understanding it's basically something like 'use shared pointers/references to big objects in order to safe memory'. Example: I'm writing a website, that contains 1MB pictures all over it. All the pictures are the same. Now, instead of transferring the picture x times, I. transfer it only once and let the website content always refer to that already transferred picture. Am I right about that? The often used example with the letters and glyph does really confuse me here, so I'd like to recheck. I can't understand, why it would be better to have a referred letter instead of a simple char inside a class... I really appreciate any help here!! regards

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You will need to be more specific about what you mean by "transferring". Are you talking about content in a web page? FTP? What? What / why 1 MB images? For display in a browser? Why not thumbnails?

      D 1 Reply Last reply
      0
      • L Lost User

        You will need to be more specific about what you mean by "transferring". Are you talking about content in a web page? FTP? What? What / why 1 MB images? For display in a browser? Why not thumbnails?

        D Offline
        D Offline
        D4rkTrick
        wrote on last edited by
        #3

        Thank you for the answer! yes, I was assuming a web page. But apparently the example was not appropriate and therefore missleading. Maybe we should just skip the example. So the "flyweight" in the "flyweight" pattern refers small objects, that all share some heavy ressource?

        L 1 Reply Last reply
        0
        • D D4rkTrick

          Thank you for the answer! yes, I was assuming a web page. But apparently the example was not appropriate and therefore missleading. Maybe we should just skip the example. So the "flyweight" in the "flyweight" pattern refers small objects, that all share some heavy ressource?

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Yes; I would agree with your last statement. "Small objects" that container references / pointers to "big" / data objects.

          D 1 Reply Last reply
          0
          • L Lost User

            Yes; I would agree with your last statement. "Small objects" that container references / pointers to "big" / data objects.

            D Offline
            D Offline
            D4rkTrick
            wrote on last edited by
            #5

            thank you :):thumbsup:

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups