Why objective-C is selected as platform for Cocoa why not C, C++? [closed] - objective-c

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
Why Objective-C is chosen as language for cocoa or cocoa touch, why not other? What are main usages in Objective-C that are not in other languages.
How I can Convince the interviewer about this.

The main reason is that Cocoa is descended from NeXTStep, which was written in Objective-C back before C++ had the STL (IIRC it didn't even have useful templates back then; I recall g++ having big warnings in its template implementation into the early 90s). Also, I gather Jobs & co. preferred the Smalltalk-like OO of Objective C.

Cocoa is it self implemented in Object-C. By using that language a developer can more easily leverage the features of the hose system. While C/C++ are valid languages ( because of Objective-C background in them ) the interface between C/C++ and Cocoa ( because it's Objective-C ) is harder than if you were to just stick with Objective-C.
See more on this from Apple.

First, I think any language with GC is far more productive than any language without. Especially when programming in the large across many different teams, developers and frameworks, other techniques like reference counting are flawed and lead to code bloat. Many years ago there was a formal study that showed that the theoretical best performance of Generational Garbage Collection was about 4% of cpu usage. The theoretical best using reference counting was just under 10%.
The second thing to look at is how confining the language chosen is and how easy it is to blend with other C / C++ code. Many languages, such as Java, pretty much limit you to a single paradigm. Objective C is set of OO extensions on top of C. It has a great deal of flexibility as a result. In Objective C 2.0 and later, new features such as properties and blocks have also been added.
All the above said there are things I don't like about Objective C. It is more verbose than I like in a programming language and does not provide sufficient capabilities to do much meta-programming. I really am not happy that it still does not have namespaces. I know some of the reasons used to explain this lack but I do not find them at all sufficient. A flat class and method/selector namespace is not excusable in the 21st century.
What I really want is for MacRuby to take off and be implemented very very efficiently. A return of Dylan would also be very greatly appreciated. :)

Related

What is the opposite of OOP? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I started in High School learning java and python and I guess I just always learned OOP and nothing else my question is What are the other programming paradigms or types of programming languages beside OOP?
"Opposite" isn't really a good way of putting it. What's the "opposite" of Democracy? OOP is a a paradigm -- a way of viewing the problem of programming.
The four main coding paradigms are:
functional (viewing programs as mathematical formulas)
imperative (programs are series of instructions for the computer)
logical (model information and the relationship between that information), and
OOP (Model objects and how it interacts with other data)
http://www.cs.aau.dk/~normark/prog3-03/html/notes/paradigms_themes-paradigm-overview-section.html#paradigms_logic-paradigm-overview_title_1
Logical is the most different by far and you have to jump through a lot of hoops to solve some problems in logical programming. The other three all solve the same problems, but the approaches are different.
Procedural Programming is one of the other forms used.
http://en.wikipedia.org/wiki/Procedural_programming
There is no such thing. OOP is a concept built on top of procedural programming, there is no opposite rather there is a choice of writing in OO or not.
These answers are all wrong ... and that is a VERY good question ... and the answer is .... "AOP" - i.e. an "Algorithmic Oriented Programming" entirely based on the "algorithm" being at the very centre of the concept - in an AOP the "data" or an "object" or "objects"are simply "passed to the algorithm" - i.e. THE ALGORITHM IS ENTIRELY KING (it "knows" what to do with the data) - the data carries around "nothing".
In fact "we" (at Inferix) think OOP is a blind alley!
AOP is a much better model of reality - OOP is fine for "images on screens" and "data processing" but it cannot encapsulate intelligence - because "relationships and dynamics and intelligence" are not at it's core!
So we think that "AI Entities" (coming soon) will use only AOP!
Practically speaking Algol60, Coral66 and Inferix-MTR are examples of AOP languages - Algol60 became Pascal and Ada and the likes - and these just became more and more OOP (e.g. Delphi)!
The start of "typing" of values marked the end of AOP!
However: MTR is still a strictly AOP language (but unfortunately at present it is designed for AI entities to use and not humans).
You could think of an AOP as a language that strictly "prohibits" the typing of data elements and is only concerned with "values" of "signals".
There are several but i would say Functional Programming is the most opposite.
http://en.wikipedia.org/wiki/Functional_programming

Objective-C game development? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
if Apple announce their own gaming console as they did in past and i'm sure they will not support C++/C# games. so my question is that Is Objective-C is such fast and powerful to write efficient game Engine ?
Cocos2D is a very effective Objective-C Graphics engine, along with Box2D Physics Engine and a CocosDenshion Audio engine you can make some very nice games.
Objective-C is a fast, small-footprint language. Seeing as how it runs on the most successful Embedded mass-market platform - the iPhone. I'm not sure what justification you give that C++/C# is a better choice for games? As noted here, cached message sends are faster than C++ Virtual Method calls.
Most games on Apple devices are written in C/C++ with perhaps a thin facade of Objective-C. So you are pointing out a non-issue.
Also Objective-C is very fast since it's just a superset of C.
I'm sure that C++ would be always supported by Apple. It's really not possible to write optimized game like, for example Infinity Blade using only Objective C.
The reason of this is the huge flexibility of the language (while in most cases it's a big advantage but not in game development): it is achieved using runtime messaging, which uses a lot of implicit function calls (search in cache, search in methods, search in superclass cache and so on).
So almost everything is resolved at runtime in ObjC and it takes much time for processing.
26 years ago my using of C++ instead of C was laughed. Now almost game developers are using C++.
Likewise, the trends will change into objective-c in my opinion!
Use of C inside objective-c for better performance is not giving up objective-c but should be called performance tuning!

Why is Objective-C not very popular outside of the Apple community? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I know that the Apple community – including Mac and iPhone developers – mainly use Objective-C for their development language. But it seems that not many people use Objective-C outside of the Apple community, such as in the Windows or Linux worlds.
What are the possible reasons that Objective-C is not particularly popular outside of the Apple community?
Another way of thinking about this question might be: why did C++, rather than Objective-C, become the "Object-Oriented C"?
I learned C++ in 1991, and remember that C++ seemed like the hot thing while Objective-C was this weird little language that no-one (other than NeXT) wanted to use. I've been trying to remember why, and I think it boils down to 4 things (5, if you include C++ having AT&T behind it):
Features: C++ had, even then, a much richer set of features than Objective-C.
Syntax: Objective-C's syntax is a much bigger change from C than is C++.
Performance: Stroustrup focused on making C++ features easily mappable to C, so that (in theory!) there was no performance penalty in using C++. And with judicious use of the "inline" keyword, you could even get better performance with C++ than with C. Even now, there is no way I would use Objective-C in a project where performance was critical.
Style: Relatively strong, static typing was the fashion (for good reasons).
So compared to Objective-C, C++ in the early '90s gave you more features with less of a performance penalty, with a syntax that was both fashionable and more familiar than Objective-C's.
This is a complicated question; but in short; I think the answer most likely lies in the age of the operating systems, and their roots.
UNIX is C, so that's that.
Linux is envisioned as a straight-up clone of Unix, (Fine, this is slightly inaccurate, but close enough for this discussion) and as such, it is more or less written in C.
Windows is an old operating system; and one that is built by stacking hack upon hack going back all the way to Windows 3.1. C++ is heavily favored, and in .NET, C#.
This new influx is of course based on whatever agenda Microsoft has with that platform.
Mac OS X; on the other hand, is a (comparatively) young operating system, and its new parts (while still quite old, being inherited from the NeXT and whatnot) are all based on Objective-C because, "Hey! Why not?".
As backwards compatibility was not among the list of priorities with Mac OS X 10.0; the C/C++-based Toolbox and Carbon got the short end of the stick, and the entire operating system was more or less made as a reskinned version of NeXTStep.
The issue with Obj-C is that the power of the language comes mostly from the sizable frameworks, the generally high level of integration into the system, and so on. It's almost impossible to get a good jive like that going without a clean break from backwards compatibility and, as such, it would never really stand a chance on any platform that didn't dare to do this. Apple, with a small (at the time) and devoted user base, dared do this, and struck gold.
Microsoft is now trying, but are, in my humble opinion, failing. ("Failing?! .NET!? HOW DARE YOU!?": With 4 major revisions in about 8 years, they are doing more growing than maturation; which may be a good thing, if they can turn it around.)
Edit: There are some projects attempting to port OpenStep to Linux, but they are a bit clunky and hard to use; there are also smaller projects on NS/OS-likes with smaller problem domains, but it's uphill work.
I was recently standing in a bookshop reading Masterminds of Programming where the creators of programming languages talk about their creations. There was one chapter about Objective-C where Tom Love (one of the creator of Objective-C, along with Brad Cox) was asked why C++ had gone so far, while Objective-C hadn't:
Why do you think that C++ was used more frequently than Objective-C?
Tom: It had the AT&T moniker behind it.
Just that?
Tom: I think so.
What do you think about Objective-C today?
Tom: It still exists. How about that?
Objective-C is nothing but a thin layer(a bit thicker with 2.0) of syntactic sugar for message passing on top of standard C. Even the most basic object orientation is provided by the runtime library, which was proprietary for a long time. Inertia is an important factor in language use.
It shines especially on GUIs, but the only toolkits that support it are Apple's and the mostly unknown and catchup-playing GNUStep.
While there is some value for Objective-C outside of GUIs, and I think people would use the extensions were they imported to C, even in system code, there is little reason to choose it over alternatives, when little of your system is meant to work with it.
Off the top of my head, I believe C++ is older than Objective-C, and not only for this reason has a much bigger user base. Everywhere that OC may have come, C++ was already there :)
Also, C++ has more features. Many people are impressed by lots of features. And it's had more research and development poured into it... and so forth. Essentially, momentum.

Interview question: difference between object and object-oriented languages [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
My friend was asked the following question: what's the difference between object language and object-oriented language?
It's a little unintelligible question. What does term «object language» correspond to? Does that mean «pure» object-oriented language, like the Wikipedia article says:
Languages called "pure" OO languages, because everything in them is treated consistently as an object, from primitives such as characters and punctuation, all the way up to whole classes, prototypes, blocks, modules, etc. They were designed specifically to facilitate, even enforce, OO methods. Examples: Smalltalk, Eiffel, Ruby, JADE, VB.NET.
Unless the person was interviewed by a philosopher talking about an abstract metalanguage, or an old-school engineer talking about the end result a compiler produces, the question sounds like semantic masturbation by someone who doesn't speak the same language as the rest of the industry.
So in other words, the distinction is whatever the interviewer wants it to be. (Or perhaps the question was misheard). I don't think most developers would think that the terms are connected enough to be worthy of comparison and contrast.
The right response would probably be in the style of a psychoanalyst: What do you think it means? Ask clarifying questions to make sure you understand what the interviewer is asking and assuming. Then leave and don't call the employer back, because you don't want to work there.
The term object does not have an official, widely used or otherwise well-known definition.
The term object language does not have an official, widely used or otherwise well-known definition.
The term object-oriented does have an official definition, but that is usually completely ignored, not widely used nor otherwise well-known.
The term object-oriented language does not have a single official, widely used or otherwise well-known definition, it is usually understood to mean
a language in which object-oriented programming is possible or
a language in which only object-oriented programming is possible or
a language in which object-oriented programming is easy or
a language in which object-oriented programming is easy and non-object-oriented programming is hard or
a language in which everything is an object or
any combination of the above or
something completely different (and note that in any of the above you can substitute arbitrary definitions for "object" and "object-oriented")
In short: the interview question roughly translates to "what's the difference between this thing I'm not going to tell you what it is and that other thing I'm also not going to tell you what it is?"
I'd suspect that the interviewer was looking for a distinction between object-based and object oriented.
This is, for example, using structs in C, with no polymorphism or inheritance.
The difference between the two for C and C++ is highlighted here.

the future of objective c? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am currently a c# developer(one year's working experience with bachelor degree in china), now there is another job opportunity as an objective c engineer and i am kind of interested in that position. but what bothers me is the future of objective c, is it a dying language living in the shadow of c++, java and c#? or it is a good language to stick to?
thanks.
On the Mac it's definitely alive and kicking. Also the IPhone. So if you like working on those environments and systems then go for it.
As far as everywhere else it hasn't really caught on much that I'm aware of. Not to say that it couldn't though. Lots of good languages catch on relatively late, like erlang for instance, so I wouldn't count Objective-C out.
Not to mention the value of learning a new language and stretching yourself.
So, if you are asking will this help further my career? then one answer is yes learning something new can be of benefit to a beginning programmer.
If you are asking will experience with Objective-C itself be marketable? then the answer is yes if you want to work in the World of Apple software.
Objective-C is widely used on Mac OS X and the iPhone OS, so it's not likely to go away anytime soon. It forms the basis of OS X. Most Apple and third-party apps are written in Objective-C, and Apple is even rewriting the OS X Finder in Objective-C, so it looks like it'll be sticking around for a while.
It's definitely not living in the shadow of C++, Java, and C#, especially on OS X. (I personally think Objective-C is a much better language than C++, Java, and C#, but that's just my opinion.) It has a different feel than those languages (due at least in part to its dynamic, rather than static, nature), but it's not really living in the shadow of them.
It's worth learning if you want to develop for the Mac or iPhone, but it isn't used widely outside of those platforms, so if you're not interested in that line of development, I suppose it's not worth it to learn.
As others have said, Objective-C is alive and well on Apple's platforms (namely, OS X and the iPhone).
Additionally, it sounds like Objective-C will show you a whole new different approach of doing OO work. Considering the strong typing of C++, Java, and C#, Objective-C is very different, as it's built on true dynamism. I personally find it a joy to work with, much moreso than Java or even C++. I particularly like how the delegate system works, as well as the borrowed Smalltalk syntax.
Plus, being a simple superset of C, it's really easy to learn Objective-C. It should only take a couple hours at most to get the syntax down, and from there, it's down to learning about the library (which has good documentation). When learning it, you should try to not get into patterns that you normally do with the other languages you listed, as you won't get the full benefit of its dynamic typing.
FWIW, Objective C is about the same age as C++ and both predate Java and C# by quite a few years. I honestly think that the C++ and Java communities could learn a lot from Objective C. IMHO, the NeXTSTEP API is much cleaner than the Java library. Really writing code in Objective C with the Foundation and AppKit (et.al.) gives you a good appreciation of MVC architectures and how cleanly they can be implemented.
Anyway, I think that it is quite worth the effort to learn a language like Objective C. If for no other reason than to gain a greater understanding of what shaped languages like Java.
It really depends on your career direction. As the other posters say, if you switch to Objective C I think you will learn a lot and probably have some fun (and some pain) along the way.
Because objective c is so much closer to C and to some extent C++, you will end up being more employable in not just objective c, but c, and C++.
C is mainly used for lower level programming such as for hardware devices. So if you have a special interest in hardware devices you could go Objective C -> apple kernel device drivers (which are c), and then any hardware programming job.
If you just want to make websites, and basic desktop apps for windows, stick with C#.
I don't think Objective-C will be dead in a long time, because it is at the core of Mac OS X. If Apple should come with more modern languages I am sure it would be a dynamic language built on the Objective-C runtime to allow easy reuse of existing software and components. That would mean one would probably continue to use Objective-C for performance critical parts. Just like python developers still write parts of their code in C.
And because Apple controls the language I think it is more likely with rapid improvements in the language to keep it relevant than say C++.
Objective-C might get used more on other platforms in the future. It was back in the OpenStep days. But when Apple bought NeXT they stopped making Cocoa and Objective-C available on other platforms. The compiler is still available everywhere but not the frameworks and runtime. The new CEO might be more open minded than Steve Jobs about making ObjC available elsewhere.