The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Why no Objective C on Linux or Windows?

Whenever I read about, compile, or use certain types of "low-level" software (drivers, libraries, graphics code) on Linux and Windows systems, it seems that everything is still written in C or C++.

For all of C and C++'s strengths, their complexity in terms of reliance on pointers/references, the need to include headers in the right order, lack of  memory management, etc., make me surprised that they're still used extensively.

Having read alot about Objective C and written a bit of it on OS X, I've found it's a major improvement on C or C++. I wonder why Objective C hasn't gained any traction outside of the OS X / Nextstep environment?

Is it speed, or licensing, or difficulty in porting the language? Or maybe it's not much of a language, and it just seems that way because Apple presents it as such?
K9
Thursday, August 10, 2006
 
 
I'm sure that when people think about having Objective C on Windows or Linux, the "Not Invented Here" Syndrome comes into play. Not only was the technology popularized by Next and Apple, its heritage is engrained into the names of classes (i. e. NSObject, NS standing for NextStep). If portability is desired, the names of classes have to be kept that way. In GNUStep, the base class for all objects is NSObject.
Ben Atkin Send private email
Thursday, August 10, 2006
 
 
"For all of C and C++'s strengths, their complexity in terms of reliance on pointers/references, the need to include headers in the right order, lack of  memory management, etc., make me surprised that they're still used extensively."

For some people this isn't the problem you make it out to be. Also noted that you seem to co-mingle "flaws" of each as one in the same for both.  (Realizing I might be misunderstanding you)

"Having read alot about Objective C and written a bit of it on OS X, I've found it's a major improvement on C or C++. I wonder why Objective C hasn't gained any traction outside of the OS X / Nextstep environment?"

As someone who has dabbled with Objective-C, I didn't find it a major enhancement over other available options and time tested techniques that I already know.

C and C++ are two very different languages and lines of thinking.  I typically favor C++ to out my bias.  That being stated what are the advantages to Objective-C other than the disadvantages you already mentioned with the other languages?  If I say I can use C properly as well as use C++ properly, what advantages do I get assimilating Objective-C as well?  Do keep in mind I am not slamming Objective-C, but instead of telling you why it's not adopted by more people; why don't you tell me what it is I am missing.  Perhaps I didn't dabble deep enough when I looked into it?
Chris Send private email
Thursday, August 10, 2006
 
 
For one thing, an Objective C on Windows would have to be able to parse the pseudo-C/C++ used in Microsoft's header files to be of any use.  It would have to be link-compatible with existing libraries, too, and if possible capable of .NET interoperation.  All that might be a lot of work.

For another thing, does Apple exert any control over Objective C?  They might see it as a competitive advantage and not want the language to be available on other systems.

