• xigoi
    link
    fedilink
    English
    2
    edit-2
    1 month ago

    It means you’re compensating for the lack of optional/named parameters in your language.

    • Traister101
      link
      fedilink
      21 month ago

      Eh? How’s that work. I’m not going to sit here and say there isn’t too many factories in Java but as a concept it’s extremely useful. You hand off a “factory” to something which actually creates the object. This is really useful in for example serialization. How so? You could register factories (mapped to some sort of ID) which get passed the serialized data and return some sort of created object. Now the core serialization code doesn’t know nor care how exactly any particular type gets serialized. Pretty nifty huh?

      Some languages have better ways to encapsulate this functionality but that’s what the factory concept is