Linked Questions

5
votes
3answers
2k views

How can I effectively manage long-term feature development and short-term bug fixing at the same time?

We have a huge C, and C++ code base. There is a plan to add a new feature into the existing system, but, this should happen only after 3 to 4 months. So, we are looking for best possible options. ...
3
votes
2answers
305 views

Place variables frequently used by the same function on the heap?

Say that I have the following situation: void myFunc() { int x; //Do something with x } "x" is placed on the stack which is no doubt fast. Now, "myFunc" is called very frequently, lets say ...
6
votes
5answers
931 views

Are “open-closed principle” and “less coupling” rationales to use global state?

Consider I'm writing a mobile app with user-login feature, using a framework which can be simplified like that: class UserData{ static token=""; static name=""; static balance=0; } class ...
5
votes
5answers
3k views

Proper OO design for State and Command

I'm working (a bit) on a (turn-based strategy) game. There are two classes relevant for the question: State: This is an immutable class, which exposes all its fields (either via getters or another ...
5
votes
3answers
1k views

Are we overlooking bad effects of global state in this design?

I’ve read the answers to Why is Global State so Evil?, and I think the negative consequences do not apply in this situation. However, that’s what everyone says just before they get hit by a falling ...
4
votes
1answer
3k views

How to avoid global state without large function signatures?

So, there are some good answers to this question, namely: Why is Global State so Evil? I have a specific question about the alternatives Mikera proposed as the answer with the second most up-votes. ...
2
votes
1answer
7k views

Memory usage of global versus local variables

I am a beginner in C coding. I'm writing a C code where a variable is required to be used by different functions. I want to ask whether to use a global variable and manipulate it through functions or ...
0
votes
2answers
316 views

Is the global state believed to be evil because of its nature or mostly due to its usual, no-rules usage?

I don't dislike global state, but that could be due to the lack of experience. I was thinking about what the usual implementation of global state is: A big variable where data flows in a non-...
2
votes
3answers
2k views

Using static to create an immutable object

I was reading on this software engineering page about the use of static methods. However, I'm confused, and maybe it's about the context in which it talks about static. The idea is, that static is ...
1
vote
1answer
2k views

Is it a good idea to use my own callback mechanism instead of standard implementation like startActivityForResult?

I am trying to create a simple app which has 2 activities, which enter text on one activity and then displays it on the title bar if another activity: EditTextActivity: MainActivity: I know the ...
4
votes
1answer
1k views

Why shouldn't a static class have an internal state?

While working on a project, I decided to create a database class to manage my DB connection. I started looking for the best practice to do that, which is usually either a static class or a singleton ...
1
vote
2answers
346 views

Is it a good idea having default static variables for new instances?

OK let's say I have something like this: public class MyObject { public static int DefaultValue = 9 private int _value = DefaultValue; public int Value { get { return _value; } set { ...
1
vote
1answer
2k views

Why singleton is an anti-pattern? [duplicate]

Many articles in Internet say that singleton is an anti-pattern, because it makes debugging more difficult. However I don't understand why debugging a program with a singleton object is difficult. ...
-2
votes
1answer
1k views

Global variable or parameter?

Is it correct that homeitem should be declared inside the OnLoad method and overgiven to all the render methods instead of just declaring it as a global variable and accessing it by all the render ...
2
votes
1answer
911 views

Preserving data in js with multipage application

One benefit of single page applications like Angular.js, is that you can store data in a global variable and access in multiple routes. With multiple page applications, the data is lost during ...

15 30 50 per page