934 reputation
713
bio website google.com/+DanielPryden
location Silicon Valley
age 31
visits member for 4 years, 5 months
seen yesterday

I started tinkering with computers at the age of 6. These days, I'm a senior software engineer at Google, currently working on Java application server infrastructure.

Besides being fluent in English and American Sign Language, I know too many programming languages to count. Lately I've primarily been using Java, plus some odds and ends of Python, C++, and JavaScript. I enjoy C#, even though nowadays I don't get many chances to use it. I'm also a big fan of Haskell and Scala, although I haven't had a chance to use either of them in a large-scale project yet.

In my spare time, I play guitar and read voraciously, including science fiction and books on computing. I'm also a volunteer minister for the deaf, teaching Bible studies in American Sign Language.

Standard disclaimer: my opinions are my own, and not necessarily those of my employer.


Mar
27
comment What causes floating point rounding errors?
@robert: The point I was trying to make was that the OP's premise for this question is not necessarily valid. Floating point math doesn't introduce more error than fixed point -- actually it can introduce less error (especially relative to bits used). There are good reasons to use fixed point or decimal floating point, but "not understanding how binary floating point behaves" isn't a good reason IMO. And BTW, no, .NET's decimal isn't like BCD at all -- it has a mantissa and exponent, just in base 10. BCD is a whole other kettle of fish. :-)
Mar
27
comment What causes floating point rounding errors?
You can do floating point numbers in base 10 -- that's how .NET's decimal type works. Fixed point, on the other hand, is different. As long as your range is limited, fixed point is a fine answer. But the restrictive range makes fixed point unsuitable for many mathematical applications, and implementations of fixed point numbers are often not well optimized in hardware as a result.
Mar
27
comment What causes floating point rounding errors?
@robert: That's not exactly what I was referring to. The "error" most people encounter with floating point isn't anything to do with floating point per se, it's the base. IEEE-754 floats and doubles use an exponent in base 2, which means that fractional numbers round off to negative powers of two (1/2, 1/16, 1/1024, etc.) rather than negative powers of 10 (1/10, 1/1000, etc.) This leads to unintuitive results like 0.1 rounding to 0.1000001 and similar issues.
Mar
18
comment When is it a good idea to force garbage collection?
@JimmyHoffa: you say "everything that Main() references ... will be rooted until your Main() returns at the end of your process." That's not necessarily true. An object can become eligible for collection during execution of a method on that very object.
Mar
18
comment When is it a good idea to force garbage collection?
If you haven't yet read Raymond Chen's post Everybody thinks about garbage collection the wrong way (and follow-up articles like When does an object become available for garbage collection?) then you really should.
Feb
10
comment Are there any easy-to-follow/reliable methods for simplifying code?
@AgiHammerthief: Some people think that design patterns are things you should do, as if they were a checklist of some kind. Not so. Design patterns are a language you use to communicate to other programmers the ideas you're using to solve your problems. That is, when someone tells me they're using a Factory, or a Builder, or whatever, that's just a way to communicate. Patterns don't themselves make code good or bad -- the code can be that all by itself.
Oct
21
answered Why are floating point numbers used often in Science/Engineering?
Oct
15
awarded  Yearling
Jul
2
comment Why is the finalize method included in Java?
@rwong: Indeed. There are very few environments where (a) native leaks are a serious problem, (b) there is insufficient redundancy to tolerate JVM restarts, (c) there is no practical way to structure or audit the codebase to ensure that close() methods or similar are actually called, and (d) a sometime-later best-effort cleanup process is actually sufficient. In a case where all of those are true, then finalizers are perhaps a good solution. However, I think the advice to Read Effective Java first is sound: unless you fully understand finalizers, you're probably not competent to use them.
Jun
26
comment Why is the finalize method included in Java?
Even in the native peer case, I think PhantomReference is a better solution. Finalizers are a wart left over from the early days of Java, and like Object.clone() and raw types, are a part of the language best forgotten.
Jun
26
comment Why is the finalize method included in Java?
I guess I didn't spell it out well in my answer, but (IMO) the answer to "why does it exist?" is "it shouldn't". For those rare cases where you really need a finalization operation, you probably want to build it yourself with PhantomReference and ReferenceQueue instead.
Jun
26
answered Why is the finalize method included in Java?
Apr
29
awarded  Nice Answer
Oct
15
awarded  Yearling
Sep
13
awarded  Nice Answer
Aug
18
comment Java Heap Allocation Faster than C++
You may find my answer to a similar question over on SO useful/relevant.
Aug
18
answered Is “pass by value” synonymous with “functional programming”
Aug
14
awarded  Nice Answer
Aug
14
revised Why are reference-counting smart pointers so popular?
added link
Aug
14
answered Why are reference-counting smart pointers so popular?