PDA

View Full Version : what code language to learn?




idotal
Jun 10, 2011, 02:35 PM
hi,
i know c#, but i want to learn code language for mac computers.
i just downloaded xcode and realize that there is plenty of languages that he support.
from what i have seen the mac xcode support c,c++,cocoa and objective c.
my question is what the difference between these languages?
there is something that one language does that the other don't?
and what language should i learn?
for the record, there is learning book for c and c++ in my own language...
and if i want to write an app for ios, is the ios support all the languages above too?(c,c++,cocoa,objective c)



PatrickCocoa
Jun 10, 2011, 02:46 PM
All of Apple's code is in Objective-C. Whether or not objective-C is better than other languages is irrelevant. Apple has spoken.

idotal
Jun 10, 2011, 02:55 PM
but why? what's the difference between c or c++ and objective c?

subsonix
Jun 10, 2011, 02:58 PM
It all depends on what you want to do, if you want to write desktop OS X or iOS applications, yes Obj-C is what you should learn. But there are a lot of frameworks further down the software stack (even Apples code) that is C or C++. Like CoreFoundation, CoreAudio, QuickTime, CoreGraphics, IOKit (C++) and so on, not to mention all BSD api's, is all in C, so yeah, it kind of depends on what your goals are. You might have to use the lower level frameworks at some time, then it's obviously a good idea to have seen C or C++ before. Although Obj-C shares a lot with C, (valid C is valid Obj-C), but conceptually they are very different.

subsonix
Jun 10, 2011, 03:04 PM
but why? what's the difference between c or c++ and objective c?

Why, because the richest and most flexible frameworks are Obj-C frameworks. Basically if you want to write Cocoa applications you need Obj-C. C++ is another object-oriented C language, that is different to Obj-C approach. Apart from IOKit i don't think that there are any C++ frameworks on OS X, although it can be convenient to wrap up C functions in C++ classes. C is a standard procedural systems programming language, it's ubiquitous but it deals with tiny details, if you want to get things done and don't need the control then you want more abstraction than C can provide. Your best bet is probably to Google a bit about the differences.

Blakeasd
Jun 10, 2011, 04:14 PM
If you know C# then Mono is available, however the apps that it produces, IMO are a little under-par. Java is another okay choice, it works, but Apple seems to be getting ridding of it slowly. The best C++ choice would be QT, but again, the apps it produces aren't that great. The best choice overall would be Objective-C, the apps are great and it isn't very hard to learn IMO.

mwpeters8182
Jun 10, 2011, 05:46 PM
hi,
i know c#, but i want to learn code language for mac computers.
i just downloaded xcode and realize that there is plenty of languages that he support.
from what i have seen the mac xcode support c,c++,cocoa and objective c.
my question is what the difference between these languages?
there is something that one language does that the other don't?
and what language should i learn?
for the record, there is learning book for c and c++ in my own language...
and if i want to write an app for ios, is the ios support all the languages above too?(c,c++,cocoa,objective c)

If there's a specific app you want to code up/port to mac, you might want to look at either MonoTouch (http://monotouch.net/) or MonoMac (http://www.mono-project.com/MonoMac). Those would let you write C# and deploy native Mac or iPhone apps.

If you're just learning, I'd suggest reading up on Objective C and Cocoa. If you haven't done much C in the past, I'd read Kochan's "Programming in Objective C" book first, then looking at one of the iOS or Mac programming books (I've been using Aaron Hillegass' books for learning myself).

Cromulent
Jun 10, 2011, 06:17 PM
If you know C# then Mono is available, however the apps that it produces, IMO are a little under-par. Java is another okay choice, it works, but Apple seems to be getting ridding of it slowly. The best C++ choice would be QT, but again, the apps it produces aren't that great. The best choice overall would be Objective-C, the apps are great and it isn't very hard to learn IMO.

The quality of apps produced has nothing to do with the language and everything to do with the developer. You could produce the best program in the world using Basic or Assembly. It is all down to developer skill, nothing else.

subsonix
Jun 10, 2011, 06:32 PM
The quality of apps produced has nothing to do with the language and everything to do with the developer. You could produce the best program in the world using Basic or Assembly. It is all down to developer skill, nothing else.

Nothing? Really, I get what you are saying but common it's oversimplifying things. The frameworks you have available to you has something to do with the quality of the app, unless you intend to re-implement basic OS functionality by yourself all the time.

Cromulent
Jun 10, 2011, 07:49 PM
Nothing? Really, I get what you are saying but common it's oversimplifying things. The frameworks you have available to you has something to do with the quality of the app, unless you intend to re-implement basic OS functionality by yourself all the time.

Some of the best apps ever written have been done in assembly with basically no library support at all.

Frameworks help but a talented developer will produce a great application no matter what. Its the same with music apps. A great musician can make an amazing track using Garageband (or any other consumer level music app). Logic Pro helps but talent wins any day of the week.

subsonix
Jun 10, 2011, 07:57 PM
Some of the best apps ever written have been done in assembly with basically no library support at all.

Frameworks help but a talented developer will produce a great application no matter what. Its the same with music apps. A great musician can make an amazing track using Garageband (or any other consumer level music app). Logic Pro helps but talent wins any day of the week.

