Home
Saturday, June 24, 2017
1:35:23 PM
Users online: 0   You are here >> Home > Programming

Forums | Programming Forums search
Forum FAQ
   
 Previous Page 1 | 2  
I hate objective C
kikz 
25/3/08 3:11:06 PM
Immortal

Quote by freespace
Popularity does not mean its better. I am sure you can think of many examples.

How is objective-c better? For one it has Real OO implemented using message passing. This means you don't call methods, you send object messages, and if the object can respond, it will, otherwise it won't. This has enormous power because you can call an arbitrary method on an arbitrary object in runtime, allowing for all sorts of cool tricks, like replacing a class in runtime entirely without even access to the source code. Tricks like these are used quite a lot in OS X to implement and extend applications. See FScript.

Because of the above, objective-c has runtime binding, one of the advantage of which is that if the base class changes, it won't break the subclasses. It means if you are writing code against a library, and later that library changes, your code won't break just because you subclassed a library class, and now the class signatures are different.

And then there is proxies and categories, which allows you to extend the superclass without modifying the library the superclass is in.

Objective-c at least has some control over memory in the way of reference counting. It is part of the language. In C++ you need the boost library.

In short, objective-c doesn't suck any more than C++ sucks, and I only wish you won't confuse your own difficulties with dealing with a new language with a language's short comings. I hope to additionally counter your thread's accusation that objective-c sucks. To me, objective-c is the best of the breed of the c-esque OO languages.


Sounds like a boring version of C# :p

-----
Q6600 | 4Gb PC6400 | 2 x 500Gb RAID 0 | 19" Benq FP591 + 24" Samsung 245B + 19" Dell | 8800GTS 640 Mb + 8400GS 256 Mb | Gigabyte GA-P35-DS3P | Antec P182 | Corsair HX-620 | Thermalright 120 Extreme | Vista x64

freespace 
26/3/08 10:47:32 AM
Hero
Titan


Quote by kikz
Quote by freespace
Popularity does not mean its better. I am sure you can think of many examples.

How is objective-c better? For one it has Real OO implemented using message passing. This means you don't call methods, you send object messages, and if the object can respond, it will, otherwise it won't. This has enormous power because you can call an arbitrary method on an arbitrary object in runtime, allowing for all sorts of cool tricks, like replacing a class in runtime entirely without even access to the source code. Tricks like these are used quite a lot in OS X to implement and extend applications. See FScript.

Because of the above, objective-c has runtime binding, one of the advantage of which is that if the base class changes, it won't break the subclasses. It means if you are writing code against a library, and later that library changes, your code won't break just because you subclassed a library class, and now the class signatures are different.

And then there is proxies and categories, which allows you to extend the superclass without modifying the library the superclass is in.

Objective-c at least has some control over memory in the way of reference counting. It is part of the language. In C++ you need the boost library.

In short, objective-c doesn't suck any more than C++ sucks, and I only wish you won't confuse your own difficulties with dealing with a new language with a language's short comings. I hope to additionally counter your thread's accusation that objective-c sucks. To me, objective-c is the best of the breed of the c-esque OO languages.


Sounds like a boring version of C# :p

Shows you don't know obj-c :)

-----
By perseverance the snail reached the ark.

http://www.shuningbian.net - blog
http://anonshare.pictorii.com - share files anonymously
http://dailydiscovery.b3ta.org - learn something new
its f reespace damn it!

zephyr 
26/3/08 11:56:19 AM
Hero
Titan


Quote by dave_blob

In a totally contrived and silly example, say I made a language where every variable had to be parenthised in 7 curly braces. Even though everyone is used to other languages than this one, it would still be fair to say its syntax sucks.



Sorry, lisp already exists, they just chose to use parentheses instead :-p

The problem with any new language which looks sufficiently similar to one you know, but has some glaring differences, is that it's hard to approach it objectively (pardon the pun) because it messes with your existing mental model of the abstraction. I think this is one of the reasons why there is a big push on to introduce dot notation to Obj-C's classes, which would align it with C++ (kinda), Java, C#, ruby, python, etc.

-----
"It is better to be silent, and be thought a fool, than to speak and remove all doubt." (Confuscius)

freespace 
26/3/08 9:58:29 PM
Hero
Titan


Quote by zephyr
Quote by dave_blob

In a totally contrived and silly example, say I made a language where every variable had to be parenthised in 7 curly braces. Even though everyone is used to other languages than this one, it would still be fair to say its syntax sucks.



Sorry, lisp already exists, they just chose to use parentheses instead :-p

The problem with any new language which looks sufficiently similar to one you know, but has some glaring differences, is that it's hard to approach it objectively (pardon the pun) because it messes with your existing mental model of the abstraction. I think this is one of the reasons why there is a big push on to introduce dot notation to Obj-C's classes, which would align it with C++ (kinda), Java, C#, ruby, python, etc.

I refuse to bow to the pressure of dotters!

-----
By perseverance the snail reached the ark.

http://www.shuningbian.net - blog
http://anonshare.pictorii.com - share files anonymously
http://dailydiscovery.b3ta.org - learn something new
its f reespace damn it!

Girvo 
27/3/08 1:04:22 AM
Immortal

Quote by dave_blob
Quote by Girvo
Syntax is just not what I'm used to. I'm picky ;)

