Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

92
Visualizações
Keeping same reference to object in system or not

I am wondering about one architectural problem.

Suppose I have several calls from api, at different times, that return me different objects and arrays. In these requests, sometimes there are the same objects whose key is id. I map them to class to have methods for them.

Should I make these objects have the same reference? Then it would be more convenient to call methods on these objects and they would update throughout the system. On the other hand it could cause some unexpected side effects.

How do you deal with such a problem? Do you have a general list of objects of a given type in your store and retrieve a reference from it when you need to assign it to another object? Or maybe you do not care about it, and even though it is theoretically one object with a given id, there are copies of it all over the system?

Or maybe you do not have nested objects and e.g. in the Car object there is only the engineId prop to search for it in the whole list?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda