Welcome, Guest. Please login or register.

Author Topic: Native Objective-C compiler available  (Read 3958 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline Cymric

  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 1031
    • Show all replies
Re: Native Objective-C compiler available
« on: November 28, 2003, 01:28:16 AM »
Quote
Karlos wrote:
C++ Rocks. It is the Uber systen level programming language, offering all things to all people. Most of the complaints I hear are down to the use of bad or outdated implementations or from people stuck into a totally entrenched way of thinking when it comes to programming paragdims (tosa ksereis tosa les ;-))

Ooooo... Bold statement, there. While I agree to a certain extent with you, and also realise that you wrote the text to promote rather than criticise C++, I cannot resist adding a few 'ifs and buts' for the sake of objectivism. (Is that a proper word?)

Quote
Don't care for OOP? Well, C++ compiles all good C clean code. You can make incremental improvements to old C code without totally changing it to OOP, take advantage of stricter type checking, better dynamic allocation etc. etc.

This is just 'syntactic candy' which most good C-compilers already offer as an extension to standard ANSI-C. Useful, but on the other hand your programs will not compile using a regular C compiler anymore since the features they rely on are different in C and C++. Bottom line: If your program is in C, don't use a C++-compiler to compile it.

Quote
Love OOP? C++ offers the most flexible inheritance methods, far more potent than Java's miserable excuse for inheritance. You can use true multiple inheritance, you can ensure a given class is only inherited once in a heirarchy etc.

Only java programmers and heavily inbred people see singular inheritance as good genetics.

C++'s object model is probably so succesful because it is so weak and allows the programmer to do everything. It's probably like C being not much more than assembly with a readable, if somewhat cryptic syntax. The discussion regarding single and multiple inheritance has passed beyond the qualification 'Holy War'. My opinion? Stick to single inheritance for as long as you can. Why? Simpler inheritance, cleaner OO model, and less chance of you shooting yourself in the foot as the amount of classes and objects begins to grow. In defense of multiple inheritance, I will say that I think the language should support it. Java's way, however elegant, requires the programmer to duplicate code unnecessarily, which is not a Good Thing.

Quote
Want to use operator syntax in your class definitions? Not a problem. Try that in proper java...

Operator syntax is a nightmare if you didn't write the code you're supposed to be extending/maintaining/whatever. It's a feature which I think was added 'because we can': in most cases it is completely equivalent to using a normal, standard, human-readable function name. Sort-of-like C's ?: operator. To add insult to injury, most overloadable operators do not make intuitive sense with custom objects. Obfuscation at its worst.

Quote
Dont like inheritance as a primary means of extending properties? Bugger it, you can do compositional structuring too if thats what you prefer. Its easy to do runtime class composition using composition patterns.

Eh?? Compositional structuring? What's that?

Quote
Love dynamic type checking? Thats what RTTI is for.

Indeed it is. But it isn't limited to C++. Any language with reflective capabilities can do this.

Quote
Like garbage collection? Smart pointer libraries exist that can delete objects no longer referenced for people too scared to look after resources themselves.

Don't like automated garbage collection? Me neither as a rule (handy sometimes though) . Real wo/men of genius write proper virtual destructors and delete what the dont need when it is time to do so.

Erm... Real wo/men probably do not need to work with other people's libraries as they write their own all the time, right? There are times when it is next to impossible to do manual memory management in an OO environment without causing memory leaks or major performance loss. In simple applications, DIY is probably more efficient, true. In big programs, use GC. It'll save hair and money. (Since you don't have to buy aspirin :-).) Speaking of GC, the technique has evolved over time. Collectors are now quite efficient; there really is no need to shy away from a proper GC implementation. Even for a tiny little program.

Quote
Too lazy to write classes for different implementations of a concept? Use templates and let the compiler create the various class dependent implementations of a template for you.

Don't like the templates generated for particular classes? Write specializations for those.

Yep, nice feature. Until you encounter type promotion rules to figure out what instance of your template is called. Which is not fun, since noone can remember C++'s type promotion rules. Many implementations of templates are buggy and not very efficient too, so I'm not really sure whether templates are a Good Thing in practice.

Quote
Theres countless other things I can't be bothered to mention. C++ gives C runtime efficiency (for well written code) and gives the best OOP flexibility of any language.

While I have little experience with coding in C++, I don't think that last statement is correct.  Unless you mean 'flexibility' by allowing every strict OO rule to be bypassed and excepted. Take this link, for example. You may find it interesting to see where exactly C++ is doing things which are strange and odd to say the least. (And that the little-known Eiffel is better at handling OO than is C++.)

 Of course I pretended to be the devil's advocate. There's plenty of examples where C++ delivers solid performance through elegant code. However, there is also plenty of opportunity to give in to 'The Dark Side of the Force', and you can legitimately wonder whether that is the language's or the programmer's fault. In the end, I feel that if you know about and accept the pitfalls, you can easily avoid them, and make sure you emerge relatively unscathed in case you have to walk into one.

Some people say that cats are sneaky, evil and cruel. True, and they have many other fine qualities as well.