Reputation
361
Top tag
Next privilege 500 Rep.
Access review queues
Badges
3 12
Newest
 Pundit
Impact
~72k people reached

  • 0 posts edited
  • 3 helpful flags
  • 110 votes cast
Dec
22
comment Correct alignment when outcommenting code
I'd also leave a TODO in this comment to ensure that you come back to this piece of code.
Dec
22
comment Correct alignment when outcommenting code
NetBeans does this by default, I leave it as it is. I don't think there's anything wrong with such indentation.
Dec
11
comment Proper use of classes
@LordZardeck Data. Classes are also a lot about data. If you have some piece of code, where the data for the operation and the operations themselves can be self-contained, then it is a good candidate for a separate class.
Dec
10
comment What's the term for “while(true)” loop with “break” inside?
There's nothing wrong with break in the middle of a loop. If you need to carry out some operation at each start of the cycle, you will have to either duplicate the code or stuff these operations into the condition. Either variant clearly has disadvantages. goto also had valid applications, e.g. emulation of a try...finally block in C.
Nov
23
awarded  Citizen Patrol
Nov
9
comment Is deprecating a real commitment?
Thread.stop() and Thread.suspend() are still alive and kicking though they were deprecated since Java 1.1, if I remember correctly. They are not used anymore since they are inherently unsafe, but they are still present in the API.
Oct
8
answered I don't understand the arguments against operator overloading
Sep
27
comment Why is Java considered more portable than other languages like C++?
Portability is not a myth. Perfect portability is.
Aug
20
comment Switch from C# to Java, which “gotchas” I should care?
Now you can switch on String in Java SE 7.
Aug
18
awarded  Editor
Aug
18
revised Should UTF-16 be considered harmful?
Expanded and clarified the answer
Aug
18
awarded  Teacher
Aug
18
awarded  Nice Answer
Aug
18
awarded  Commentator
Aug
18
comment Should UTF-16 be considered harmful?
@niXar If some software is ignoring surrogate pairs, then it isn't using UTF-16 and therefore is non-Unicode. You wouldn't call a program which works only with ASCII as supporting UTF-8, right? I think you misunderstood my point a bit, maybe I should clarify this in the answer. I say that there's nothing wrong with the UTF-16, but there's a lot of legacy software, which was designed for UCS-2, and therefore happens to be mostly compliant with UTF-16. But mostly compliant is not compliant, and this causes problems. I also doubt that if UTF-16 didn't exist at all, it would get fixed sooner.
Aug
16
comment Should UTF-16 be considered harmful?
@tchrist I never said that Unicode and I18N are the same, though thanks for the info.
Aug
16
comment Should UTF-16 be considered harmful?
@tchrist Do you have a source for your statistics? Though if good programmers a scarce, I think this is good, because we become more valuable. :) As for the Java APIs, char-based parts may eventually get deprecated, but this is not a guarantee that they won't be used. And they definitely won't be removed for compability reasons.
Aug
13
comment Should UTF-16 be considered harmful?
@tchrist One must be a very ignorant developer to not know that UTF-16 is not fixed length. If you start with Wikipedia, you will read the following at the very top: "It produces a variable-length result of either one or two 16-bit code units per code point". Unicode FAQ says the same: unicode.org/faq//utf_bom.html#utf16-1. I don't know, how UTF-16 can deceive anybody if it is written everywhere that it is variable length. As for the method, it was never designed for UTF-16 and shouldn't be considered Unicode, as simple as that.
Aug
12
comment Should UTF-16 be considered harmful?
Consider it non-Unicode, that would clear the confusion. Historically this method is simply not meant to work reliably in conditions where I18N is required, it is not even locale-aware. Java has different facilities to do that. And I have to remind you that we're off the topic, still talking about subtleties of APIs, not about the UTF-16 itself.
Aug
12
comment Should UTF-16 be considered harmful?
Yes, equalsIgnoreCase() compares chars, not codepoints, and it is stated in the docs. I certainly agree that if this method compared strings usign code points, it would be much simpler. But this isn't a problem of UTF-16 itself, it is a problem of a platform which was originally designed for UCS-2 - exactly what I'm talking about.