|Aug 7, 2007, 12:33 PM||#3|
Objective C's Foundation Framework has classes that do the same work with STL's classes.
For example, look at the C++ - ObjC equivalents:
strings -> NSString
Vectors ->NSArray and NSMutableArray
Maps -> NSDictionary
Now, queues, stacks, etc are derivatives of vector, and in ObjC will not have a significant performance advantage of being developed, since NSArray already stores elements in a dynamic manner, using pointers. And it accepts any derivative of NSObject. There are some fundamental differences, though, for example in an NSArray in location 1 you can put an NSString, but in location 2, you can put an NSDictionary.
If you want to use the STL, you can use C++ within ObjC. But let me give you some advice. Use C++ with ObjC only if you have to. Even if you want to port a program from C++ to ObjC, things can be really messy and you could end up writing spaghetti code if you don't know what you're doing. ObjC more than matches the capabilities of C++. Use C++ only for accessing low-level mechanics of an application.
|Aug 7, 2007, 02:16 PM||#4|
FYI, Soulstorm, adts (or ADTs) are "Abstract Data Types" which you've correctly guessed the meaning of.
Objective-C doesn't have templates (I don't have direct knowledge of what's on tap for Objective-C 2.0, but I don't believe any kind of generics is being added).
Objective-C/Cocoa uses a single-root style of object oriented framework. Collection classes, therefore, contain pointers to objects. Cocoa has various collection classes and gobs of other useful objects built in.
It's not quite as efficient as templated container classes can be, and it's not as type-safe. On the other hand, Cocoa is a really nice environment to develop in.
Anyway, Objective-C really takes a more dynamic, run-timey approach to objects than C++, which is counter to the static, compile time nature of templates. To get the full benefit of templates in Objective-C you'd have to lose the dynamic nature of objects used with them. And If you keep the full dynamic nature of Objective-C objects, you'd have to lose most of the benefits of templates.
As someone who came from a hard-core C++ background to Objective-C, Cocoa/Objective-C has really won me over. As a developer I think it gives you a lot more than you lose. I think a lot of it has to do with how nice the Cocoa framework is, really.
|Aug 7, 2007, 03:06 PM||#5|
To all that, I want to add that C++ will never be replaced by ObjC and vise versa.
C++ is for closed world situations (like designing the engine compartment of a car) and ObjC is for open world situations (like designing the interior of the car and its behavior on the road). And, there are some features of OS X that you can't touch without using C++, like some Core Foundation features. I know, those features are also accessible using C, but who uses C when he knows how to use C++?
However, ObjC is really the best choice for OS X development. The ease, power and flexibility that Cocoa provides are unmatched.
|Aug 8, 2007, 05:43 PM||#6|
on that note then what would be the best book to purchase to teach me the best ways to use the cocoa framework. Im very confident using c++ and obj-c (i read though a rather lengthy tutorial on it already and its obviously very similar to c++) so i'd like a book centered on just the tools and frameworks osx provides to build applications.
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|I Need Help Learning Objective-c!!||Woodshark69||Mac Programming||11||Dec 14, 2012 08:21 AM|
|Objective C Accessors||ag2web||Mac Programming||9||Nov 18, 2012 03:53 PM|
|Problems with Objective-C++?||frank100||Mac Programming||5||Aug 8, 2012 05:49 PM|
|Testing objective-c||Evre||iPhone/iPad Programming||21||Jul 12, 2012 08:22 AM|
|Objective C Syntax||nashyo||iPhone/iPad Programming||6||Jul 4, 2012 12:56 PM|
All times are GMT -5. The time now is 08:19 PM.