Jump to content
30 posts in this topic

Recommended Posts

I wonder why Apple chose Objective-C as Mac OS default programming language.

The syntax is difficult to read, it just seems a mess.

 

#import <Foundation/NSObject.h>

 

@interface Fraction: NSObject {

int numerator;

int denominator;

}

 

-(void) print;

-(void) setNumerator: (int) d;

-(void) setDenominator: (int) d;

-(int) numerator;

-(int) denominator;

@end

 

I wish Apple had selected something more mainstream like C++.

The following C++, I think, is way more ellegant and easier to read.

 

#include <Foundation/NSObject.h>

 

class Fraction : NSObject

{

int numerator;

int denominator;

 

void print();

void setNumerator(int d);

void setDenominator(int d);

}

I would hardly say it is a mess, especially using the examples you showed. (pretty minor differences)

 

I'm sure if it's widespread use preceded C++, people would be saying the opposite.

 

 

I'll admit it took a little bit to get use to, but after using it a while its no big deal.

 

The separation of variable types using () can be helpful. Some C++ code is god awful and poorly documented and this syntax can help to quickly spot elements rather then needing to look at the code in more detail.

 

But to each his own.

I wish Apple had selected something more mainstream like C++.

The following C++, I think, is way more ellegant and easier to read.

 

And exactly what stops you from using it? :/ Just use what you like and suits your needs, criticizing isn't necessary it's just a matter of preferences.

c isnt bad... i had to teach myself it for robotics team (i decided not to join...)

 

 

but uh, c++ is just an extention of c, so really there arnt that many differences..... just minor {censored}.....

 

 

but why does it matter, you can get stuff done in c, and im sure if you wanted to you could program and comple in c++?

C++ can be used as C, with just a few differences.

 

But the main benefit of C++ is constructors, destructors, functions, public private datatypes, and other Object Oriented concepts...........which I dont understand, but still. I guess they are useful

I'm wondering some Parallel port control with Objective C - Cocoa app. with XCode but I can use the same headers that I use with borland TurboC (stdio.h, conio.h, iostream.h and others).

 

Anyone can tell me how I do to control Parallel port with XCode...

 

The commands that I used before was:

 

main(){

printf("Opening Gate 1")

outportb(0x378, 1) /* This will activate the pin 2 - that connected to a circuit, can activate a light */

}

 

and now... what I do...

I think that conio.h in MacOS X doesnt exists, because it are used to CONsole.

 

Thanks in advance.

  • 4 weeks later...
  • 3 weeks later...

The thing with objective-c (cocoa) is you look at the source code of an example and see like 15 lines of code and viola you got a text edit application... and you're like but how does it get all that from that code, where's the "real code", that's my problem with it...

The thing with objective-c (cocoa) is you look at the source code of an example and see like 15 lines of code and viola you got a text edit application... and you're like but how does it get all that from that code, where's the "real code", that's my problem with it...

That's not because of Objective-C, its because of the API it is used with.

You could have the same thing using C++ with Qt, or C with GTK, you name it.

  • 2 weeks later...
Cocoa is Objective-C but Objective-C is not Cocoa, there, Coca-Cola is Caffeine but Caffeine is not Coca-Cola, there that should be clearer... Carbon is C, but C is not Carbon, logically fit now?

Actually Cocoa is not Objective-C.

 

Cocoa is an API not a programming language

Although Cocoa was written in Objective-C, user programs can access the API with languages like Python, Perl, Ruby with the aid of bridging mechanisms such as PyObjC, CamelBones and RubyCocoa, respectively

 

P.S. Coca-Cola has caffeine, not is caffeine. :blink:

It was originally developed in the 80's. Give it a break. :P

 

Two points:

 

(1) Anyone says Obj-C is a simply "awful" programming language does not understand the beauty of its simplicity nor its runtime machine.

 

(2) Apple is making improvements to Obc-C with version 2.0 in Leopard (OS X 10.5).

Here's one

 

Cookie is Chocolate Chip, Chocolate Chip is not Cookie

 

Where do you stand on the word "is", are "is" and "=" equivalent to you?

 

They are similar but depending on how you use "is" they can be miles apart...

 

:) this is fun LOGIC yea...

Where do you stand on the word "is", are "is" and "=" equivalent to you?

 

They are similar but depending on how you use "is" they can be miles apart...

I know where you are going with this, but for the sake of this comparison, (Objective-C & Cocoa), it is a poor description for people new to programming.

 

It makes it sound like the same relationship as: C++ is C, but C is not C++. A superset, while they are actually completely different.

 

Two points:

 

(1) Anyone says Obj-C is a simply "awful" programming language does not understand the beauty of its simplicity nor its runtime machine.

 

(2) Apple is making improvements to Obc-C with version 2.0 in Leopard (OS X 10.5).

True. Learning a new programming language you are always 'tainted' since you're used to something else. Coming from C/C++ it surely looks different but after a while you appreciate it.

 

Can't wait for Xcode 3 and the Objective-C changes. Guess one of the big ones is automatic garbage collection. (Although never a problem in my code. :unsure: )

True. Learning a new programming language you are always 'tainted' since you're used to something else. Coming from C/C++ it surely looks different but after a while you appreciate it.

 

I came to Cocoa from Java, but I have no problems accepting Obj-C, it is very simple. The Cocoa frameworks however take a total different approach to application building than Java.

 

Guess one of the big ones is automatic garbage collection.

 

One of the big plusses of Cocoa, is that once you learn the frameworks, you can build applcations very quickly. Garbage collection and other improvement in Obj-C 2.0 will make it even faster.

×
×
  • Create New...