you are viewing a single comment's thread
view the rest of the comments
[–] 5 points 1 day ago* (1 child)

Isn't a database only as global as you make it? The connection is surely a real object that needs to be passed around and referenced just like any other.

I don't really touch JavaScript or web dev so I might be misunderstanding the domain usage.

  • source
  • hideshow 1 child comment
  • [–] 2 points 1 day ago

    I think his point is more that you might have multiple components that need database access in your app, so those component have a connection (or reuse a central access) and for simplicity reasons, you made 1 database for the whole app, rather than one per component. Once that happens there's a new path that could be used to pass information between the components in a way that isn't the function interface. Much like a global variable can be used that way. And there's a risk you start to use the database like a global variable store.

    I don't use databases much, so I don't have a strong opinion, but it's an interesting thought.

  • source
  • parent