Welcome, Guest. Please login or register.

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

Description:

0 Members and 1 Guest are viewing this topic.

Offline bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: DiscreetFX Platform Shift
« 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 bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: DiscreetFX Platform Shift
« Reply #1 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 bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: DiscreetFX Platform Shift
« Reply #2 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 bloodline

  • Master Sock Abuser
  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 12113
    • Show all replies
    • http://www.troubled-mind.com
Re: DiscreetFX Platform Shift
« Reply #3 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!