can objective-c do this thing that Java can

can objective-c do this thing that Java can

Post by J » Wed, 13 Aug 2003 08:44:48



 In Java, I have have an Abstract Class and a single concreate class.  I can
create another class that is a subclass of the abstract class.  The
application can load my new subclass at runtime by reading a properties or
config file.  This allows to create a simple plugin api for an application.

Can objective-c do this with the same ease?  If I create the application,
could someone else sub class the abstract class, and place somefile in a
path.  Then change the application config file and the application would load
the file that would contain the new class.  

Thanks for all the help.  I just got a new Powerbook Mac, and I want to
create a new application that will be completely component based.  I know I
can use Java to create a cocoa app, just I'm wanting to try out objective-c.

J

 
 
 

can objective-c do this thing that Java can

Post by Paul Mitch » Wed, 13 Aug 2003 10:18:10



>  In Java, I have have an Abstract Class and a single concreate class.  I
> can create another class that is a subclass of the abstract class.  The
> application can load my new subclass at runtime by reading a properties or
> config file.  This allows to create a simple plugin api for an
> application.

> Can objective-c do this with the same ease?  If I create the application,
> could someone else sub class the abstract class, and place somefile in a
> path.  Then change the application config file and the application would
> load the file that would contain the new class.

Cocoa lets you do this pretty easily, with nib files and NSBundle. In
fact, if you've ever designed and instantiated a new class within
Interface Builder, you've already done the thing you're asking about.

More detailed info:
<http://makeashorterlink.com/?E39B26F85>
<http://makeashorterlink.com/?H3DB23F85>

HTH.

 
 
 

can objective-c do this thing that Java can

Post by John C. Randolp » Wed, 13 Aug 2003 10:38:04



>  In Java, I have have an Abstract Class and a single concreate class.  I can
> create another class that is a subclass of the abstract class.  The
> application can load my new subclass at runtime by reading a properties or
> config file.  This allows to create a simple plugin api for an application.

> Can objective-c do this with the same ease?

Yes.

See the docs on the NSBundle class.

-jcr

 
 
 

can objective-c do this thing that Java can

Post by jp » Wed, 13 Aug 2003 20:13:37



> In Java, I have have an Abstract Class and a single concreate class.  I can
> create another class that is a subclass of the abstract class.  The
> application can load my new subclass at runtime by reading a properties or
> config file.  This allows to create a simple plugin api for an application.

> Can objective-c do this with the same ease?  If I create the application,
> could someone else sub class the abstract class, and place somefile in a
> path.  Then change the application config file and the application would load
> the file that would contain the new class.  

Depending on the amount of work done by your abstract class, it may
make more sense just having a class adhering to a protocol (interface)
instead of a full subclass.

Quote:> Thanks for all the help.  I just got a new Powerbook Mac, and I want to
> create a new application that will be completely component based.  I know I
> can use Java to create a cocoa app, just I'm wanting to try out objective-c.

One of the nice things in Objective-C is that you can actually
instantiate "Abstract" classes and unittest them. Objective-C class
methods are also superior to java "static" methods, cos you have
access to self, so you can have class methods in protocols.

And then there are the more ah... controversial additions, which are
constanly under discussion here, but you might have seen that
yourself.

 
 
 

1. Doing the Objective-C thing in Java?

G'day,

Just thinking about Apple's plan's to Java-tize OpenStep (by adding a Java
API).  Will this give Java access to the full power of OpenStep.  Or more
simply, can Java do all the things Objective-C can do, just as simply.

I thought Java was more like C++ doing a lot of strong compile-time type
checking, whereas Objective-C could be more like Smalltalk doing more run-
time type-checking.

However, I heard rumours that the latest release of Java was more dynamic,
and more like Smalltalk.  In the long run, for example, would this allow all
things done with Objective-C and the Interface Builder to be done in Java?

Should I learn more Objective-C or just Java?

What's the story?

Thanks in advance,
Ashley Aitken.


2. Jobsbridge - Data Warehouse Jobs Update 16th Sep

3. Canned API for SLIP/PPP dialup scripting, Modem Config., etc?

4. Uninstalled program not uninstalled??

5. Canned Data Plotting Routines

6. Multisession CD

7. Trespasser (was Re: Duke4ever canned?)

8. Philips CDD 2600

9. Games that were canned or banned?

10. Java vs. Objective-C (was: Java)

11. Java Origins in Objective-C and Smalltalk - by one of its authors

12. US - GA - OO developers needed: WebObjects, NextStep, Objective-C, EOF, Java, Web, Smalltalk, C++

13. Objective-C/Java