Reputation
6,533
Top tag
Next privilege 10,000 Rep.
Access moderator tools
Badges
15 51
Newest
 Necromancer
Impact
~372k people reached

Jan
4
comment Does making a method static save memory on a class you'll have many instances of?
@JacquesB it was meant semiseriously.
Jan
3
comment Does making a method static save memory on a class you'll have many instances of?
Ins't the answer to every OO related question: Dependency Injection? If you're bothered about the memory overhead you could just design a "saver" object of which you make one instance, that can be injected....
Dec
28
comment Doesn't “always initialize variables” lead to important bugs being hidden?
And initializing with -1 can be actually meaningful. Where "int bytes_read = 0" is bad, because you can actually read 0 bytes, initializing it with -1 makes it very clear no attempt to read bytes has succeeded, and you can test for that.
Dec
26
comment Doesn't “always initialize variables” lead to important bugs being hidden?
It's easy: only initialize variables if it's meaningful. If it's not then don't. I can agree though that using "dummy" data to do it is bad, because it hides bugs.
Dec
23
comment At what point is it taboo to have loops within loops?
I get confused why you jump from indentation to levels of looping? You have a large quote discussing indentation and suddenly from that follows a question about nested loops.
Dec
20
comment Why can't we use IP address instead of cookies in identifying the client in servlets?
@java when I log into my banks website with Firefox, I do no expect to be logged in with chrome. Both browsers work independently with their own sessions.
Dec
16
comment Why would you store an enum in DB?
@user2023861 And that's why we have ISO 5218 : en.wikipedia.org/wiki/ISO_5218 : Male = 1, Female = 2, Unknown = 0, Not Applicable = 9
Dec
16
comment Why would you store an enum in DB?
@user3748908 it bluntly comes down to this: do you want a fancy spreadsheet or a relational database? If it's the latter then become comfortable with joins.
Dec
15
answered Why can't we use IP address instead of cookies in identifying the client in servlets?
Dec
15
comment Why can't we use IP address instead of cookies in identifying the client in servlets?
Even on a Lan you can't. If I open a site in Firefox and Internet Explorer I fully expect to have two different sessions.
Dec
5
comment How is defining that a method can be overridden a stronger commitment than defining that a method can be called?
You could easily turn that argument around into: the first coder makes a cleanup argument, but makes mistakes and doesn't clean everything up. The second coder overrides the cleanup method and does a good job, and coder #3 uses the class and doesn't have any resource leaks even though coder #1 made a mess of it.
Nov
27
comment How can I estimate the lifespan of a line of code?
"how long a specific line of code is active and in use" why do you think this is a good metric?
Nov
25
comment Does this code solve the square/rectangle Liskov Substution Principle example?
First you have a case with A and B and run into troubles. Now you introduce C and solve it for A and C and solve it for B and C, it's still not resolved for A and B, that's just evading the problem. You could just as well make a class C : "nothing" and inherit A and B from that.
Nov
25
comment Does this code solve the square/rectangle Liskov Substution Principle example?
@DocBrown added a paragraph.
Nov
25
revised Does this code solve the square/rectangle Liskov Substution Principle example?
added 276 characters in body
Nov
25
answered Does this code solve the square/rectangle Liskov Substution Principle example?
Nov
24
awarded  Nice Answer
Nov
23
comment Optimization: How much time saved is considered worth it?
@LeeYikJiun the problem is that you ask a very general question. what is a: "competent programmer"? I know guys that make millions while programming but will give you a glazing stare when you start about cache misses. Also, when it's worth it, I mean there is no general answer to that. In a windows environment, a buttonpress that takes 1 second is waaaaaaaay too long while when I'm building a report people don't care about 10 or 20 seconds more. I've even had instances where I had to "slow down" the process because my customers didn't believe the computer could be that fast.
Nov
23
comment Optimization: How much time saved is considered worth it?
It depends. Really can't answer this.
Nov
19
comment Converting from List<Object> to Array with threads
May I ask why you want to do this? Because actually I'm trying to rid my code as much as possible from arrays moving to lists