|
|
От: | Павел Кузнецов | |
| Дата: | 18.08.05 07:15 | ||
| Оценка: | 17 (2) +1 | ||
> The Apple Developer Connection recently posted what looks like a nice introduction to PyObjC. It's even got QuickTime movies showing how to work with Interface Builder.
> /.../
> Meanwhile, in case you missed it, the Cocoa-Java bindings are deprecated.
> /.../
> I imagine that among other factors they expect to get better, more Mac-like applications via PyObjC than Java.
Unlike Objective-C, Java is widely taught at universities and elsewhere. Many programmers who are learning Cocoa are already experienced with Java. For an experienced Java programmer, using Java with Cocoa might seem like less work than using Objective-C with Cocoa, but learning Objective-C takes little time for most programmers experienced with C and at least one object-oriented language. Because Cocoa is written in Objective-C, Cocoa programmers inevitably encounter Objective-C code even if that encounter is limited to example programs and documentation. Learning Objective-C makes learning Cocoa easier in the long run.
Java has several disadvantages for desktop applications. The cross-platform support and security features that make Java ideal for some applications can get in the way of others. The Java Virtual Machine that provides cross-platform support and security is large and takes a long time to load. When a Java desktop application is first started, the Java Virtual Machine must also be started and initialized. The JVM slows application start-up and consumes resources. For long-running server applications, the startup cost is negligible when averaged over the months or years that the program runs. Desktop applications are started and quit much more often.
Java Cocoa applications pay the price for the JVM, but they don't reap the benefits. When Cocoa is used, the Java application no longer has cross-platform support. Cocoa provides access to features that circumvent Java's security restrictions, which are probably inappropriate for a desktop application anyway.
Java is a popular language. Many libraries of Java objects are available, but it is inconvenient to use Java with most existing libraries that were written in different languages. To maximize the benefits of Java's portability and security, it is necessary to avoid existing non-Java libraries. The fact that it is inconvenient to reuse the millions of lines of existing C code and libraries from Java is a disadvantage.