Reputation
6,145
Top tag
Next privilege 10,000 Rep.
Access moderator tools
Badges
2 22 29
Newest
 Nice Answer
Impact
~267k people reached

1d
comment Why are floats still part of the Java language when doubles are mostly recommended instead?
Imagine the 3D feature in google maps (I worked on something extremely similar). Millions of vertices, each with 5 values (XYZ for position and UV for texture). It is not a difficult optimization to make float work perfectly fine for rendering these models. With that in mind, why would you ever want to download (literally) twice as much data as is necessary to get it working? The difference in size between float and double may seem meaningless, but it adds up quick.
Apr
27
comment How does immutability remove the need for locks when two threads are trying to update the shared state?
@Telastyn, then I think we are on the same page.
Apr
27
comment How does immutability remove the need for locks when two threads are trying to update the shared state?
@Telastyn, Let's call things as they are. If you are taking a variable x and allowing multiple threads to change what it references, then you are doing plain ol' concurrent programming. After all--why would I care about the mutability of an object if the reference I have can be changed by someone else? It's mutability by another name. I'm not convinced by your answer that you understand how to use immutability eliminate locking.
Apr
26
comment How does immutability remove the need for locks when two threads are trying to update the shared state?
This is a nice simple example. Note that waitForWorkerToFinish() probably doesn't do a lock, but rather just does some form of Thread.join(), which is different.
Apr
26
comment How does immutability remove the need for locks when two threads are trying to update the shared state?
@AR7, Passing around values is the most common way I've seen this done (whenever I do this pattern, I just accept immutable function parameters and return results). When you do this however, you are still not modifying the original values, and therefore your algorithm is still basically immutable. The basic idea is that if you are never changing memory, you can automatically parallelize with no limitations. On a quad core machine, this doesn't sound like a big deal. But the potential to do super-computer scale algorithm work with no race conditions or corrupt values is ... appealing :)
Apr
26
comment How does immutability remove the need for locks when two threads are trying to update the shared state?
"If you have two threads trying to read and update" -- what you just describe is not immutable!!
Apr
26
answered How does immutability remove the need for locks when two threads are trying to update the shared state?
Mar
29
comment Calling a constructor from a parent class in a derived class
@K.Nes, it depends on the language, but in Java, the key is that the compiler keeps a list of all types that are in scope for the current file. If both classes are part of the same package and the same project, then they are already in the same scope. It doesn't matter whether you use the class or inherit from it--the compiler does the same thing to find out what class you are referring to.
Mar
29
awarded  Nice Answer
Mar
28
answered Calling a constructor from a parent class in a derived class
Mar
28
reviewed Approve Calling a constructor from a parent class in a derived class
Mar
7
comment Great Programmer Productivity - Accounting for 10,000 fold difference?
Wow. Talk about missing the point. Any measure of programmer productivity that starts with "typing speed" as an anchor point is bound to get an asinine answer.
Feb
18
awarded  Nice Answer
Oct
11
awarded  Yearling
Sep
17
awarded  Nice Answer
Apr
24
comment Is this a good game plan to become a fluent Java developer?
Seems like a decent enough plan to me, but one thing I would add--have a clear goal in mind. Learning Java is not a goal. Java is a means to an end. If you don't have something you are trying to accomplish, then reading large open source projects will be tedious and you will quickly lose your motivation.
Mar
19
comment Is it possible to reach absolute zero bug state for large scale software?
@HeshanPerera, and how do you consider libraries? Are those part of "your application" or not? Can you name a single practical program you've written that does not use a single library?
Mar
12
comment Can neural network discover rng patterns
@MSalters, you most certainly can predict the state as long as you know the details of the algorithm and have a large number of outcomes to analyze. PRNG's are never judged or analyzed based on a single outcome.
Mar
7
comment Can you “stop” a C program from being reverse engineered?
Or think of it another way--you're computer has to be able to run the code. If it couldn't, then you wouldn't have a program. An if the computer can understand it, then a human can understand it. Not much you can do to avoid it.
Mar
7
comment Can you “stop” a C program from being reverse engineered?
Most security is involved with encrypting data, not programs. The reason is because a fundamental tenant of security is that your encryption should be secure even when the algorithm and encrypted data is provided to the attacker. When looking at it from that paradigm, you can see why not a lot of people talk about encrypting the actual code. That's usually considered "security by obscurity," and it not advised.