Welcome, Guest. Please login or register.

Author Topic: OT fork(): bloodline and Karlos erm... discuss Objective-C & C++ :)  (Read 3735 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline nicholasTopic starter

forked from here

Quote from: bloodline;589505
I'm not including all the people I know who have iPhones an or iPads and a PC... @karlos give Objective-C a chance... If this trend continues it will likely be one of the dominant programming languages of the future ;)

:lol:

I just can't get my head around Obj-C no matter how many chances I give it.

It requires me to quite literally "think different" and it seems I'm too old and set in my ways to be arsed!
« Last Edit: November 05, 2010, 03:03:43 PM by Karlos »
“Een rezhim-i eshghalgar-i Quds bayad az sahneh-i ruzgar mahv shaved.” - Imam Ayatollah Sayyed  Ruhollah Khomeini
 

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show only replies by bloodline
    • http://www.troubled-mind.com
Re: DiscreetFX Platform Shift
« Reply #1 on: November 05, 2010, 12:20:52 PM »
Quote from: nicholas;589548
:lol:

I just can't get my head around Obj-C no matter how many chances I give it.

It requires me to quite literally "think different" and it seems I'm too old and set in my ways to be arsed!



I wish I had video taped my first two months with Obj-C... I was horrified by it, disgusted even... It made so little sense that I hated it... The change happened when I twigged what the designers were trying to do... I was looking at it from a C++ point of view, expecting the language to be OOP... But it's not like that, Obj-C sits above the language, it's more a feature of the OS than the language...

The basic components of your program are regular C, but the components fit together in an object oriented way... This gives you a lot of very cool runtime features that don't exist in C++...   I hope that makes sense.

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: DiscreetFX Platform Shift
« Reply #2 on: November 05, 2010, 12:23:11 PM »
@Transition

Best of luck!

Quote from: bloodline;589505
@karlos give Objective-C a chance... If this trend continues it will likely be one of the dominant programming languages of the future ;)

I sincerely hope not. It's the nastiest bastardisation of two perfectly reasonable but utterly unrelated syntaxes I've ever seen. It truly deserved to be drowned a birth, but unfortunately we weren't so lucky. The day that particular brand of syntactical lunacy becomes a "dominant programming language" is the day I resurrect my career as a chemist.

Quote
But it's not like that, Obj-C sits above the language, it's more a feature of the OS than the language...

It is like that. That mush that disgusted you so much is the language. The fact that you've had to mentally separate the concept from the implementation is a direct consequence of the fact that it has such a failed union of unrelated syntaxes. What you are basically saying is, it's like this "ultra cool OS feature that sits above the language and lets you do cool stuff". Well, sure, it might be like that once you've conditioned yourself into viewing it that way, but it most assuredly isn't that. That would be a custom pre-processor for C provided by the OS. However, Objective-C is not a C preprocessor, it is a language and one that pre-dates apple's interest in it. The fact that you have to view it as a separate entity floating above C "to get it" is precisely what's wrong with it syntactically.

Quote
This gives you a lot of very cool runtime features that don't exist in C++... I hope that makes sense

You can pretty much do it all with C++ too if you like. There are perfectly well established extensions and libraries for reflection, AOP etc. And despite not being core language features, they are still nicer to look at than even the cleanest Objective C.
« Last Edit: November 05, 2010, 12:36:12 PM by Karlos »
int p; // A
 

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show only replies by bloodline
    • http://www.troubled-mind.com
Re: DiscreetFX Platform Shift
« Reply #3 on: November 05, 2010, 01:10:39 PM »
Quote from: Karlos;589554
@Transition

I sincerely hope not. It's the nastiest bastardisation of two perfectly reasonable but utterly unrelated syntaxes I've ever seen. It truly deserved to be drowned a birth, but unfortunately we weren't so lucky. The day that particular brand of syntactical lunacy becomes a "dominant programming language" is the day I resurrect my career as a chemist.

Computer science's loss will be chemisty's gain ;)
Quote

It is like that. That mush that disgusted you so much is the language. The fact that you've had to mentally separate the concept from the implementation is a direct consequence of the fact that it has such a failed union of unrelated syntaxes. What you are basically saying is, it's like this "ultra cool OS feature that sits above the language and lets you do cool stuff". Well, sure, it might be like that once you've conditioned yourself into viewing it that way, but it most assuredly isn't that. That would be a custom pre-processor for C provided by the OS. However, Objective-C is not a C preprocessor, it is a language and one that pre-dates apple's interest in it. The fact that you have to view it as a separate entity floating above C "to get it" is precisely what's wrong with it syntactically.

I must admit it wasn't until I discovered that Obj-C was originally a preprocessor for C that I finally got it.

I know you don't like it from the point of view of a programming language, and I agree, that C++ is much better suited for low level OOP... But Obj-C with he cocoa framework is soooooo nice I don't want to leave it :)

Quote

You can pretty much do it all with C++ too if you like. There are perfectly well established extensions and libraries for reflection, AOP etc. And despite not being core language features, they are still nicer to look at than even the cleanest Objective C.


Actually there is one thing I'm not keen on with C++ (though I also think this is a strength for low level work), is the lack of a base class that all objects inherit from... Shrug... Don't hate Obj-C just because it's different ;)

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: DiscreetFX Platform Shift
« Reply #4 on: November 05, 2010, 01:36:18 PM »
Quote
Actually there is one thing I'm not keen on with C++ (though I also think this is a strength for low level work), is the lack of a base class that all objects inherit from... Shrug...

This is neither a feature nor an oversight, this is C++ as a as-compatible-as-possible superset of C. Remember, C structures and C++ classes are actually entirely the same entity. The only difference between the two is the default access level for members. In classes, they are private unless specified otherwise, in structures, they are public, unless specified otherwise. You wouldn't want your C structures suddenly getting a whole load of unrelated cruft injecting into them, especially when you are likely to be using them directly from OS libraries etc. that were actually written in C and have no idea about this new concept you just shoehorned into the language.

Extending all classes from some abstract "Object" type is a common paradigm in OO languages but don't be fooled into thinking by virtue of the services it provides that it's actually necessary. It isn't. Giving all objects a common interface is handy for languages where gernerics are not a language feature and you want to create general purpose container types and so your base Object class provides useful metadata that the container implementation can use. Smalltalk is an ideal example of this way of doing things and it had been considered a gold standard. However, for languages that support generics, you simply don't need it. I find this much better since a type shouldn't really have to be interfered with (which forcing it to be of some generic base class type does) in order to be put into a generic container. Not doing this leads to absurdities such as having a class Integer which is an object wrapper for the actual elemental type just so you can use it within an existing container scheme. Proper generics don't require this manhandling and invariably give rise to much faster (if sometimes larger) code too. Most operations on std::vector will be entirely inlined. Contrast this with the case when you have an abstract container of (possibly unrelated) abstract types (but all of abstract type Object), everything is going to be as slow as it's possible to be. Even Java realised this at some point and introduced proper generics.

Quote
I must admit it wasn't until I discovered that Obj-C was originally a preprocessor for C that I finally got it.

So was "C with Classes", which became the earliest version of C++. However, both became truly compiled languages fairly early on in their development. Whereas C++ reused existing C syntax to implement OO in a comparatively intuitive way (such as allowing structs/classes to have member functions that could be defined inline or in a separate translation unit) that C programmers would "get", the objective C guys just lifted their syntax from Smalltalk without giving any thought to how they might seek implement the features in C and extend C as a language. It doesn't matter that the design aims of each language were different, the Objective-C designers could have implemented it's OO extensions with a sensible C-like syntax too. They chose not to.

Quote
Don't hate Obj-C just because it's different

I don't hate it because it's different. I actually liked Smalltalk, it's what got me into OO in the first place. I hate Objective-C because it's just thoroughly awful as a language. I don't deny that it has some desirable features such as dynamically loadable classes etc, but IMHO it takes far more away from you than it gives. And what it does give, you can usually find ways to achieve the same end in other languages.
« Last Edit: November 05, 2010, 01:56:24 PM by Karlos »
int p; // A
 

Offline nicholasTopic starter

Re: DiscreetFX Platform Shift
« Reply #5 on: November 05, 2010, 02:11:37 PM »
Quote from: Karlos;589554
The day that particular brand of syntactical lunacy becomes a "dominant programming language" is the day I resurrect my career as a chemist.




