Skip to main content

All Questions

3 votes
1 answer
239 views

Reducing Redundant Calculations

I am experiencing a dilemma. Let me explain it with two functions: # Takes vector.magnitude(), vector.x, vector.y and uses it somewhere def func1(vector, {other parameters 1}): pass # Takes ...
andrewgazelka's user avatar
11 votes
2 answers
11k views

Is an interface with only getters a code smell?

(I've seen this question, but the first answer goes about auto properties more than about design, and the second one says hide the data storage code from the consumer, which I'm not sure is what I ...
user3748908's user avatar
  • 1,657
31 votes
9 answers
31k views

Are init() methods a code smell?

Is there any purpose for declaring an init() method for a type? I'm not asking whether we should prefer init() over a constructor or how to avoid declaring init(). I'm asking if there is any ...
Dioxin's user avatar
  • 953
1 vote
2 answers
187 views

Does an interface including several methods that return instances of Object make sense?

I am in the process of writing my first true API. In the process, I am defining an interface for mapping complex data structures onto other complex data structures. At the moment, the interface ...
s.d's user avatar
  • 243
0 votes
3 answers
301 views

Java code quality in methods calling methods

I am currently working with an "interesting" code-base and see the following type of thing alot in the code. public Object doSomething() { Object obj = new Object(); // Do some stuff to the ...
user avatar
47 votes
10 answers
28k views

Is there any reason to use "plain old data" classes?

In legacy code I occasionally see classes that are nothing but wrappers for data. something like: class Bottle { int height; int diameter; Cap capType; getters/setters, maybe a ...
Michael K's user avatar
  • 15.6k