729 reputation
610
bio website
location
age
visits member for 3 years, 2 months
seen 12 hours ago

13h
comment Can we replace XML with JSON entirely?
@MattR: Right, translating attributes into JSON makes it look bad. However, I'd say that the very existence of attributes is bad. Imagine you need some details on wheels. So you get <car><wheels><wheel size=big/><wheel size=big/><wheel size=small/></wheels></car> which looks terrible itself and you have to support the now obsolete attribute wheels. And a possible inconsistency when both the attribute and details are present.
14h
comment Can we replace XML with JSON entirely?
@MartinWickman: I don't understand your JSON... and I don't see how to find out that "fine" should be in the middle. What about {"p": ["A ", {"b": "fine"}, " mess we're in!"]}?
14h
comment Why must directories be empty before being deleted?
The last paragraph is rather false. Windows asks things like "blah.exe is an application, are you sure?", "blah is whatever, are you sure?" again and again and you need something like TeraCopy to get rid of it.
Apr
4
comment When do rounding problems become a real problem? Is the least significant digit being one off really a big deal?
I see, this is sort of home made 64-bit mantissa extended. I actually agree that sometimes double doesn't suffice and that often using a more expensive type is the easiest and sometimes the only way. It's just that often double with some more thinking do the job.
Apr
4
comment When do rounding problems become a real problem? Is the least significant digit being one off really a big deal?
Pair of ints? Are you using rational numbers? How do you ensure they don't overflow? This happens pretty fast when adding a couple of fractions.
Apr
4
comment When do rounding problems become a real problem? Is the least significant digit being one off really a big deal?
In this case you can fight the round-off error by rounding twice, first to three decimal places, then to two. For this computation you need an exact representation but all previous results can be computed and stored as doubles. This saves quite some memory and time.
Feb
19
answered Indirection: Readability vs Performance
Feb
19
awarded  Citizen Patrol
Feb
15
comment Is java.util.prefs.Preferences appropriate for accessing changes in state that need to be immediately accessed during runtime?
1. "passing this object to many different constructors" - use Dependency Injection. 2. I would not use Preferences (or any other an existing class) for something like this. Use your own, even if it only delegates to Preferences. This gives you the flexibility you may need one day (e.g., your data grows too big for Preferences) and also allows you to use a much better suited interface (e.g., getWhateverObjectYouWorkWith and getAnotherOne instead of getSomePredefinedThing).
Feb
7
comment Communicate to a junior developer about bad style
@AaronHall: I'd strongly suggest to use this "craziness", especially if it can not only check but also fix the formatting. This can save a few minutes every time anything about the style is unclear. And this holds for each new programmer to come.
Jan
25
comment How should I pronounce the :: and -> in PHP?
@FrustratedWithFormsDesigner: That sounds much better in languages using "double dot" as the name for "colon" (e.g. German "Doppelpunkt").
Jan
23
awarded  Yearling
Jan
18
comment What is the main difference between Scripting Languages and Programming Languages?
@Ted: IMHO, there's no such thing like "compiled" language - it's all matter of implementation. IIRC there's a C interpreter, what does it mean? That said, I don't like the other definitions either.
Jan
14
comment Intentional misspellings to avoid reserved words
IMHO it's not better, you could call it 'classToBeAccessed` or whatever, but any more descriptive name just shows the obvious. I like long names only if they provide useful information.
Jan
14
comment Intentional misspellings to avoid reserved words
@KonradMorawski: But all object you work with are instances, so classInstance is pretty redundant. Moreover, I could imagine something like class klass; Object classInstance = klass.newInstance;.
Nov
17
awarded  Pundit
Nov
12
awarded  Notable Question
Nov
12
comment In Java, should I use “final” for parameters and locals even when I don't have to?
@Steve Kuo: It just allows me to quickly find all variables. no big gain, but together with preventing accidental assignments it's worth the 6 chars. I'd be much more happy if there was something like var for marking non-final variables. YMMV.
Nov
1
comment Help with design structure choice: Using classes or library of functions
Classes with a single function are no problem (you can nest them in a single file, at least in Java). Using classes gives you more flexibility (imagine the user will define a macro: with classes you simply create a list like (new EdgeDetection(), new SimpleSharpening(4), new Rotation(90)). Classes give you more flexibility (which you mightn't need).
Oct
17
comment Why did memory-managed languages like Java, Javascript, and C# retain the `new` keyword?
+1 for the broken switch (in the hope you repair it :D).