I'm sure the old dears coming in for their incontinence pads and Viagra prescriptions will love to chit chat with you about the beauty of hand optimized 68k assembly. ;)
“Een rezhim-i eshghalgar-i Quds bayad az sahneh-i ruzgar mahv shaved.” - Imam Ayatollah Sayyed  Ruhollah Khomeini
 

Offline Franko

  • Hero Member
  • *****
  • Join Date: Jun 2010
  • Posts: 5707
    • Show only replies by Franko
Re: DiscreetFX Platform Shift
« Reply #6 on: November 05, 2010, 02:12:53 PM »
You should all stick with 68k Assembler, neater, smaller, faster code... :)

Ok... not very portable I'll admit, but I like it... :)
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: DiscreetFX Platform Shift
« Reply #7 on: November 05, 2010, 02:18:04 PM »
Quote from: nicholas;589570
I'm sure the old dears coming in for their incontinence pads and Viagra prescriptions will love to chit chat with you about the beauty of hand optimized 68k assembly. ;)

I said chemist, not pharmacist :lol:

Wait, old dears coming in for viagra? :nervous:

Quote
You should all stick with 68k Assembler, neater, smaller, faster code...

One of my perverse habits is using inlined assembler in ANSI C++ mode on the amiga. You haven't lived until you've written a set of inline template functions inside a namespace that emit optimal bitwise rotate operations based on whether or not the size of the shift is known to be a compile time constant or not :lol:
Another amusing use of assembler was to (ab)use the CPU exception processing mechanism such that C++ exceptions are thrown for things like divide by zero :) Much to my surprise, it actually worked rather well.
« Last Edit: November 05, 2010, 02:22:56 PM by Karlos »
int p; // A
 

Offline nicholasTopic starter

Re: DiscreetFX Platform Shift
« Reply #8 on: November 05, 2010, 02:20:58 PM »
Quote from: Karlos;589573
I said chemist, not pharmacist :lol:

Wait, old dears coming in for viagra? :nervous:


Apparently it works for the ladies too. :lol:
“Een rezhim-i eshghalgar-i Quds bayad az sahneh-i ruzgar mahv shaved.” - Imam Ayatollah Sayyed  Ruhollah Khomeini
 

Offline Franko

  • Hero Member
  • *****
  • Join Date: Jun 2010
  • Posts: 5707
    • Show only replies by Franko
Re: DiscreetFX Platform Shift
« Reply #9 on: November 05, 2010, 02:23:37 PM »
Quote from: Karlos;589566
I hate Objective-C because it's just thoroughly awful as a language.


Oooh, Hates such a strong word...

But glad a mods said it... :)

Cos now I can say I HATE all forms of   'C'... 68k Forever... :roflmao:
 

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: DiscreetFX Platform Shift
« Reply #10 on: November 05, 2010, 02:27:44 PM »
Quote from: Franko;589576
Oooh, Hates such a strong word...

Not sure it is strong enough in this context :)

Quote
But glad a mods said it... :)

Cos now I can say I HATE all forms of   'C'... 68k Forever... :roflmao:

But you're not a mod :P What's the point in being a mod if we can't say and do stuff proscribed to you unruly rabble :lol: jk...

68K is just about the nicest assembler syntax ever. ARM is pretty nice too.

Anyway, whatever your feelings for it's offshoots, you aren't entitled to hate C itself as there'd be virtually no AmigaOS left for you to write your 68K code on without it ;-)
« Last Edit: November 05, 2010, 02:30:10 PM by Karlos »
int p; // A
 

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show only replies by bloodline
    • http://www.troubled-mind.com
Re: DiscreetFX Platform Shift
« Reply #11 on: November 05, 2010, 02:35:07 PM »
Quote from: Karlos;589573
I said chemist, not pharmacist :lol:



Yeah, I still have to explain that one to people... My degree was CHEMISTRY not pharmacy... :)

Quote



