Re: Advice on converting this C++ code to Objective-C
Re: Advice on converting this C++ code to Objective-C
- Subject: Re: Advice on converting this C++ code to Objective-C
- From: Chris Cleeland <email@hidden>
- Date: Thu, 03 Nov 2011 08:14:05 -0500
I would counsel that direct translations of anything rarely make
sense. Despite their shared background, C++ and Objective C are
different languages with distinct idioms. Add the fact that you're
not programming in raw ObjC but rather using Apple's frameworks, and
you have an entire "dialect".
Your best results will be obtained by examining the original code,
understanding the design, and implementing it idiomatically in the
Cocoa "dialect". Some things simply do not translate, and the
decision on the best way to re-cast that must be made in the context
of the application itself.
Whenever I've used ObjC++, the C++ has always been relegated to
abstract data type implementations--precisely what you seem to have
wiith the matrix, vector, etc. As you already note, converting those
to ObjC will make the code more verbose and likely far less efficient
(no need for dynamic dispatch on any of those operations).
It seems that eventually you'll want to ditch those ADT-style types
for native types...or maybe not. If it were me, I would go with an
incremental approach by first writing some unit tests around the
existing class implementations so that I know how they behave, then I
would re-implement the classes internally using the native types
insuring that the unit tests continue working. At some point you can
make a decision as to whether it makes more sense to continue on with
the abstraction or simply go with the native type, and that can only
be made in the context of the rest of the app.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden