944 reputation
714
bio website google.com/+DanielPryden
location Silicon Valley
age 31
visits member for 4 years, 6 months
seen Apr 23 at 19:07

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.
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.
Aug
18
comment Java Heap Allocation Faster than C++
You may find my answer to a similar question over on SO useful/relevant.
Apr
21
comment How common is it for a team to write everything in-house?
@tp1: I categorically disagree. On the contrary, if it is possible to reuse someone else's work, it is nearly always better to not do it yourself. Reusing the research, analysis, development, and debugging efforts of another team means that you can devote more resources to delivering increased value for your project. To argue otherwise is sheer hubris.
Apr
20
comment How common is it for a team to write everything in-house?
@tp1: I work for Google and I can assure you that Google very much does use third-party libraries when they meet our needs. Many times Google has needs that are unique or at a different scale from many other software companies, so for one reason or another Google will often develop things in house. But Google also uses a large number of open-source libraries, and/or open-sources lots of internal libraries, so not everything is in-house. Most of your points no longer apply for open-source software, since by having the source you ensure that you can always debug it and fix it if necessary.
Mar
6
comment Why isn't Java used for modern web application development?
@Basic: Backwards from what? In the year and a half since I first wrote this answer, I've moved on and am currently working at Google, and I can assure you that Java is used very heavily for web application development at Google. Of course, Google's needs are very different from the needs of many other companies, but Java is a different beast entirely when you use the right libraries and frameworks -- just check out some of the things Google has open-sourced (Guava, Guice, GWT, Protocol Buffers, etc.).
Mar
6
comment Why isn't Java used for modern web application development?
@Basic: What is your point? There are lots of broken libraries and frameworks for any language. Yes, there is lots of crufty and out of date documentation -- but that's hardly unusual either. Conversely, there are some fantastic libraries, frameworks, and tools for Java. Are you seriously trying to suggest that there should be one end-to-end framework for every application ever?
Nov
20
comment Why is it called Just In Time?
@kevincline: I agree, in the Java world it isn't very interactive. But that's a problem with the Java implementation, not with the approach of JIT compiling in general. For example, Visual Studio allows you to edit C# code while it's running and it re-JITs on the fly, so it can be done.
Nov
19
comment Why is it called Just In Time?
@kevincline: It is possible to get more real-time feedback, even with Java; most Java debuggers allow you to execute small bits of code while at a breakpoint. But other languages do this much better: F# for example has an interactive REPL implemented with a JIT compiler.
Nov
7
comment Why does Java use UTF-16 for internal string representation?
+1 for linking to the "Should UTF-16 be considered harmful?" question. I recently discovered the UTF-8 Everywhere manifesto and I believe I am now pretty thoroughly convinced. For what it's worth, although Java got it wrong, I'm pretty convinced that Windows did much much worse.
Nov
7
comment Examples of when we'll use interpreted language over compiled language?
For various reasons, there is a correlation, but it isn't a requirement. This has actually been asked over on StackOverflow: Why interpreted langs are mostly ducktyped while compiled have strong typing?
Nov
6
comment Examples of when we'll use interpreted language over compiled language?
-1 because you imply that all interpreted languages are dynamically typed and all compiled languages are statically typed, which is completely untrue.
Oct
9
comment Using “Google Guava” in coding interviews
+1 for asking. As a point of interest, when I interviewed at Google I asked if I could use Guava and my interviewer was OK with it. YMMV of course.