Tag Info

New answers tagged

7

The text you quoted has good advice, although I will replace “data structures” by “records”, assuming that something like structs is meant. Records are just dumb aggregations of data. While they might be mutable (and thus stateful in a functional-programming mindset), they don't have any internal state, no invariants that have to be protected. It is ...


3

The fact that handleTrade() and updateRun() always happen together (and the second method is actually on the visitor and calls several other methods on the data object) smells of temporal coupling. This means that you must call methods in a specific order, and I would guess that calling methods out of order will break something at worst, or fail to provide a ...


0

From my point of view a class should contain "values for state (member variables) and implementations of behavior (member functions, methods)". The "unfortunate hybrid data structures" emerges if you make class state member-variables (or their getters/setters) public that should not be public. So I see not need to have seperate classes for data data ...


6

If all of these parameters are always required (never optional), vary independently, have no sensible sub groups, and have widely varying values then it will be tough to do better than you've already done. Named Arguments can make the long list less confusing to read. If that's not exactly the case then there may be room for improvement. Ask yourself: ...


15

This really isn't answerable without knowing the exact case you are trying to solve. The reason they call them "code smells" is not because the "smell" itself is bad but rather because it indicates that there is something else wrong, a metaphorical pile of crap underneath generating that smell. As such, the answer generally is not to directly attack the ...


1

Do the members of Job logically cohere into an object? Yes. What can you do with a Job? Start it, stop it, query its state. Sounds like you've got a bona fide object there with start(), stop(), query() instance methods.



Top 50 recent answers are included