Theory vs reality. Look at the thread title, read the first post, taken in context how do you feel about implementing a "Cocoa" application that looks and behaves exactly like a native OS X or iOS application without using Cocoa but instead implement everything by yourself from scratch in assembly. The type of applications you are talking about are not end-user, desktop applications, if you want access to native OS functionality you will need syscalls at the very least, in this decade at least.

Cromulent
Jun 10, 2011, 09:21 PM
Theory vs reality. Look at the thread title, read the first post, taken in context how do you feel about implementing a "Cocoa" application that looks and behaves exactly like a native OS X or iOS application without using Cocoa but instead implement everything by yourself from scratch in assembly. The type of applications you are talking about are not end-user, desktop applications, if you want access to native OS functionality you will need syscalls at the very least, in this decade at least.

UNIX was a pretty impressive operating system written in C. In fact C was invented just so UNIX was easier to write and maintain. Before that point all operating systems were written in assembly. In fact a (very) small group of people wrote UNIX so, yeah, it is not theory it is entirely possible for people to write amazing stuff with no libraries available. Easy? No. Possible? Yes. You just need to be a brilliant developer.

Anyway this is a tangent. My original point (and I think I made it clear) was that the languages or frameworks used do not produce sub-par applications, it is developers that produce sub-par applications. Java is perfectly capable of making decent looking applications on Mac OS X (Cyberduck), just as C++ (through Qt) or C# is (through Mono). Blaming the framework or the language for bad applications is a bit like blaming a hammer because it bent a nail.

If you re-read the post I quoted it should be obvious. Choosing a language it not so much about the frameworks (they all have their pros and cons) it is about the developers knowledge of the language. If a developer chooses a framework for the wrong reasons it is entirely possible for an inordinate amount of time being wasted because they were lulled into a false sense of security by the hype surrounding it (see Ruby on Rails for a great example of this).

subsonix
Jun 10, 2011, 09:31 PM
UNIX was a pretty impressive operating system written in C. In fact C was invented just so UNIX was easier to write and maintain. Before that point all operating systems were written in assembly. In fact a (very) small group of people wrote UNIX so, yeah, it is not theory it is entirely possible for people to write amazing stuff with no libraries available. Easy? No. Possible? Yes. You just need to be a brilliant developer.

Yes, I'm aware of all that but it has nothing to do with this thread. OS development is different since you are the one creating the OS, here the question is programming for an OS. You are then at the mercy of the api's provided by the platform, if you want to create GUI applications you will need a framework. Which one do you think is closest to the OS, it's own api's or some 3rd party implementation?


Anyway this is a tangent. My original point (and I think I made it clear) was that the languages or frameworks used do not produce sub-par applications, it is developers that produce sub-par applications. Java is perfectly capable of making decent looking applications on Mac OS X (Cyberduck), just as C++ (through Qt) or C# is (through Mono). Blaming the framework or the language for bad applications is a bit like blaming a hammer because it bent a nail.

If you re-read the post I quoted it should be obvious. Choosing a language it not so much about the frameworks (they all have their pros and cons) it is about the developers knowledge of the language. If a developer chooses a framework for the wrong reasons it is entirely possible for an inordinate amount of time being wasted because they were lulled into a false sense of security by the hype surrounding it (see Ruby on Rails for a great example of this).

Well, I read the post and you said it has nothing to do with the frameworks. It obviously has, first of all a framework needs to be available, and if the framework lacks functionality or "looks" or performs differently there is nothing you can do about that. Using the native frameworks will give you access to all the functionality provided to the developers by Apple at the best performance and with all the features of the plattform.

PatrickCocoa
Jun 10, 2011, 10:20 PM
but why? what's the difference between c or c++ and objective c?

First, I forgot to mention in my first post that this topic will generate a lot of responses. Developers get imprinted with the language/IDE/framework/SDK that they started with or that they've used the most, and love to proselytize.

Second, to answer your question: it doesn't matter why or what the difference is. Apple has everything set up for Objective-C. Use it.

MorphingDragon
Jun 11, 2011, 07:56 AM
If there's a specific app you want to code up/port to mac, you might want to look at either MonoTouch (http://monotouch.net/) or MonoMac (http://www.mono-project.com/MonoMac). Those would let you write C# and deploy native Mac or iPhone apps.


Please stop Recommending Mono for the time being. Attachmate still haven't announced a proper roadmap for Mono (if at all) and they recently laid off a lot of dedicated employees working on Mono.

mobilehaathi
Jun 13, 2011, 07:10 AM
If your goal is to sell on the Mac App Store or the iOS store, then Obj-C is your only option. Otherwise I reccomend Ook! (http://www.dangermouse.net/esoteric/ook.html)

numero
Jun 14, 2011, 11:24 PM
hi,
and if i want to write an app for ios, is the ios support all the languages above too?(c,c++,cocoa,objective c)

One little point got overlooked in all of these discussions. You asked about c, c++, cocoa and objective-c. Cocoa is not a language. It is the collective name for Apple's frameworks. So, learn the objective-c syntax and then use that to learn the Cocoa APIs. If you have C under your belt and can handle pointers and understand memory management/allocation I think you will love the power and elegance of Obj-C and Cocoa.