As for Linux, its users are notorious for not wanting to pay for any software so the effort would have to come from the open source community.  That goes back to the last question: is it even legal to create independent implementations of Objective C?
Chris Nahr Send private email
Thursday, August 10, 2006
 
 
I understand that gcc compiles Objective C; so it should be pretty easy to develop in it on Linux (haven't tried that though).
Berislav Lopac Send private email
Thursday, August 10, 2006
 
 
GCC is in fact a pretty good Objective C compiler.

The issue, I think, is twofold.

1. The "big win" of Next engineering, and hence the Mac approach, was the class library. Big, rich, well engineered and productivity enhancing. However, it's not free-beer free or free-speech free. The GNU version is coming on, but it's not there yet. So it's effectively tied to a dead platform and not-all-that-popular platform[1]

Not having the class library floating around means people aren't picking it for their hobby projects and so on; if they have to use a C++ class library anyway, they use C++.



2. Critical mass. It's very easy to find a load of C++ people and a load of C++ projects to rip bits out of and components to use and books on teaching random people how to be expert developers in a fortnight.

If you go out into the marketplace and try and find OC people, you'll have a tough time. You might come across people like me who've written a few programs in it, but you won't find people with the 5 years experience HR says they need to have to be a team lead and they aren't going to let you compromise on 10 years C++ and some background in OC. So big businesses can't hire a team lead, basically which limits OC work to small companies & small projects.

This is the same thing as with Delphi. I keep getting called about Delphi work, because it's on my CV because I did some way back when it was new. However they then turn me down because it's not current and I don't have N years in it. As far as I can tell they never hire anyone because I get called about the same roles by a new agent every couple of months for years on end. This unwillingness to hire someone who's a good developer and has some knowledge of your tool is very limiting for fringe technology -- Delphi can at least (if clued up) cross-hire from Borland C++ developers[2]. If your HR/management are going to insist that your developers have current extensive OC, you're drawing from a very small pool indeed.

As a project sponsor, this sort of thing makes it a no-brainer. You start a project in C++ and it goes wrong, at least you didn't take unnecessary risks.

You start one in OC and if it goes wrong, everyone will be asking you why you chose a "high-risk" route.




[1] Yeah, I know people LIKE it. Not very many places run trading platforms on it, for example.

[2] Same class library.
Katie Lucas
Thursday, August 10, 2006
 
 
Filling in a few blanks:
gcc is the obj-c compiler used by XCode
Apple pretty much owns obj-c and has just announced obj-c 2.0 (obj-c with some enhancements and garbage collection)
obj-c is a superset of C (unlike C++) so you can drop into C when needed without problem

As for Apple's 'competitive advantage' with obj-c - the real advantage comes from the Cocoa frameworks, not from the language used to implement them.  Although I will say that obj-c does offer a lot of flexibility through it's messaging structure that I find useful on a daily basis.
Lou Send private email
Thursday, August 10, 2006
 
 
Having to include headers in the right order isn't due to any fault in the language. It's due to bad library design. I follow two basic rules when writing header files:


1. A header file should include all other headers that are needed for a file that includes it to compile.
2. A header should be able to be included any number of times without ill effects.

The designers of the standard C and C++ libraries followed both rules. The designers of the POSIX C interface only followed #2, which is why you need to include the right POSIX headers in the righ order.
clcr
Thursday, August 10, 2006
 
 
Wow, a lot of ignorance in this thread.

Objective C is available on all platforms.

Many of the Apple Objective C libraries are available, as free open source software and may be used on any platform. Not included is the GUI stuff, which would not make any sense to have on the PC/Linux.

Objective C is a true object oriented language, unlike C++, and is much more productive as such.

The troll comments about the Mac being a 'dead' platform only proclaim your ignorance, but this is common among business app developers with substandard educations.
Meghraj Reddy
Thursday, August 10, 2006
 
 
Ahem. Next was the dead platform I was referring to. The Mac is the not-so-popular platform.

Possibly you need to actually read content before insulting people.
Katie Lucas
Thursday, August 10, 2006
 
 
I think your prose needs some deambiguising.

I do not agree with you that the NeXT platform is dead - it seems to be immensely popular nowadays.
Meghraj Reddy
Thursday, August 10, 2006
 
 
Thanks for the replies. I guess the class libraries are a large part of the experience of developing on OS X, and acheiving a critical mass would certainly be a factor before any successor to C++ could truly take off.

My motivation for the question is that I see all of the progress in terms of higher level dynamic languages, and wonder when/how we'll move towards more stable and productive low-level languages...
K9
Thursday, August 10, 2006
 
 
"The troll comments about the Mac being a 'dead' platform only proclaim your ignorance, but this is common among business app developers with substandard educations."

Heh, you're right. It takes a Harvard graduate to realize that the Mac is not too popular. Ask any 4th grader: What's bigger 95% or 5%? [/sarcasm]
Wayne B
Thursday, August 10, 2006
 
 
Wayne, would you care to guess what is the only computer manufacturer in the world that is larger than Dell?

Moron.
Meghraj Reddy
Friday, August 11, 2006
 
 
And here we have another reason why Objective C is so unpopular: it's mostly used by obnoxious Mac fanboys like Meghraj Reddy that nobody wants to be associated with...
Chris Nahr Send private email
Friday, August 11, 2006
 
 
Back on topic - while the language is available on other platforms and can be compiled with gcc, the frameworks are not all available on other systems, nor is the interface builder.

Now, Interface Builder isn't important for low level work like the OP is talking about, so ignoring that we're still looking at the frameworks.  Those too are not critical for drivers (I'm not drawing NSRects or using custom NSTableCells in my printer driver).

So we're down to the language itself.  Is it nice, you betcha.  Is it a real improvement over C++?  Eeh, that's debatable.  Is Obj-C 2.0 an improvement, YES (for garbage collection alone).  But Obj-C 2.0 won't be out until Leopard (Mac OS X 1.5) so we'll have to hold back on that one for now.
Lou Send private email
Friday, August 11, 2006
 
 
I loved Obj-C when I was doing development on Nextstep.  I really thought Openstep for Windows / Yellowbox was going to revolutionize Windows development.  I still fire up YB occasionally, although it is starting to look a little dated now.

I have often wondered if an Openstep-like platform, using native widgets instead of the dps and machd layers, would be viable on Windows.
Bill Keller Send private email
Friday, August 11, 2006
 
 
Is there an official standard version, like the ECMA documentation of .Net?
Flow
Saturday, August 12, 2006
 
 
1. The Objective-C compiler used by Apple is GCC. NeXT used GCC as the basis of their compiler and GCC has since contained its own development (though the GNU runtime and the NeXT runtime were distinct) which included the language changes from the StepStone compiler. There is also POC which was written by David Stes as a continuation of the language defined by Brad Cox. Both the Objective-C compiler in GCC and POC work on Linux, Windows, and what have you.

2. Objective-C does not really remove any of the problems of C development with respect to pointer-management, header order, or any of the numerous sources of subtle bugs possible in C. The additional usage of a conservative garbage collector like Boehm (GCC has supported this for several years, POC supports a handful of memory management options, and Apple has recently blessed garbage collection in concert with its frameworks) can mitigate some of the manual memory management woes as well as preventing cycles in naive reference counting.

3. Apple doesn't "own" Objective-C as such. NeXT acquired StepStone somewhere around 1995 if I recall correctly, however as I've pointed out already the capability of using Objective-C is ubiquitous on these platforms and any extensions you would wish to add would be quite up to you. There was also a language called TOM that was superficially a continuation of some of the ideas of Objective-C.

4. The "linux people that don't like to pay for anything" have been working on GNUStep for years; long before Apple decided to replace its technology with NeXT's. Without the frameworks, Objective-C is honestly not all that compelling. It's a crufty extension of C. The bulk of the value of the NeXT platform was in its frameworks.

5. The biggest reason that there is less interest in Objective-C on other platforms is a lack of a meaningful incentive to use it. It isn't especially high-level, it isn't particularly simplistic, there isn't a lot of frameworks built in conjunction with it outside of Apple's, and so forth. You might as well ask why Mac developers weren't using Objective-C before Apple blessed it.
Julian Price Send private email
Sunday, August 13, 2006
 
 
Julian, thank you for the very informative comments.

"You might as well ask why Mac developers weren't using Objective-C before Apple blessed it."

OK, I'll ask.  Why not?

I would guess, from your answer:
1. They didn't see how it would help them write better code more easily.
2. They didn't see it as the key to use great libraries that would really help their development.
Flow
Monday, August 14, 2006
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz