Top.Mail.Ru
January 20th, 2005 - Java developers — LiveJournal
? ?

Java developers

January 20th, 2005
Image

12:23 am - Imagemharmless - To those who know xcode

I'm not sure if it's just my computer or what, but all the IDEs I've used on my PowerBook G4 are extremely slow. With the exception of xcode. I come from Eclipse and I'm very used to the flexibility and I may be asking to much from xcode.

Okay so I want to know a couple of things about xcode:

1. Set a src and bin directory... xcode has all these extra folders that it makes; just makes things hard to find.
2. How do packages work? In Eclipse specify the package and it creates proper folders in src folder...
3. ...
4. ...
5. I think I'm just too confused on how xcode works. I'm overwhelmed by the features. If someone could point me to a tutorial on how to use it. It would be great... as usual the "help" is useless.

Man, just thinking about how much I love Eclipse makes wants me to pull out my PC again. =(
I mean seriously, it should not take 10 seconds to open a .java file!
 

11:39 am - Imageex_juan_gan - "symmetry" of equals method

I think the idea of equals symmetry should be carefully reviewed. From toposophical perspective, there is a kind of weak point there. And here is a funny example:
public class Bug {
    public static void main(String[] args) {
        java.util.HashMap m1 = new HashMap();
        java.util.HashMap m2 = new HashMap();
        m1.put("myKey", "myValue");
        m2.put("myKey", "myValue");
        if (!m1.equals(m2)) {
            System.err.println(m1 + " must be equal to " + m2);
        }
        if (!m1.values().equals(m2.values())) {
            System.err.println(m1 + ".values() must be equal to " + m2 + ".values()");
        }
    }
}


The second equals() fails, and here's the explanation. values() returns an instance of AbstractCollection, not a List and not a Set. It is not a list, because values in a hashmap are not ordered, and it is not a set because they can repeated. As a result, there is no overriding equals(), and the one from Object applies: plain '==' is used.

Josh Bloch writes in http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5038615:
Read more...Collapse )

So, the reason behind this absurdity is the requirement of symmetry.

Now, there is one more revelation: using double dispatch for proper implementation of equals()... unfortunately... it is either too late, or it does not cover the whole issue... or maybe we have to choose another language. Haskell?
Image

08:38 pm - Imagescriptum - Yandex interview multiple choice problem

From here (http://company.yandex.ru/inside/job/java.xml) - it's a mini-web-job-interview for a java developer for a "Russian Yahoo".

I will translate a problem number 2:

Given
interface I { ... }
class A { ... }
abstract class B implements I { }

Create a class C, which inherits the functionality of class A and B
</div>
<input ... >

<input ... >

<input ... >

<input ... >

<input ... >


I think that none of the choices provides a correct answer, only one is close to being correct but not correct in general. Anybody disagrees?
----------------
Update:
Aftera all these discussions, it turns out yandex is not that bad. However, strictly speaking, none of the answers is correct. Only answer 4 will compile, however, it puts C and B into different branches of the inheritance tree so at best C can reproduce functionality of B, but not inherit it.

Image


And, as clever Imagelafy pointed out, B is empty, so technically C does reproduce the null functionality of B. Or the lack thereof. No inheritance though. Nope.
Powered by LiveJournal.com
Image