One of my perverse habits is using inlined assembler in ANSI C++ mode on the amiga. You haven't lived until you've written a set of inline template functions inside a namespace that emit optimal bitwise rotate operations based on whether or not the size of the shift is known to be a compile time constant or not :lol:
Another amusing use of assembler was to (ab)use the CPU exception processing mechanism such that C++ exceptions are thrown for things like divide by zero :) Much to my surprise, it actually worked rather well.


I was missing ASM too, that's why I decided to play with microcontrollers... But 99% of MacOS microcontroller Dev tools are C++... so I've ended up doing loads of C++ recently! Hahahah :)

For those interested, ARM assembly is quite nice

@karlos your diatribe shakes my confidence in Obj-C, but I honestly couldn't really imagine doing another large high level project in anything but Obj-C... Then again I couldn't even begin to imagine how bloated and inefficient doing Microcontroller work would be in anything but C++... As my (disgustingly successful developer friend once said), you just pick the right tool for the right job!

Hmmm, as once last shout for Obj-C... I think in numbing I see is as BOOPSI done right... :)

Offline Franko

  • Hero Member
  • *****
  • Join Date: Jun 2010
  • Posts: 5707
    • Show only replies by Franko
Re: DiscreetFX Platform Shift
« Reply #12 on: November 05, 2010, 02:37:12 PM »
Quote from: Karlos;589579
Not sure it is strong enough in this context :)
But you're not a mod :P What's the point in being a mod if we can't say and do stuff proscribed to you unruly rabble :lol: jk...


I never wanted to be a Mod in the first place, (never like them silly green parkas they wore) I'm a RUDE BOY always have been always will be... :p
 

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show only replies by bloodline
    • http://www.troubled-mind.com
Re: DiscreetFX Platform Shift
« Reply #13 on: November 05, 2010, 02:41:13 PM »
Quote from: Karlos;589579
Not sure it is strong enough in this context :)



The problem I have is Karlos's objections are well founded, but I feel he is coming at Obj-C from the wrong angle. Looking at it in isolation, but it doesn't exist in isolation obj-C is part of the whole Cocoa interface, and from that angle it is invaluable and has shaped the system design in ways no other language would have been able to! ;)

Quote


But you're not a mod :P What's the point in being a mod if we can't say and do stuff proscribed to you unruly rabble :lol: jk...

68K is just about the nicest assembler syntax ever. ARM is pretty nice too.


Hahahha! I just said that too, I've been doing some ARM Asm on the mbed platform! Check it out, it's good stuff!

Quote

Anyway, whatever your feelings for it's offshoots, you aren't entitled to hate C itself as there'd be virtually no AmigaOS left for you to write your 68K code on without it ;-)


C is lovely, that's why all modern languages look like C!

Offline Karlos

  • Sockologist
  • Global Moderator
  • Hero Member
  • *****
  • Join Date: Nov 2002
  • Posts: 16867
  • Country: gb
  • Thanked: 4 times
    • Show only replies by Karlos
Re: DiscreetFX Platform Shift
« Reply #14 on: November 05, 2010, 02:47:48 PM »
Quote from: bloodline;589583
Yeah, I still have to explain that one to people... My degree was CHEMISTRY not pharmacy... :)

For God's sake, Jim, I'm a chemist, not a forklift!

Quote
@karlos your diatribe shakes my confidence in Obj-C, but I honestly couldn't really imagine doing another large high level project in anything but Obj-C... Then again I couldn't even begin to imagine how bloated and inefficient doing Microcontroller work would be in anything but C++... As my (disgustingly successful developer friend once said), you just pick the right tool for the right job!

Hmmm, as once last shout for Obj-C... I think in numbing I see is as BOOPSI done right... :)

Don't let me put you off. Programming language preferences are personal things. There's plenty to dislike in any language if you prefer a different one. I like C++ because it basically gives me the tools to write code from very simple procedural C-style stuff right up to full blown OO/generics with meta-programming and all that jazz. Consequently, it pretty much always feels like the right tool for the job for me. Even the simplest stuff you'd normally do in vanilla C I still tend compile in strict C++ mode.

Quote
The problem I have is Karlos's objections are well founded, but I feel he is coming at Obj-C from the wrong angle

If it helps, I disliked it long before apple got their mits on it :D
« Last Edit: November 05, 2010, 02:51:08 PM by Karlos »
int p; // A