Relative Content

Tag Archive for globals

Plugin system design core component access: Common practice?

I wonder how to design a good plugin architecture in C++/Qt. The main concern I have is about dependency injection vs globals when it comes to the core components. Plugins should have access to several core functionalities like registering a socket listener, modifiying the tray menu, have acces to the main window, starting/restarting the app, have acces to the extension pool etc…

Is using a global to maintain the currently logged in user bad practice?

I’m doing some android development in a relatively inexperienced group, and all of the data used by our application is managed in a database. There are several instances where we’ll need to pull info from the database using the identifying information/PK of the user who is currently logged in. Because the only info from the user that is important is the PK (IE we don’t need an entire class to represent the types of users or any associated data), and because this ID is important throughout the scope of the application and will not change once it is defined, we considered storing the ID/PK of the user in a global on successful login.

Global variables in javascript

I don’t consider myself a highly skilled javascript developer, but I thought I got one thing right for sure: don’t create global variables unless you really have to.