Mind you, I use PHP on a daily basis. Try using THAT syntax. D:



I have. Its probably fair to say that objectivly, PHP is an ugly mess.

A very usefull mess, but a mess nonetheless.



Hear hear. Try and do OOP in it, after coming from C#. D:

Still, with the right framework, it's not as bad.

-----
[No Heroes] is the artistic antithesis of that sinking world; a thorn in the side of their beast. It's for those who move mountains one day at a time. It's for those who truly understand sacrifice. In our world of enemies, we will walk alone...

hetman 
2/4/08 12:13:46 AM
Hero
Titan


In the words of the great man himself:

I invented the term Object-Oriented, and I can tell you I did not have C++ in mind. -- Alan Kay

-----
Wystarczy tego medrkowania.

freespace 
2/4/08 12:32:31 AM
Hero
Titan


Quote by hetman
In the words of the great man himself:

I invented the term Object-Oriented, and I can tell you I did not have C++ in mind. -- Alan Kay

Amen.

-----
By perseverance the snail reached the ark.

http://www.shuningbian.net - blog
http://anonshare.pictorii.com - share files anonymously
http://dailydiscovery.b3ta.org - learn something new
its f reespace damn it!

Girvo 
5/4/08 12:09:19 AM
Immortal

Quote by freespace
Quote by hetman
In the words of the great man himself:

I invented the term Object-Oriented, and I can tell you I did not have C++ in mind. -- Alan Kay

Amen.



I'd agree with that.





It's why I use C#. :P

-----
[No Heroes] is the artistic antithesis of that sinking world; a thorn in the side of their beast. It's for those who move mountains one day at a time. It's for those who truly understand sacrifice. In our world of enemies, we will walk alone...

Cynic* 
5/4/08 2:01:09 PM
Banned

Could someone paste some code highlighting objective-c's better points ? Would be helpful to people who aren't familiar with it

(such as myself)

-----

Quote by Kimmo
I guess my juice would cover two folks pretty easy



freespace 
5/4/08 4:00:46 PM
Hero
Titan


Quote by Cynic*
Could someone paste some code highlighting objective-c's better points ? Would be helpful to people who aren't familiar with it

(such as myself)

Most of it is rather you-have-to-run-it-to-see-it, but there are some nice things, since messages take the form:

[receiver:arg0, param1:arg1, param2:....];


which makes it easy to know what code does and expect, for example:

[atCommand setFont:[NSFont fontWithName:@"Monaco" size:12]];


But thats rather syntax sugary, and nothing unique but its nice. To see dynamic binding and such, you really need to see the code run. To do that it is probably best to just write a few cocoa apps.

Also, google for "objective-C tricks", http://www.bazza.com/~eaganj/weblog/2006/03/24/cool-objective-c-tricks/ is a nice illustrations of why objective-C is cool - runtime replacement of classes.

Cheers,
Steve


Edited by freespace: 5/4/2008 04:06:43 PM

-----
By perseverance the snail reached the ark.

http://www.shuningbian.net - blog
http://anonshare.pictorii.com - share files anonymously
http://dailydiscovery.b3ta.org - learn something new
its f reespace damn it!

bixel 
16/8/08 10:38:42 AM
Serf
freespace said "From where I am, people are disliking objective-c purely because they are being confronted with a new way of doing things, which is different to their old way of doing things. Instead of learning to do things the objective-c way, they try to do in objective-c what they do in their favourite language, and when they fail, they come to the conclusion "objective-C sucks".

What a waste. C++ is indeed one of the worst thing to have ever happened to programming, much like basic."

this is exactly TRUE!! I am a C++/C# dude, and now I have to write stupid programs for the iPhone. I SUPER HATE IT!! Its slowwing me down soo much. Its the worst syntax in any language I have ever seen. My biggest gripe is getting classes to talk to each other - and this message thing SUCKS.

**probably its ONLY bonus**
I am sooo (sarcasm) glad that it can take non-valid arguments and throw them out without crashing the program (though debugging where you went wrong on the other hand....)

theres all kinds of annoying steps you have to do just to get something simple up and running

you have to manage two files (header/main) for every change made or instantiation with any other file/method/class EVAR!

Objective C syntax is so incredibly gobbled its almost as bad as the English language, lots and lots of i before e except after c circumstances buried in dusty old Unix documentation with absolutely no example of how the code is used EVAR.

I could go on, and I would like to show you examples of such horrible nails on chalkboard code but I would have to reboot in MAC OS and I don't feel like it. :P

-----

bixel 
16/8/08 10:52:13 AM
Serf
here is something else I found which seems either true or pure coincidence with my coworkers working in Obj-C. I like my coworkers - but they super suck at teaching you anything for Obj-C.

"I hate ObjC's method-call syntax, for both political and technical reasons.

Political: The syntax is a consistent point of argument, draining resources on those who would teach the language, and those who would learn the language.

The would-be teachers seem to develop an intellectual callous from the constant complaining, making them appear elitist and unable to appreciate other, genuine issues raised against their language. The syntax also harms those who attempt to learn the language. Newbies are usually unsure, learning ObjC on their own time. The weird syntax is just an obstacle. Pity the poor newbie who dares complain -- the crack team of ObjC bigots will be sure to flame him to C#."

from
http://rentzsch.com/papers/loveHateObjC

-----

 Previous Page 1 | 2  
Forums | Programming