The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
1answer
69 views

How to store/deal with data available to other classes

I'm writing a CAD program. Let's say I have in input class, this class reads various data from a text file and creates lots of lists/dictionaries and .... These data need to be accessed by other ...
1
vote
2answers
52 views

Why is entangling injectable with class that uses it a bad practice?

I have had this argument for a while, because I have noticed some people prefer "readable" code over properly structured one. So in the example I am showing, basically I have this Mapper class in ...
3
votes
2answers
360 views

Best approach for multilingual Java Enum

I'm running into issues with an approach I am taking and am now wondering if I just started down the wrong path and should rethink my approach. Here is what I attempting. I would like to use an Enum ...
3
votes
4answers
666 views

Static vs. non-static? (with non-OOP functions)

Although this question has come up before, mine is different because it is not supposed to cover anything OOP but only plain (ANSI) C. Especially in open-source software, I usually encounter a ...
-1
votes
4answers
160 views

Why can you have statefulness inside a static class in java?

I was playing around with Java today and I read about static inner classes. Why can you have 'statefulness' inside of a static inner class. For instance: class outerClass { static class ...
0
votes
1answer
96 views

Design Pattern : Static Array/List in Class Object

I'm a CS alumni, but we didn't learn much by the way of OOP, or Design Patterns. I've heard the phrase C with iostreams and thought it fitting. Anyway that's besides the point. I am just curious about ...
3
votes
3answers
567 views

Why shouldn't an object reference have access to a static member in C#

Context of my question: I am reading C#. Trying to understand Static keyword. I understand that when Static is applied to a member of a class, it can only be modified by the class and not the class ...
0
votes
1answer
82 views

When to used static visibility? [duplicate]

I can't attain the primary used of Static Visibility. My question is why they used static method & properties in this code? class PassHash { // blowfish private static $algo = '$2a'; ...
3
votes
7answers
698 views

Significant amount of the time, I can't think of a reason to have an object instead of a static class. Do objects have more benefits than I think? [closed]

I understand the concept of an object, and as a Java programmer I feel the OO paradigm comes rather naturally to me in practice. However recently I found myself thinking: Wait a second, what are ...
5
votes
2answers
1k views

Why prefer non-static inner classes over static ones?

This question is about whether to make an inner class in Java static or not. I searched around here and on StackOverflow, but couldn't really find any questions regarding the design implications of ...
0
votes
0answers
229 views

Use a global variable, a singleton, or something else

Preface: I am working in PHP (Abandon hope all ye who enter here). Background: There exists a large set of global functions in PHP, a number of which are miscellaneous system calls, like sleep (and ...
1
vote
3answers
302 views

When to use a Singleton and when to use a static class [duplicate]

I've searched about this here and on StackOverflow and found some differences between the two. But I'm still not sure in what cases one would prefer a Singleton, and in what cases one would choose to ...
26
votes
8answers
5k views

Why have private static methods?

I just wanted to clear up a question I have. What is the point of having a private static method as opposed to a normal method with private visibility? I would have thought an advantage to having a ...
1
vote
3answers
282 views

Why are inheritance and interfaces restricted to instance members?

Disclaimer: I think the rules are almost the same in most OO languages, but since I'm most familiar with C# I'll be relating to this specific language. I think that the use of attributes and ...
7
votes
4answers
1k views

Make methods that do not depend on instance fields, static?

Recently I started programming in Groovy for a integration testing framework, for a Java project. I use Intellij IDEA with Groovy plug-in and I am surprised to see as a warning for all the methods ...