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…
Why is global state hard to test? Doesn’t setting the global state at the beginning of each test solve the problem?
According to Why is Global State so Evil?, I know one of the disadvantages of “global state” is that it makes code “harder to test”. I do not disagree with this, but what I don’t understand is, why would it be “harder to test”?
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.
Use a global variable, a singleton, or something else
Preface: I am working in PHP (Abandon hope all ye who enter here).
Use a global variable, a singleton, or something else
Preface: I am working in PHP (Abandon hope all ye who enter here).
Use a global variable, a singleton, or something else
Preface: I am working in PHP (Abandon hope all ye who enter here).
Use a global variable, a singleton, or something else
Preface: I am working in PHP (Abandon hope all ye who enter here).
Use a global variable, a singleton, or something else
Preface: I am working in PHP (Abandon hope all ye who enter here).
Use a global variable, a singleton, or something else
Preface: I am working in PHP (Abandon hope all ye who enter here).
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.