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

126
Visualizações
Is there a problem in constantly been updating properties of an object created with singleton?

I'm using a Response object in order to create http responses. My responses are objects created with a function and using several parameters, one of these parameters is a string get from a method of an object that makes a quick query of some data inside the code itself.

The problem is that to every new Response represents a new Response object, and I'm trying to get a better performance creating the Response object with a singleton design pattern, but I don't know if there are some consequences because of being constantly updating the server´s running object´s properties to change the specified data I'm querying at every response time or even if there is a better way of getting a better performance without using a singleton design pattern.

In this example I18n.getString() is the method I would be constantly changing the parameters in order to get new data

const okResponse = function (data, locale) {
    return (new Response(200, "SUCCESS", true, I18n.getString(locale, 'ok-title'), I18n.getString(locale, 'ok-message'), data, {}, new Date())).toJSON()
}
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