Linked Questions

15
votes
4answers
3k views

Is it overkill to wrap a collection in a simple class only for the sake of better readability?

I have the following map: Map<Double, List<SoundEvent>> soundEventCells = new HashMap<Double, List<SoundEvent>>(); This HashMap maps double values (which are points in time) ...
6
votes
2answers
252 views

What time horizon and level of abstraction is the right for the maintainable and evolvable software? [closed]

From time to time I feel exhausted in my software development efforts because I am pressed to think and develop in very specific and very short term manner. One client here and now requires one ...
-1
votes
2answers
109 views

Common way to name methods with same name as desired variable? [closed]

I frequently find myself pulling up helper methods in order to make my code better, but end up with duplicate method names. Is there a standard way to name such methods without getting duplicate names?...
33
votes
5answers
20k views

At what point/range is a code file too big?

I'm finding lots of 2-3k line files, and it doesn't really feel like they should be that big. What is a good criteria to objectively call a source code file "too big"?, is there such thing as a ...
0
votes
2answers
512 views

How to prevent 'global variables' in a big project?

With 'global variables', I mean Variables on namespace level Static data members in classes Static variables in functions In a big C++ project I would like to have a mechanism (like a compiler ...
3
votes
2answers
426 views

Is using spacing effectively equivalent to the long method code smell?

There's a common code smell involving long methods with the most common answer being that methods should be really small, less than 50 lines per say (or 20). I understand why this is because it ...
95
votes
13answers
18k views

Should we eliminate local variables if we can?

For example, to keep a CPU on in Android, I can use code like this: PowerManager powerManager = (PowerManager)getSystemService(POWER_SERVICE); WakeLock wakeLock = powerManager.newWakeLock(...
33
votes
5answers
19k views

Should I initialize C structs via parameter, or by return value? [closed]

The company I work at is initializing all of their data structures through an initialize function like so: //the structure typedef struct{ int a,b,c; } Foo; //the initialize function ...
40
votes
18answers
27k views

What should be the maximum length of a function? [closed]

What should be the maximum length of a function? And are there cases which are an exception to this?
-3
votes
3answers
152 views

Is storing configurations in memory more performance and maintenance efficient? [closed]

My teammate has this class which contains a lot of Strings: public class Config { /** * List of status */ public static final String IN = "bla*"; public static final String ...
73
votes
17answers
7k views

What hurts maintainability? [duplicate]

For someone who doesn't have much real world experience yet, the notion of maintainable code is a bit vague, even though it follows from typical good practice rules. Intuitively I can tell that code ...
1
vote
2answers
127 views

Why should imports be made at the beginning

Why is it considered good style to do all imports in a python application at the beginning, even if what is imported is used only once? I have been programming only shorter pieces of software for a ...
1
vote
2answers
155 views

When should we use wrapper classes for data structures / what is the ideal number of packages

I recently wrote a program in which I wrapped a map data structure to increase the readability of code like so : package wrappers; import model.primary.customer.Customer; import java.util.HashMap;...
13
votes
3answers
1k views

Is using C/C++ macros as a shortcut for conditional compilation a good practice?

Let's say I want to have several types of output messages in my code. One of them is DEBUG, which is printed only, when the code is compiled in Debug mode. Usually I'd have to write something like #...
141
votes
18answers
42k views

Is there an excuse for short variable names?

This has become a large frustration with the codebase I'm currently working in; many of our variable names are short and undescriptive. I'm the only developer left on the project, and there isn't ...

15 30 50 per page