Tools in Eclipse I wish were in Xcode for Objective-C and C++.

1. Override and implement methods.

It’d be nice if there was some way to indicate that the Objective-C and C++ class could automatically generate the proper header modifications in a C++ or Objective-C class declaration, and create an empty method call in the source file, to override a virtual method (in C++) or a message (in Objective C) in it’s parent class.

2. Implement methods.

Similarly it would be nice if there was some way to simply write the C++ or Objective-C header, then have the method or message body automatically generated from the header in the source file.

3. Implement missing abstract methods/protocol methods.

And similarly it would be nice if there was some way for an IDE to determine that you have a class which needs to extend and implement a number of abstract methods or protocols, and automatically insert them into the header or source file.

4. Generate core methods (C++)

In C++, there are a few methods that you need to implement if your class is to participate in the C++ STL as a key, as a sortable object, or as an array object. It’d be nice if there was a mechanism to automatically generate the necessary method definitions and (if possible) even attempt to divine reasonable defaults for these methods in the same way that Eclipse will automatically generate equals() and hashCode().

Java is a very verbose language. But most modern IDEs hide this verbosity by providing a number of tools to automatically generate the “bookkeeping code.” For example, in Eclipse, if you declare a class that implements an interface, Eclipse will offer to automatically fill in the missing method declarations for you. So it’s an easy matter of simply declaring the interface, and letting Eclipse to the tedious cut and paste work.

Most languages are verbose in their own ways. Objective-C and C++ are verbose in that they require you to declare your methods in two places. Synchronizing between those two places is a pain in the neck.

Of course in Java once you build a class file parser it’s trivial to build code to walk the method tree for an interface or an object, and automatically generate template code. What’s missing is a similar interface to an Objective-C or C++ parser to automatically generate the parse trees necessary for automatic code generation. In each of the cases above, it wouldn’t even require a full parse tree–just enough of the parse tree to understand the C++ or Objective-C class declaration objects. (Meaning you would only need to parse the class or @interface declarations.)

I can daydream, can’t I?

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s