Reputation
4,880
Top tag
Next privilege 5,000 Rep.
Approve tag wiki edits
Badges
2 12 17
Newest
 Populist
Impact
~109k people reached

  • 0 posts edited
  • 1 helpful flag
  • 92 votes cast
Apr
26
answered algorithm for shell language interpreter to find if a char is between quotes
Apr
22
comment What is the correct OOP relation between complex and real numbers?
Unless we're talking immutable objects here, the substitution property is not given, since we would expect to be able to set the imaginary part of the complex number to something, but if the actual object is just a real number, that's not possible. Also, design issues aside, this would just be an efficiency nightmare, since all your real numbers just doubled in size (before counting the overhead for being a class).
Apr
21
answered Single exit point meets Java streams
Apr
21
comment Single exit point meets Java streams
You just eliminated the early exit of the loop behavior, thus making the run time potentially a lot worse.
Apr
21
comment Naming when having to inherit classes
A lot of frameworks are designed for inheritance. Just not doing it is not necessarily an option.
Apr
15
answered Why don't languages that have big integer support have unsigned versions?
Apr
15
comment Best way of writing comments in code
It's going to be difficult to give good answers to this, since the example comment is describing things that are completely obvious from the code anyway.
Apr
15
comment Does having so many macros (#define) increase compilation time due to prolonged pre-processing?
That's not how macro replacement works. Instead, as the lexer parses tokens, it looks up the names in the macro table. The table is typically a hash table, so unless the compiler uses a poorly structured table the lookup will be O(1), i.e. roughly the same time whether you use 10 macros or 1000.
Apr
12
answered When in your language classes are objects too, does the Liskov substitution principle apply to their interfaces?
Apr
7
answered Static Polymorphism explained
Mar
30
comment Should every object know how to present/draw themselves?
The author should at one point have stopped writing and thought, "Do I actually want to teach people about OOP by talking about beer that wants to be in a bottle and tells operators when it can't?" I don't see how this is supposed to illuminate any concepts or ideas whatsoever to anyone.
Mar
17
comment How do I model similar types that have different data?
What I'm trying to say is that the status field needs to be able to handle additional data, because even if you turn "Duplicate" into something other than a state, some other state will inevitably have the need for additional data as the program evolves. I'm basically saying that the OP's statement "a simple enum would've sufficed" is wrong.
Mar
17
comment How do I model similar types that have different data?
That still leaves you with a design that breaks when the users decide they want "under review" to reference a reviewer.
Mar
17
comment How do I model similar types that have different data?
@JerryCoffin That shifts the problem from the status to the disposition field, but I don't see how it solves the underlying problem.
Mar
17
comment Why have private fields, isn't protected enough?
@TheAnathema In the context of the claim that protected should always be used over private, the statement sooner or later, you are going to make a subclass of a class has to use "a class" in the sense of "every class", else it is not in support of the claim in the first place.
Mar
15
comment Why have private fields, isn't protected enough?
@Trisped What do you mean by "make at least one subclass from one method"? I don't understand what making subclasses from methods should be.
Mar
14
comment Why have private fields, isn't protected enough?
Well, that's what reflection and makeAccessible() are for.
Mar
14
comment Why have private fields, isn't protected enough?
@ThorbjørnRavnAndersen "while developing but not when released" - how on earth is a class supposed to know? Do you really want to compile a test version that is different from the released version when you can't even test the release version? Tests shouldn't need to access private stuff anyway.
Mar
13
awarded  Populist
Mar
12
revised Why have private fields, isn't protected enough?
C++11 introduced final.