Cocoa Programming for Mac OS X
Intro to Cocoa
If you're interested in programming for Mac OS X, you've
definitely heard of Cocoa by now. Cocoa is the name of the library of
frameworks that gives you the ability to write advanced applications with ease. The Cocoa frameworks enable you to perform tasks that used to take a decent amount of code and implement it in a very straightforward manner. The hardest thing about learning Cocoa is that because it's so simple, it takes some getting used to.
Until today, there was only one book if you wanted to learn Cocoa. That book is Learning Cocoa , which is published by O'Reilly and written by Apple Computer, Inc. The new kid on the block is Cocoa Programming for OS X, which is published by Addison-Wesley and written by Aaron Hillegass of the Big Nerd Ranch. With two books out, Cocoa programmers now have an actual choice of which book to buy. Which brings us to the point of this review -- which book is better?
Is it really O'Reilly?
Since Learning Cocoa was out first, I'll start with my
analysis of it first. When I heard that O'Reilly was going to start publishing
OS X programming books, I was stoked. O'Reilly books have historically been amazing -- very complete and straightforward sources that any programmer would be proud to have in his or her arsenal of knowledge. Unfortunately, Learning Cocoa falls short of the O'Reilly tradition, and makes me wonder if O'Reilly actually supervised the printing of this book.
There are some good points about the book. It was the first and only Cocoa book, so when I got my copy back in May, I was looking forward to learning the language. It does provide some good examples on how to write Cocoa applications, which allows one to dive straight into Cocoa programming. The introduction to Cocoa is really good -- it gives a very in-depth description of Object-Oriented and Cocoa program design, which I really like. Additionally, it gives a very good background to the concepts and techniques of using Cocoa.
However, there is a real problem with this book. This book reads more like it was meant to be an internal reference at Apple, rather than a book for the beginner. Another problem is that the layout and order of the content is confusing. Unlike past O'Reilly books and other quality programming books, it seems like this time they took a bunch of internal technical documents on Cocoa, and sent them to the binding machines without further editing. That the book credits "Apple Computer, Inc." as the author provides good evidence for my theory.
The heart of the problem is that the reader has to really dig and explore through this book to find that info that he or she wants. When learning a new language or programming concept, a book should be easy to follow and it should allow the reader to focus on learning the actual concepts, and not having to figure out the flow of the book.
Aaron hits a home run
The "flow" statement is a perfect segue into my analysis of
Cocoa Programming For Mac OS X. Right away, I could tell that I was going to like this book. The author, Aaron Hillegass, wrote this book like he is a friend
speaking directly to the reader -- he takes you through each concept like he is right there with you. This book teaches you Cocoa by specifically having you write applications, and in each new chapter, you add new features. As you add each new feature, you'll learn an important Cocoa concept.
O'Reilly's book also has the reader write applications and add features, one by one, but it does so in a very sporadic way. I was never really sure what the purpose of adding a certain method was, whereas with Aaron's book, each chapter is focused on an ordered and very specific concept, making it very clear what I was about to learn, and why.
Another part of this book that I really appreciate is the chapter on Objective-C. In just one chapter, I understood Objective-C. You must already know C and at least one object-oriented language (like C++ or Java,) but after reading this chapter, you will be able to write Cocoa applications in Objective-C.
This book comes with an online counterpart, powered by Techstra. Techstra is an online engine that allows you to enter any page of the book and get "extras." The extras include examples not in the book, solutions, errata, and even input from readers. It's very cool and very helpful.
A final and very strong point of Aaron's book is that it reflects the latest update of the Mac OS X development tools, Project Builder and Interface Builder. Apple just updated the development tools to version 10.1, substantially changing the UI and functionality, and the latest version is reflected in Aaron's book.
Conclusion
It's clear to see which book I'm giving the nod to. I know
it appears like I'm being biased towards Cocoa Programming For OS X, but if can get to your local bookstore and actually compare the two books side by
side, you'll see why I'm so enthusiastic about Aaron's book.
I think having both books is a good choice, as the O'Reilly book does offer very in-depth information, which is useful once you learn Cocoa using Aaron's book. If O'Reilly changed the title to After Learning Cocoa, I think my perception of the book would be different.
Cocoa allows programmers to write powerful applications in a very short amount of time. I am amazed at the power and simplicity of the Cocoa frameworks, and can't wait to see what myself and other programmers end up creating in the future. I'm sure other books will come out in the future, but for now all we have is two. The one I'd recommend is Cocoa Programming for Mac OS X, but you already knew that. :)
You can purchase this book at Fatbrain. Want to see your own review here? Read the book review guidelines first :)
the NeXT Programmer's Manual (by Simson Garfinkel, i believe) is a very useful Mac OS X programming resource (although it doesn't help with Cocoa). the OS X programming environment is substantially the same as the NeXTSTEP/OPENSTEP environment. they're both based in Objective C, and even many of the windowing calls are the same (most of whose names still begin with "NS" for "NeXTSTEP"!).
Hot cocoa is made with cocoa powder (2 tbs each cocoa and sugar per 8 oz milk). Hot chocolate is made by melting chocolate in milk. (IIRC)
Best Slashdot Co
you dirty troll. Apple chose Objective C because the design they jacked for OS X, that of Steve Jobs' NeXTSTEP operating system, used Objective C.
aside from that, calling Objective C a "kludge" while suggesting C++ doesn't make much sense if you think about it.
have you ever even used Objective C? it's really quite nice, and you can program in ANSI C on an Objective C compiler and it's no big deal.
Two resources I've found useful in Cocoa programming are stepwise.com and O'Reilly's Mac Devcenter.
Lies about crimes
Apple's Cocoa or cocoa, the computation in commutative algebra system?
What the heck? Objective C is a kludge, they should have used C++, the kludge of all kludges?!
Not that I'd mind if the API were in C one bit--but I guess that's what Carbon is for.
Syntactically it is a kludge, the objective part doesn't obey any of C's syntax rules. I'm no
great fan of C++ myself but at least something like "class fred {" is an obvious extrapolation of
"struct fred{ ]".
And no I've not coded in Obj-C but I've seen code and that was enough to convince me not to bother
and thats ignoring the fact that its a virtual irrelevancy in both the Unix and Windows worlds
so career wise these days its about as much use as learning ALGOL or PL/1.
hot chocolate, IMHO
And it doesn't really have anything to do with OS X programming, so it is offtopic.
And why exactly would you want so set the mouse position? I don't want any program to control my cursor, because it can get VERY confusing and annoying. Playing with the input device of the user is a major UI sin if you ask me.
I'd say thats the reason, why Apple didn't include such functionality into the API.
-- The plural of 'anecdote' is not 'data'.
For anyone interested in developing for Apple's platform, the Apple Developer Connection is an indespensable resource. I haven't read the O'Reilly book on Cocoa, but I suspect that, since it was written by Apple, most of the information there can be found, for free, on Apple's site. Apple has provided well-documented APIs, sample code and several tutorials for both Objective-C and Java (despite what the reviewer said, check here). Also, for those who want to develop for Mac OS X, once you have it installed, and the developer kit from Apple (after all, you won't be able to develop without it), you will find that most of the tutorials, API documentation, etc. are on your hard drive. This includes extensive documentation on the changes that Apple made to the BSD development tools (gcc, gdb, ld, ...).
In short, my point is that if you are already familiar with programming in C, C++ or Java, you don't need a book to learn Cocoa. The information is all provided for free by Apple.
I prayed about it, and God said, "Don't do it!" But I thought, "I know better."
Well, maybe not, but as a everyday user of OSX its easy to see how Cocoa apps are the future. They interact better with the OS, they seem less bloated, and they just seem tighter. Cocoa apps like Okito Composer are compelling reasons to move to X... it blows away MS Word.
"Smokey, this isn't Nam, there are rules." -Walter
For each cup:
Mix 2 tbs cocoa powder with 2 tbs sugar.
Slowly add 8 oz milk while stirring.
Heat on stove, but do not allow to boil!
Add 1 shot of either orange liquer, creme de menth, or Irish Cream.
If you don't like those froo froo 'liquers' but instead prefer real liquor, add 1 shot Southern Comfort Bourbon or Rum
Best Slashdot Co
Because OS X inherited from NeXTSTEP and that in turn used Objective C. Why fix what ain't broken?
-- The plural of 'anecdote' is not 'data'.
My dad just got a new G4 with OSX on it. He wanted to network it with his Win2K box so I thought I'd just build Samba on it. After I figured out how to get root on it, I discovered the most basic UNIX tools were not there (e.g., Make, gcc, etc.). There was nothing on the disks that shipped with it, so I went to apple.com and what they put you through to download the GNU tools is unbelievably bad. I like OSX, but it seems to me if they want people to develop for it they would want to make it easy to get the tools to do it. I had to fill out form after form after form and at the end there was still no obvious link to download the GNU tools. It was late and maybe I was just tired, so if anyone knows an easy way to get these let me know.
Yes, now let's all hold hands and thank our savior Steve Jobs for taking away functions which might confuse simple folk like us. His superior judgement shines through here almost as much as his continuing decision to force one-button mice down our throats lest we get baffled.
You can set the mouse position through Core Graphics. No, it's not Cocoa per se, but the CG APIs can be called from Cocoa. "Direct access to memory registers" isn't required.
The review is right. It's not layed out well, it's difficult to navigate. Worst of all, most (if not all) of the examples from the book are taken from Apple's web site. Save yourself some money and time and get the book by Aaron.
Ahh my first computer. The COCO. 16k of ram, cassette player for storing programs, 300 baud acoustic coupler. Ahh yes. Oh wait, COCOA - nevermind.
Don't Tread on Me
I hope thatthey include more languages as OS X matures....for now, they have carbon, but I bet they will begin to add cocoa support for C++ and others when they want to make the transition from both carbon and cocoa to all cocoa.
I am the Alpha and the Omega-3
OS X supports the second mouse button dude, as well as scrolling.
I am the Alpha and the Omega-3
No it's not a "marketing thing." If you know anything about OO and Java programming, it's actually very easy to write a Swing program that uses the Aqua look and feel. And you can place Cocoa-access code in its own objects so that you can remove / change that code later.
I find that it's actually very good for prototyping complex GUI apps. And the reason there isn't much information about it is that the Java API is simply a name-for-name bridge to the Objective C api. The objects (almost all of them) are provided in Java as bridges to the actual Obj C objects.
They essentially did the Visual J++ thing but they did it __right__. Their classes are in addition to the Java 2 platform, not a sneaky replacement for it. I personally wish __more__ vendors would provide platform-level access in bridged Java classes.
"I think there is a world market for, maybe, five computers." __ IBM Chairman, 1943 __
For those interested in learning Objective-C (assuming a working knowledge of C), look no further than
this PDF.
Slashdot's first reaction to VMware
Add a touch of ceyenne instead of the booze. It will intensify the Cocoa. Trust me, it does work.
This comes from Central America, it is not my idea.
photosMy Photostream
...and it's Mac OS X Developer's Guide by Jesse Feiler. It's probably best described as "a developer's introduction." It is very broad, covering topics from the Mach kernel to the Interfact Builder. It's at least worth a look.
Java applications that only run on Windows are *bad*, and Cocoa-Java apps are... well, no one said they are good per se, but you'd think Sun would have to object on the same grounds. 'Cept that it is Apple.
But you'd think it's Unix, too, so it potentially steals market share...
ZOMG I WOULD LOVE TO KNOW ABOUT YOUR FEELINGS ON MACINTOSH VERSUS WINDOWS, VI VERSUS EMACS, AND HOW YOU'RE NOT A DORK
This page contains a list of applications that are either already Carbonized or Cocoaized or are in the process of being Carbonized or Cocoaized. Check it out at Xappeal
Support Texas Troops use TXGoogle
IMO, there's a MUCH better book on Carbon programming out now, which is about 1.75" thick and darned heavy - I think it's called "Carbon Programming" or vice versa... D'ohhh.
Keep in mind, too - what the difference is between Cocoa and Carbon. The former being Objective C (object oriented and much like C++) and the "real deal" for MacOS X programming, and the latter being based on C. The benefit of the latter being that it will run on either MacOS 9 or X. Then again, there's higher level languages that you can use like RealBasic or Applescript - or hell, Perl. :)
Be sure to check out Everything Mac for loads of MacOS X goodness.
There is work being done to let Python be another Cocoa language by enabling python to access Objective-C objects. This is a great idea as it would let Cocoa apps be built and prototyped very fast.
Even if you don't favor making your releases in Python few people disagee that Python is great for rapid prototyping.
If you are interested in helping out visit the sourceforge project where work is just beginning on a rewrite to take advantage of Python 2.2's new class/type system.
I can't spell or type, but that doesn't mean I'm unusually stupid.
ANSI C on an Objective C compiler and it's no big deal.
Uh, the same is true of C++.
calling Objective C a "kludge" while suggesting C++ doesn't make much sense if you think about it.
Sure, this is true. They are both C + OO kludged in.
So, Objecive-C and C++ are both backward compatable, OO kludges of C.
You haven't made much of an arguemnet for either one over the other.
OTOH, Objective-C is used by . . . Apple. C++ is used by "everyone" (I suspect this includes Apple).
Bottom line is that there is no rational reason to use Objective-C. Clearly this is a case of Not Invented Here on Apple's part. (AFAIR Objective-C is a NeXT thing, but six of one, half a dozen of the other; it's all Jobs.)
-Peter
I suppose that "private:" is an obvious extrapolation of "case:" as well. Objective C++ doesn't extend the language as much as C++.
One of the big problems with writing GUIs in C++ is that the type system gets in the way. The kludges neccessary to support a GUI system on C++ are infamous. Most systems resort to macros. GTK-- uses templates. QT uses a preprocessor and language extensions.
Well, I understand they've already added Objective C++. I wouldn't be surprised if they added more in the future.
$x='S24;r)>63/* h@<5+oZ)32"5cz';$me='phroggy'x$];
$x=~y+ -xz+\0-Tx+;print$_^chop$me for split'',$x;
There are tons of posts here saying Objective C has an ugly syntax.
;), but these people are too ignorant or blinkered to realise this.
.NET runtime or at least the Base Class Libraries. C is limited without sdtlib, C++ needs the STL or on MS platforms (shudder) MFC to get the full benefits.
What they mean is it doesn't look like C and C++ and Java.
Of course, how it looks has no bearing on how useful a language it is (heh, think Perl
Who cares what the syntax for calling a function is? So long as its not 3 pages of code its irrelevant.
Do we see any insightful comparison of the truly powerful language features from these people? Do we see discussions of how C, C#, C++, Java and Obvjective-C's approach to types and bindings work? How they support dynamic behaviour?
eg, I'm prepared to state that Objective-C makes generic types unnecessary, whereas C++ relies on them and Java is introducing them (slated for JDK 1.5). This is a good thing in C++, will be a good thing in Java, and I expect to see them in C# one day, because of commonality between how these languages are defined. Objective-C doesn't need them, it has another solution, more akin to Smalltalk.
We don't see this sort of comment (shallow though my example is) from most of the posters here because frankly all that they're experienced enough to comment on _is_ the syntax.
Even all that said - the features of the language pale into insignificance next to the quality of the class library. Java is nothing without the java.* and javax.* classes, C# is useless without the
This is a review of a book about Cocoa, not Objective-C. The class library, not the language. The class library will dominate any concern over the language used to program it. Learning a language takes days (or weeks if its something completely new to you like your first declarative functional or logical language). Learning a class library can take months or years (depending on the size).
Do yourself a favour and learn some more languages. Learn about languages. Use real class libraries. Then open your big mouth!
Lord Pixel - The cat who walks through walls
A little bigger on the inside than out
Cocoa handles other object-oriented languages: C++, Java.
Then your opinion is worth much less than those of us who have. Objective-C is more flexible, powerful, and easy to use than C++. Cocoa could not be done in C++ because it lacks the dynamic runtime of Objective-C.
How to solve most of our problems: 1.Lots of nuclear plants. 2.Cure aging.
But now that Red Hat is doing it, Slashdot refuses to tell the story. In fact, I don't believe I've ever had a submission get rejected so quickly.
Perhaps Slashdot is Red Hat's little bitch.
But anyway, here's the story. Red Hat is not allowing people to distribute Red Hat Linux. If you do, they insist you call it something else. A clear violation of the GPL if I ever saw one. I guess if its someone like Red Hat or VA, they can violate the GPL as much as they want and Slashdot could care less.
Objective-C was done by Brad Cox of Stepstone first. NeXT licensed it from him and later purchased it in its entirety.
:(
You should be able to find some articles by Brad Cox in back issues of Byte in a decent library, but his book on Objective C is long OOP
William
Sphinx of black quartz, judge my vow.
If you don't want to learn Objective-C to program in cocoa, you have other options. There's Carbon (C++). Cocoa will just dramatically speed up your programming. For Cocoa, there's also Java, but most people seem to prefer Objective-C.
Read about it here
Too bad you can't buy a computer from Apple without paying for a one-button mouse, though. Thank you Father Jobs!
If you want to know more about objective c, or to prepare before reading the books above, or to gain more depth of understanding of the language if the chapter or so spent in the above books doesn't explain enough, then look no further than this:
Object Oriented Programing and the Objective C language. Originally a Next Step book, now available free (HTML/PDF) at Apple.com or thru print on demand at Fatbrain.
Lord Pixel - The cat who walks through walls
A little bigger on the inside than out
Many games need to move the (hidden) mouse pointer to the center of the screen.
ALGOL? Stick to the subject. If you want to build Mac OS X GUI apps fast, learn Objective-C. It's just that simple. Like the reviewer and the author says, if you know C and C++, learning Objective-C is trivial.
Too bad you can't buy something without paying for it! Thank you captain capitalism!
FreeBSD - the power to serve.
Objective-C adds very little actual syntax to C, whereas C++ adds a whole bunch. C++ is the kludge to end all kludges, Objective-C does is far better. Have you ever done a project in Objective-C, or are you just another slashkiddie talking out his ass?
Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
You moron. Michael Simmons (Author of said book), is not referred to on that site.
That's Michael Sims, the Slashdot 'journalist'.
"I can't give you a brain, so I'll give you a diploma" - The Great Oz (blatently stolen sig)
You have no idea what you are talking about. Cocoa could not be done in C++. (Yes, Turing equivalence, I'm talking in practical terms here.) Cocoa depends on a dynamic runtime for much of its power, which C++ does not have. Simple example: given the name of a class in a string at runtime, instantiate an object of that class. One line in ObjC, not possible in C++. Another example: given an arbitrary object and the name of a method, determine whether the object has a method of that name, and if so call it. Trivial in ObjC, not in C++. These dynamic capabilities are used throughout Cocoa, and that is why a dynamic language such as ObjC or Java is required to use it.
How to solve most of our problems: 1.Lots of nuclear plants. 2.Cure aging.
There's a free ~40 page tutorial + sample code available at http://www.areax.net that covers both an introduction to Objective-C for C++ programmers as well as Objective-C++, the new (well, recently revived) language that lets you use C++ libraries in Cocoa. Check it out! link
the "MAC" in MacLisp stands for "Multiple Access Computers", the department at the MIT AI Lab in which MacLisp was developed.
MacLisp was developed in 1966, over ten years before Apple Computer got it together.
Why is that a kludge? The STL uses templates too, but I'd hardly call it kludgy.
Apple's GCC support ObjC++, meaning you can mix Objective-C and C++ code in the same application. However, you cannot call/instantiate Objective-C classes, objects, and methods from C++, just have both languages in the same sources.
I for one am glad Apple stuck with ObjC. It's good to see that at least one company has the balls to choose what is good rather than what is popular. I was scared for a little while- Apple made WO5 Java only, and I'm glad they didn't pull that on Mac OS X as well.
As far as other languages, you can program OS X in a bunch of them. Quite a few languages have Carbon bindings, and there's no reason you couldn't write a binding for you favorite language- Carbon is just C. If you're already using another language, you don't really need a binding to Cocoa, rather than Carbon.
Python, and F-Script both have Cocoa bridges.
Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
Bottom line is that there is no rational reason to use Objective-C. Clearly this is a case of Not Invented Here on Apple's part.
I'm not a particular fan of either language (C++ or Objective-C), but the NIH accusation is simply false.
Objective-C was invented by Brad Cox in the mid- or early- 80s, and was intended to bring Smalltalk-style capabilities to C. It was later adopted by Next. Since they now have tons of legacy code in Objective-C, they have a strong rationale to continue supporting it.
I'm thankful for a clear review of a book that has proved very useful. Its always hard to attract a broad audience without alienating someone yet "Programming Cocoa" has achieved a nice balance. And the reviewer is right: The frameworks are extensive (the usual learning curve) but you will be surprised at how much is taken care of for you - if you don't choose to override it. Other nice sources for programming Cocoa are Jesse Feiler's new book "Developing for OS X" and a fine series of articles geared toward newbies (but not without solid insights) at O'Reilly Mac Devcenter written by Mike Beam.
same reason they selected pascal for the mac api, they were a bit ahead of the times and no strong contender emerged from the pack. at that time the world hadn't yet decided between pascal and c so they were forced to choose... whoops!
:-) i certainly know a number of professors who follow that mantra!
when NeXT created open step no strong OO language existed so they had to choose one. Obj-C was chosen... whoops!
in hind sight it's easy to say: "why don't they use the most popular language?" but at the time these decisions needed to be made a clear winner hadn't yet emerged.
the mac api did have a c binding but you had to specify a pascal binding to all your functions and you had to be aware of some of the subtle bugs that might show up if you forgot a handful of golden rules.
kinda feel sorry for them though. i would've liked to program a bit on the mac but with all the projects to choose from i'm happier finding work in something i already know and am comfortable with.
although i guess one could make the point that at the time it was becoming more clear that c was probably going to become more popular and you could also say that during NeXT development c++ was gathering more momentum. maybe the people jobs traditionally hires to make these decisions feel "dirty" for using languages the general programming public has a perference for?!
How much of this is applicable to GNUstep or NeXTStep? Any of it?
-- Ed Avis ed@membled.com
the fact that objective-C's additions to C look completely unlike C is a *feature*,
because the object oriented stuff is completely orthogonal to C.
defining classes, creating objects, sending messages - C was not intended to allow you to
do any of these things.
The approach C++ took to making an OO language was to take C and try to extend its features into OO ones. the result, IMHO is often inconsistent and unnatural.
the approach Obj-C took was to declare from the outset that OO programming was genuinely different from C programming, and so its syntax should be different.
Obj-C is a very simple language. it actually adds very little to standard C.
certainly a lot simpler (both to understand and compile) than C++!
First we had Java Beans, now Cocoa Puffs?
Ignorance is the root of all evil.
I much as I dislike community-bashing, I have to agree with you on this one. The final exam for my programming languages class in in two hours and this course definitely opened my eyes to the irrelevance of syntax.
I only knew C/C++ before taking the class. At first glance, languages like ML, lisp, and Prolog seemed ugly and stupid. Then I made a fully functioned binary search tree in 32 lines of ML code (including comments). Or how about a program that does symbolic derivation and integration in 50 lines of Prolog. The syntax didn't matter. I just adapted my programming style and got some rather impressive results.
Syntax doesn't matter when it comes to the power of a language. Just because Japanese has a subject-object-verb sentence structure and complicated verb conjugations doesn't mean it can't express the same ideas English does. After some practice the grammar and conjugations come natural. Learning programming syntax happens the same way.
Okay, I'm rambling and should be studying for my final.
so this is the first community developed patch for the opensource cocoa project :)
Apple have just released the latest version of their developer toolset (probably not available for non-seed download yet) and the main new cool thing is full support for writing Cocoa apps in AppleScript (AppleScript Developer Studio).
This is a very cool thing. For people who haven't heard of / used AppleScript before - it's a HyperTalk-type language (i.e., very verbose, almost natural language) that can be used to externally control and script many Mac OS applications. You can now basically throw together applications very quickly that have complex UI elements and interact with other applications and system components.
A neat feature is the ability to mix-and-match ObjC and AppleScript in the same application, so you can rapid prototype in AppleScript and then code complex sections in ObjC.
Hats off to Apple for throwing so much effort into a (IMHO) much overlooked technology. AppleScript is the key piece in a lot of custom workflow systems, and now a must-see for those who miss the old HyperCard days.
"Shit, I just tried to post a witty reparte in Japanese and the FUCKING lameness filter prevented me; said I'm using too many caps. (Obviously Slashdot is fucking USELESS when it comes to UNICODE. Not that I'm surprised, knowing the quality of the so-called programming talent behind this site.)"
or maybe you lie about your ability to actually speak Japanese let alone write it? Just a thought
The death of one man is a tragedy; the death of a million is a statistic --Joseph Stalin
I've had two decades of programming in the C and C++ world and have only played with Objective C for a couple of months, and it's already clear that Objective C has some very powerful advantages going for it.
It has a dynamic structure that lets you do some things that cannot be done in most other OOP languages I've used. In Objective C you can reference a class or method by it's name, in a variable string if desired. You can create an object of variable class. You can have a piece of code which can examine an object of unknown class to see if it supports a particular method, and if so, call that method. You can compare a class name against an object to see if it's that class or a subclass. This is all powerful stuff.
Add to that the tools Apple provides to build interfaces, which rely on those dynamic features, and you end up with one of the fastest mechanisms for building new applications I've ever worked with. This wouldn't work well with C++ or C by itself.
Given that, I can live with the relative ugliness of the language. (And C++ has its own ugliness -- look at the template syntax... Yecch!) It's also a very easy language to learn if you know C.
Sie wissen dAS fuhurer DOS nicht wie fröhliche Leute. Und Sie saugt nur fucking.
Jeez! You're funny, but this is much too shallow for the average slashdotter to not recognize as an obvious troll. Keep trying though, you're new here as a troll, so I guess you've got some learning to do on how to effectively troll for Karma. Dumb-ass. Hahahaha!
Objective C has a dynamic runtime, C++ does not. This one difference makes ObjectiveC a much more powerful language.
"(This is on topic because it's nearing the Xmas season...) Is it "hot cocoa" or "hot chocolate"? What's the difference?"
Hot choclate is really more of a water based beverage then you add powder. Hot cocoa really (at least for me) is more like a milk based one.
Hope that helps.
"Objective-C is uglier than Brainf$ck. Is there any reason why they chose Objective-C over C++? "
Reseume building?
Did you know that there is a nice little guide that discusses object oriented programming in straight C? really cool.
The death of one man is a tragedy; the death of a million is a statistic --Joseph Stalin
C is a very nice, compact, clean language. People have historically abused it and produced ugly code, but for a well disciplined programmer, C's a dream. Except that it's not Object Oriented.
C++ was designed by committee. Its most fundamental spec is that it is insanely strongly typed. Templates are a hack to bring dynamic programming to a strongly typed environment. Exceptions are a hack to provide messaging in an environment that doesn't allow object A to talk to object B without knowing what the type of B is.
Objects that communicate with each other is the most fundamental thing in object oriented programming. You can't drop foreign objects into an OOP system when that system needs to know the exact type of those objects- prepare to start editing code. Great code re-use. C++ does NOT offer code re-use anymore than C does.
You like Qt's slots mechanism? They're a hack to give C++ something that every other OO language (inc. java, but not easily) can do naturally, make two objects talk to each other without knowing their type!
Objective-C is a dynamically typed object oriented programming language, which is a much better setup for OO programming. There's only one core syntatic addition to C, and that's to support OO programming. Not the billion-and-one keywords and obtuse syntaxes that C++ is full of (just how do you overload that operator again?). The syntax you describe is the best part. Compare this code,
object->runProcess(processType, duration);
[object runProcess:processType untilDate:time];
Not the greatest example, but the point is that you focus on the messages that the objects are sending to each other (which are very descriptive in Obj-C), not the types of the objects (which in many cases in OO programming, is irrelevant, unlike procedural programming). Compiler warnings of 'unrecognized selector' (unrecognized method) are more valuable than unknown type.
The sad thing is, I didn't think there was much wrong with C++ until I started using Objective-C several years ago. I just thought, that's the way OO programming is. Take a stab at smalltalk (www.squeak.org), and you'll see just how different things can be.
Moderators should have to take a reading comprehension test.
Apple does not include the compilers in the default install. The retail box of Mac OS X includes them on a seperate install disk. If you order a new computer, you don't get the disk. I wish Apple would change that.
However, I would not say that what they put you through is unbelievably bad. You go to ADC, get a free account, download. Sure the website could use a nice reorg so it's easier to find the tools, but it's not _that_ bad. It's much easier if you know that you have to sign up for ADC first.
I've heard though side statements from some developers (not directly from Apple, and not directly to me, I've no inside info from Apple at all) that the reason that Apple does not include the dev tools by default is that Apple does not want to make GPL software part of the default install to avoid any possible license conflicts.
Apple's being paranoid, but it is their property that they'd be risking if someone claimed that the GPL tools pulled in the rest of OS X and source needed be released. Apple does support Open Source projects (including GPL Software), so it's not like they are so paranoid they won't use it at all. I don't know what Apple does for Mac OS X Server.
I'd like it if apple put a shell script in place of cc that gave instructions on how to get and download the tools. It still would be a pain that the tools aren't there, but at least anyone using the tools would know what happened, why, and how to fix it.
To bad people can't shut upo about the one-mouse button thing... go get yourself a damn MS mouse with 50 buttons and a scroll wheel.. plus if you knew how to use a damn mac you wouldn't need any buttons or a mouse for that matter....
-Thanks Mr. Jobs for all the whiny 2+ mouse button people
You don't need to move it, just to hide it (call HideCursor). Moving the cursor, e.g. to bring it on top of the OK button in a dialog, is confusing to the user. He/she should have complete control over it. This is not Steve Jobs gospel, but years of UI research at Apple. Ask Bruce Tognazzini.
the mac api did have a c binding but you had to specify a pascal binding to all your functions
To the extent that this is sort of true, it is still true. Pascal has a different stack convention from the one in C. The convention that Pascal uses was shared by most other languages at the time, but C originated as a system language. C is organized such that functions like printf could take a variable number of parameters using a kludge involving pointing directly to the stack.
However, C and C++ compilers for the Mac all accept the "pascal" keyword, which is included in all the header files for the API. Besides that, you can ignore it, except in the special case where you need to pass a pointer to the API for a callback function. Then you need to declare your function as pascal, too. You have never had to declare all your functions pascal.
Also, the majority of the API calls are not bindings in the strict sense of the word. They use compiler extensions to produce inline traps in the code.
Moderate the parent up, it's exactly correct.
How to solve most of our problems: 1.Lots of nuclear plants. 2.Cure aging.
Does everything in the Unix world have to have "g" in front of it for you to know what its called?
Here are some more books on MacOS X / Cocoa / Carbon Programming:
.. and you can develop "X-only" applications with this)
Java: "MacOS X Java" Wiliams, Albert, Hart, Hopkins and Steinberg, Wrox press. (Just got this one, reading it now)
WebObjects 5 for Java: A Developer's Guide (With CD-ROM)
by Jesse Feiler (Paperback)
Java & ObjC: "Mac OS X Programming" by Dan Parks Sydow (got this one on order)
Mac OS X Developer's Guide by Jesse Feiler (Paperback) (this is an OK text, some good examples with ObjC & Java, but lacks a lot of detail on many Cocoa topics)
Mac OS X Carbon Developers Black Book (With CD-ROM) by Dan Parks Sydow (Paperback) (don't have this one)
REALbasic: "REALbasic: The Definitive Guide" by Matt Neuburg (good book, but only covers development with REALbasic
They're adding Applescript to the development tools right about now.
It's supposed to be a free download from ADC this week.
DB
Steve Job's NeXT Step was 500% better than this new Crap from Apple.
They butcherred it all.
The NeXT was great. It was nearly perfect, though one time I had trouble using their standard tools compiling a program that had one file name with ASCII spaces in the file name.
That was so many years ago I am sure that one defect was fixed.
But Apple killed off "Yellow Box" NeXT Step after shelling out nearly 400 million dollars to buy it.
They broke it dead. It worked on most pc midi sound cards, most pc network cards, most good scsi cards, most common video cards, etc etc.
It even had a huge shared 20 megabyte file that allowed your NeXT Step programs to run on Windows NT and Windows 95.
It was glorious.
Then they (apples morons) ripped out the OS, added incompatibility and byte endian order nightmares at the CD-ROM and hard disk volume level (pre 1997 NeXT Step OS stored all file data in only one endian order not two)
Then they broke the ability to compile for chips easily emulated on intel such as the MC68030 code the tools used to support perfectly.
Then they decided to kill and break everything, butchered display postscript to avoid adobe lawsuits, renegged on every promise to developers, never released a working carbon 1.0 according to official spec promised to Board of Directors at Apple and Shareholders.
(Carbon 1.0 was promised to run on System 8.0 and offer SCSI commands and many other services apple nevber got finished without crashing or at all).
Carbon 1.0 (whatever number you want to use) never shipped.
Read the official original spec Apple promised if you do not believe me.
No wonder Mac developers I know now program Windows Win32 stuff nowadays.
Apple killed the OS by making it slower and slower every year. And then the death sentence... Mac OS X is buggy and so glacially slow of a UI that apples "equal opportunity" "quata" based hiring must have really paid off.
Cocoa takes a damed ETERNITY to launch a hello world and blit a pixel or two to the screen.
Cocoa is pure bloatware crap.
The NeXT originally was so fast it was astounding. Truly stupefying.
Now its all buggy slow polled crap.
No interrupts, polled everything from the Carbon side of things.
They cant even play sound without skipping.
Heck, the first version of Mac OSX could not play sound from a pure RAM buffer without hiccups!!!
Its the most useless crap of an OS ever.
The best OS Apple ever shipped was System 7.5.5. It ran on everything and had no serious bugs or defects.
The best OS Apple ver bought was OpenStep. Too bad they never shipped it.
They should have purchased "Executor" for 20 million dollars and bundled it with OpenStep and shipped 5 years ago.
Apples is dead. Only making sure they support System 8.1 or 8.6 on all shipping new hardware will keep them afloat.
Otherwise people will just run Mac On Linux style emlators and VMWAre style hacks and Apple will be a footnote.
Even their hardware is cruddier each year. The Blue and White G3 Tower's ports write Firewire (IEEE 1394) data at only 50% transfer speed vs the read speed! Its limited by firmware.
The computer boots slower than a Quadra 840AV. (A old computer with awsome video blending and a much larger speaker).
The Blue and Hhite CMD ATA-IDE controller chip is buggier than all hell (random lockups and xfer bugs) if you try to attach a second hard disk on the same ribbon as the DVD drive.
The thing cant even boot from a RAM disk like all the older macs could.
The G4s are very fast, admittedly, and in Bytemark 2.X source code beat the pants of any intel processor up to twice the megahertz, always, and in parrallel vectorized code benchmearks the ingenious C-based language compilers make altivec code run circles around most photoshop plugins that Intel paid adobe to optimize.
But what good is a fast OS if all the offended MAc developers switch to MS Windows one by one, week after week from shame.
This is slightly offtopic, but Apple had another project called Cocoa which was supposed to be a visual programming language for kids to use. Anyone know about what happened to it?
Nice try, maybe next Apple article you can troll too!
Templates are not a kludge, so GTK-- being "forced" to use them isn't a big deal (in fact GTK-- is a very nice API -- it's big kludge is that it is really just a wrapper so if you write new GTK-- widgets, people using GTK in Python will have a hard time using them!).
Now I will admit that C++ is a pretty nasty language, and my minimal exposure with ObjC makes me thing that ObjC is nicer, except it lacks templates, and thus anything like the wonderful STL. Of corse it also lacks six different kinds of multiple inheritance (or seems to at any rate), which is a good thing.
Another example where Objective C outshines the hell out of C++ or even Java is for dynamic programming. A simple example is the proxy class. Have a class implement a particular interface at runtime and route all call to another class. Distributed environnement like CORBA need this a lot, but it is also usefull for debugging stuff.
In objective C, this is a breeze, in Java its tricky, and AFAIK impossible to do in C++. A simple example of the flexibility of objective-C, the implements is not a reserved keyword like in Java but an object method that can be overloaded.
See you at the next Apple article, troll.
"...but you can't do anything advanced with it..."
What do you consider not advanced? The ability to load classes dynamically at run-time with only one obj-c method calls? Or maybe having non-fragile interfaces in your base classes? Or maybe having the ability to determine if objects implement methods by introspecting by name? Or maybe serializing interface objects into nib files? None of this is very advanced for a framework that started life almost 15 years ago, huh?
And about controlling the mouse, why?
AW has historically published all of Apple's toolbox books, etc.
However, they decided to use OReilly for OSX and beyond (Apple wrote and edited the book, OR just prints & binds it). It's really just the newest Mac Toolbox book, which is why it reads like one.
Which makes it interesting for a 3rd party OSX programming book to be published by AW!
Hmmm and we can start removing buttons from everything because it is easier.
JEEZ you are dumb. Imagine trying to use a microwave if you only had a +1 second and -1 second button.
Not only did two mouse buttons become usefull, but the third scroll/button has become invaluable. You can do more with less hand movement that way.
The only real reason why there is only one buton on a MAC is because the original ones couldn't handle a two button mouse. Why couldn't they handle a two button mouse? Because when the mac was developed it was rushed..... That is the reason it had only 3 colours, black-white-grey.
Real computers like the Amiga and the Atari ST took longer to produce, and had much more flexibility and power. But as Microsoft and Apple has shown us, good products can die and crappy ones can live!
The only thing worse then windows 3.1 is a MAC. They were the crappiest peices of crap that I ever had a chance to use. And I have used alot of crap in my life.
Er, sort of. There is one new "call syntax", which includes new syntax for unordered arguments as well as calling through an object. There is one new preprocessor macro to replace (or at least augment) #include. There is a whole new declaration syntax for objects as well. That is more like three things. And it may be as many as eight.
Now that doesn't compare to C++ which is described in less detail by a book 5 times as thick as K&R C, but it is a little more then one change.
(and having used both, I miss some of the C++ stuff, but not as much as I'll never mind is gone)
Also, add a beaten egg to thicken it up a bit (actual Mexican recipe)
perhaps was a mac pre 2001/2002
today, the mac is very nice...looks good, operates realy good, and the OS is powerful and stays out of your way.
I am the Alpha and the Omega-3
Let' see. Send a system wide notification to ANY application thats listening, including a dictionary (HashTable of information) NO RMI stub bullshit.. That would be ONE line of code
Publish an Object so it can receive distributed method calls from other applications ala CORBA.. (again NO stub bs, no real need to even know object type or the methods it can respond to as those can be discovered at run time. ) Ah. That would be two lines of code.
Connect to and message that object from any other app. 1 line of code (two for error checking).
Include basic printing, editing of a scrolling text object WITH control over fonts, color and automatic connection to other SYSTEM services like spell checking... NO lines of code.. it's built into the IDE.
Yep.. Very cheesy, weak ass OS.. Hardly any power. Can't do squat..
I've been using ObjC as delivered by NeXT and now Apple for about 12 years. So I WON'T take your word for it, because you don't know what the hell your talking about.
Worse than MFC.. I don't think so.. Try this with MFC, ADD a method to the Window class. No I didn't say subclass window.. add a method to the actual window class.. You can't do it. Why? Because you don't have source and C++ doesn't have catagory methods. ObjC does.
All stop here, cause I have about 50 more examples.
I think templates are actually the right solution-- but of course, GTK-- is forced to wrap around C. At various stages of it's development, it seemed as if the GTK-- writers were a little too weeded to the STL. Sorting and searching menubars is of limited practical value...
Because Objective C is not strongly typed, template objects aren't needed. On the other hand, the algorithms that the STL provides are also missing.
I really find myself missing the ability to overload operators, though. Overloading Objects is really useful for scientific computing. Writing a RK4 solver for systems of differential equations without operator overloading is more than a little messy.
Translation ala babelfish:
"It receives first point under the light it will be extensive in your speed and agility there is the first which it does to me, permit. In order to attain the top of the rainwater inside our arrangement ability us by your specialty and will decrease a gratitude motive. Truly, candle call leys by the item which puts out a taste it expresses a pleasure, is a value. Again, the barn as soon as in your first point of the rainwater. Our fields which it spreads out all it is a beaconing of ability"
Glad it only took them 15 years to figure out that strange 'more than one mouse button' paradigm.
Dyolf Knip
And why exactly would you want so set the mouse position?
A sin you say? And that's why Apple didn't include it? Ha! You try porting a popular game from Windows to your precious Mac platform without the ability to set the mouse position... Don't flame me, just try it... you'll be pleasently surprised.
---
Programming is like sex... Make one mistake and support it the rest of your life.
Yes, easy & poweful for the right projects.
Don't confuse "OSX" development with Cocoa development.
I'm working on porting a huge application from OS9 to OSX (macho). We're staying in C++ and it's pretty tough.
Our diags guy, however is writing tools from scratch in ObjC/Cocoa. - it's a breeze.
What are you talking about "direclty accessing memory registers" ? You can't do this on any system with real protected memory. Sounds like you don't know what your talking about, oh except that Apple == crap...
-Simon
Bottom line is that there is no rational reason to use Objective-C.
Next selected Objective C for a reason, dynamic binding. Also, when Next started writing the Nextstep API's 15 years ago, C++ was still very new, not ANSI, not well defined, kludgy, and it had as much mindshare as Objc-C. In those 15 years, things have changed.
Wanna bet? Get the book Design Patterns and learn about object factories.
'The other Cocoa' eventually found a new home and became known as Stagecast Creator.
-Mark
- Hide the system mouse cursor
- Instead of "moving" the mouse cursor, keep x and y offsets from the actual mouse position to a new "translated" mouse position.
- Use these translation offsets when reading mouse coordinates, and for drawing a mouse cursor on screen (wrap that in functions or macros and never have to think about it again)
Most games draw their own mouse cursors anyway, so the hard part is already done.That was so easy... I'm pleasantly surprised, just like you said.
...I take it all back. That won't work. :)
If the mouse is 10 pixels from the left edge and you translate to the center of the screen, you'll never be able to move the mouse farther left than 10 pixels from center.
Did they release that finally? From what I've read, it's pretty cool. I've been dying to have a look at it. AppleScript is way too verbose, trying too hard to be like English for my tastes. But if it will let me hack together quick GUIs and script Cocoa objects, it'll be more than what I could want!
Another great thing about AS is that it supports SOAP pretty slicklike. With the intrinsic SOAP support, I could throw together a GUI and some other AS functions, and call the more intensive logic of the app written in another language that supports SOAP.
Working toward a usable PDA environment in the spirit of Newton OS: Dynapad
On the other hand, this has everything to do with trademark law. Red Hat is a registered trademark, and therefore if they don't want anyone else to use it, they don't have to.
You can stil reproduce RedHat ISOs verbatim...just don't call it Red Hat...call it something similar...if people are too stupid to figure it out, they are WAY too stupid to use linux in the first place.
Slashdot, the site where everything's made up and the points don't matter
Who the hell uses the cheap mouses that come with any computer you buy? I use my two-button optical mouse just fine under OS X. And I have had to buy one for all of my Intel boxes as well.
That will work fine. Its possible to obtain using, I think cocoa, or at least carbon events, what the mouse delta would be assuming the cursor was not on the edge of the screen.
(offtopic) I always thought Be did a nice job using BMessage and BMessenger type objects for their GUI API. No language extensions or ugly macros necessary, since a BMessage is really the only data type you'll ever need :^)
I don't care if it's 90,000 hectares. That lake was not my doing.
Actually, Java does support Dynamic Proxies. Check out this class, this Javaworld Article, and this overview at sun.
ebw
'==' is an evaluation, not an assignment.
"C++ is the kludge to end all kludges"
All higher level languages are kludges. Anything above toggling 1's and 0's, including assembly, is a kludge, otherwise why would you have to translate (read assemble, or compile) it, link it, or load it?
There are many kludges in the world that lengthen and alleviate one's otherwise short and brutal life.
The problem with dynamic typing is that its not as fast as static typing. I'm writing a bunch of numerical code (for scientific research and consulting), and I use C (or C++ sometimes) but never Objective-C...when you need high performance, you want everything static if possible.
Of course, the happy middle ground is to write all the computational code in C/C++/Fortran and then make a nice GUI with Cocoa/Objective-C.
All is Number -Pythagoras.
With an introspective runtime, you can do it without hardcoding any references to the specific class names into the source. How do you do that in C++? Note:
if(classname == "Foo")
class = new Foo;
else if(classname == "Bar")
class = new Bar;
...
doesn't count.
Have a look at his web site at
http://www.bignerdranch.com/
He's been in the business of training people on OpenStep and Cocoa for quite some time.
-jcr
The only title of honor that a tyrant can grant is "Enemy of the State."
You know, watching these Objective-C vs. C++ is interesting. In general, the Objective-C supporters also have a lot of experience with C++ too (who doesn't?), but they prefer Objective-C. On the other hand, the people defending C++ are generally the ones who themselves have not done any substantial development in Objective-C. So perhaps it says something that the people who have used both languages extensively tend to prefer Objective-C?
Much in the same style as Visual Basic, or RealBasic...
or if you're a Mac oldskooler.........HYPERCARD!
I always thought Apple should have taken HyperCard and just upped the technology, I mean it still ran in black & white until the day it died (96? 97? Too much ganja...), it was an amazing piece of software WELL ahead of it's time featuring things like user-authoring of programs and full scriptability, and even things we take for granted today such as hyperlinking! Everything from custom databases to slide shows, and even games, where created for it. I even saw a LaserDisc player-controlling stack once!
APPLE! BRING BACK HYPERCARD! ;-)
If you don't I really am going to go STAK-WILD
CAn'T CompreHend SARcaSm?
on clicked theObject
end tell end clickedI tried to do it in Objective C about a week ago, and I gave up just because it's too complicated.
Actually, the reason why the mac mouse had only one button is that the guy who first started the Macintosh project at Apple, Jef Raskin, thought more than one button would be confusing to people (he might have actually done some usability testing to confirm this. I'm not quite certain). This seems like an oversight today, but remember that in the first years of the 80's when the mac was being designed, you didn't really have mass produced computers making extensive use of *any* pointing device as part of their basic UI. The concept of using a mouse was confusing enough with one button (see Star Trek IV if you don't believe me). Raskin had actually wanted a trackball instead of a mouse because "they don't pick up those oreo cookie crumbs that are the hallmark of a good programmer".
except that makes it much, much, slower than C++.
You think that's bad? After 30 years, the Un*x community still hasn't grasped the concept of giving system files names that are real english words, or for that matter using spaces between them. The mac (pre OSX) has had both of those since 1984.
That's wrong, you're talking about the regular ObjC. If you rename all your files to .mm, you will be able to mix both languages:
class myclass { public: myclass() { NSArray *array=[NSArray array]; } };
Yes, that is an issue with dynamic typing but that comes with the complexity of your app. Today's programs are far too complex to write in assembly, but assembly can be much faster. Static typing doesn't make things faster, that's just an implementation issue.
In Objective-C's case, only the first time you send a message to another object takes some extra lookup time. From then on, it's cached. It's just like using a virtual table. Object Oriented programming was NEVER designed for speed. That's the tradeoff. If you try to make a balancing act of that of speed vs. OO, you're missing the point and wasting your time. If you need the speed, write the back-end in C (but not C++).
As ESR has said in his Python introduction piece (I think it was in there, sorry if I'm misquoting), most programs nowadays don't even need compiled speed. 90% of the stuff joe user does is I/O bound, not CPU bound. Of course you can be a really sloppy programmer and waste the CPU, but that's not the language's fault :)
Moderators should have to take a reading comprehension test.
Hmmm and we can start removing buttons from everything because it is easier.
Straw man.
JEEZ you are dumb. Imagine trying to use a microwave if you only had a +1 second and -1 second button.
Ad hominem, followed by an ad ridiculoso argument.
The only real reason why there is only one buton on a MAC is because the original ones couldn't handle a two button mouse. Why couldn't they handle a two button mouse? Because when the mac was developed it was rushed..... That is the reason it had only 3 colours, black-white-grey.
3 falsehoods in a row.
The one-button mouse was a HCI decision meant to avoid confusing people. It's very well documented historically for those who actually read instead of making up nonsense. The development wasn't rushed, they just had limited resources to work with to make a more budget-friendly device than the Lisa. Finally, old Mac screens were monochromatic, like the vast majority of monitors in that day and time. They could only hand black or white. Though color monitors were available, but Mac team decided on a black-and-white screen to make it cheaper and to save on system resources. (Video took up 21K of the 128K in the original Mac.)
Real computers like the Amiga and the Atari ST took longer to produce, and had much more flexibility and power. But as Microsoft and Apple has shown us, good products can die and crappy ones can live!
These were later-generation computers that borrowed ideas from the Macintosh and had more resources to work with when the first versions of the OSes were created. The 128K limitation in the first Mac made the engineers make some tough compromises that would become legacy code that later computer designers didn't have to make. It's called progress.
The only thing worse then windows 3.1 is a MAC.
Obviously, you weren't using them both in the days of Win 3.1. The differences in functionality, stability, and power were night and day. The only reason Window won was that the price difference was also night and day.
They were the crappiest peices of crap that I ever had a chance to use. And I have used alot of crap in my life.
You sure seem to spew a lot of it too. (See, I can make ad hominem attacks too!)
If it's for-profit but free, you're not the customer -- you're the product (e.g., the Slashdot Beta's "audience").
> or maybe you lie about your ability to actually speak Japanese let alone write it? Just a thought
Chigau yo. Ore ga itta toori, kana de mese-ji wo utteitara, yappari re-munesu firuta- ni jama sarete, ore no po-sutingu ga abo-to sarete shimau yo. "DON'T USE ALL CAPS" to iu era- mese-ji ga dete shimau.
There, satisfied fuckface? I'd type that in kana, but Slashdot gives me the error message when I try. God, I hate little pissante know it all fuckfaces who are so easy to prove wrong.
Before some other fuckface points out the obvious, "mese-ji" should have been spelled, "messe-ji". I usually don't work with romaji, it's too grade 6.
There's a perfectly good reason why Unix keeps the system filenames obfuscated. It's to make us all look much more impressive to non-*Nix experts :)
Dyolf Knip
Yes assuming the cursor wasnt on the edge of the screen... So it works 98% of the time, except for the odd time when the cursor was at the edge of the screen. Then users would bitch that your game/program is buggy. When in reality its a limitation of the API that can be used on the Mac.
---
Programming is like sex... Make one mistake and support it the rest of your life.
As ESR has said in his Python... most programs nowadays don't even need compiled speed. 90% of the stuff joe user does is I/O bound, not CPU bound.
Scientific code is a special case, I suppose...I'm talking about code that takes days or weeks to run on a small cluster. The speed of C++ code depends more heavily on the compiler than the speed of C code does, but in my experience you can write good fast scientific code in C++, with a substantial savings in development and debugging time.
All is Number -Pythagoras.
Here are two ways that I'm aware of to do it without touching Low Memory:
Mac OS X Only -- CoreGraphics routines.
Mac OS 9 Only -- Cursor Components SDK.
I believe, however, that the only was I know of to do this on both Mac OS 9 and Mac OS X (10.1+ only) is to mess with Low Memory like you're probably talking about. I can't be sure, though, since you're misusing terms. Try the above links and see if they help.
If it's for-profit but free, you're not the customer -- you're the product (e.g., the Slashdot Beta's "audience").
Actually, not so!
I offer as proof the same size set of references you did.
You know, if we make the assumption that OSX developers actually want to be paid for their efforts, it will be interesting to see if OSX spawns more imaginative, innovative apps the Linux or the BSD's.
-- Slashdot: When Public Access TV Says "No"
and the sad part is that not enough people will know where that joke came from. Long live Mojo Nixon!!!
Hi,
iDevGames.com has an interview with the author, Aaron Hillegass of the Big Nerd Ranch here:
Interview
You can read about why the Apple/O'Reily book was "thrown" together.
My site has Cocoa code and will be adding some Cocoa game code soon. I also recommend http://www.cocoadevcentral.com/ for more Cocoa info.
Cheers,
Carlos Camacho
Editor
iDevGames.com
Does anyone know of any other Cocoa dev books coming out in the near future (6-9 months)?
The idea behind Objective C is the messaging of Smalltalk and the efficiency of C. If you're in a tight loop, drop back into C (or C++ if you're using ObjC++). This will only be necessary (or desired) for computationally-intensive loops (in which case the need for OO is questionable). For the remaining 99.99% of your program, the speed hit is negligible.
Well, Cocoa always supported at least a two button mouse because the original Next machines had two button mice.
Actually, one of the coolest features is the ability to add methods to existing classes at run-time!
Have you tried using Objective-C to see if it actually runs slower in your application?
Also, consider that if Objective-C save you development time you could spend it optimizing/profiling.
IOW, how do you know?
Unless I'm mistaken, #import works perfectly well in C and C++ source, at least when compiled with gcc, where -Wno-import is set.
I use it all the time in my C/C++ programs(compiled with cc on Mac OS X 10.1). Of course, I also include the #include hack in all of my header files.
If you have spaces in filenames, you have to go and put everything between quotes. That's why I always rename my mp3s using underscores. mpg123 is easier to type than "MP3 Player", too.
Duct tape, XML, democracy: Not doing the job? Use more.
Come on, everyone knows that dynamic claptrap can cost you dozens of CPU cycles at every call! No one sane would ever even consider a language like that.
I don't doubt that it works in gcc, but it sure isn't part of C or C++. It is something gcc does for you (in part because it is also an ObjC compiler).
If some day you decide to use SGI's IA64 compiler, or Intels C compiler, or Mertoworks there is a good chance that #import will just plain not work.
It's fine if you like to use it, but understand it's no better then a Microsoft C user claiming that exception handling is part of C, not C++ just because MS decided it should work that way.
(Of corse it's no worse then a gcc user deciding to use // comments in C code in 1998, who won the bet because as of C99 it really is part of C, not just C++ and PL/1...)
Readme.txt:
"Just type:
./configure
./make
./make install"
Apple doesn't want to expose users to this. Including gcc will only tempt developers to take the easy route. They should make mac-software==user friendly.
PS. The developer tools are much more than just gcc, there is a lot of Apple's software that you get for free (ProjectBuilder IDE, InterfaceBuilder, etc). It's only a download away! (I do agree that they should include the devtools with new Macs, but I don't think there is much reason to complain with the current situation, at least not until M$ gives away Visual Studio).
.
The Drowned and the Saved - Primo Levi
I bought my powerbook without a one button mouse. It has a one button trackpad included and I already had a M$ optical USB mouse. Even so, when working in Aqua I hardly notice the trackpad's lack of multiple buttons. This is prabably a result of good interface design.
Unfortunately, it completely screws copy and paste in my X server.
All I want is a secure system where it's easy to do anything I want. Is that too much to ask ~~ Randall Munroe
Fuck
Most Windows games use direct X to interface to the hardware. This is not (AFAIK) available for the Mac, so worrying about where the mouse is when doing a port is probably the least of your problems.
Anyway, why do most Windows games need to move the mouse about? Sure, they may need to hide it.
All I want is a secure system where it's easy to do anything I want. Is that too much to ask ~~ Randall Munroe
That's what he meant:
"Apple is equal to crap"
not crap is assigned to apple.
All I want is a secure system where it's easy to do anything I want. Is that too much to ask ~~ Randall Munroe
"You sure seem to spew a lot of it too. (See, I can make ad hominem attacks too!)" ;-)
you know, what goes in must come out....
if (!signature) { throw std::runtime_error("No sig!"); }
As a long time NeXTStep, OpenStep, Webobjects (yes, WebObjects also uses ObjC) programmer I'd like to point out a few things about ObjC and the NeXTish frameworks, without religious bias.
ObjC was a very nice language when it first came out. For a hybrid language (object semantic hacked on top of ansi C), it is much more powerful and clean than c++, which is why I made the switch. However, it is absolutely erroneous to say that there are things you can do in ObjC that cannot be done in c++. You just have to jump through hoops of fire in c++ to achieve the dynamism of ObjC. On the other hand, it WAS a hybrid language: fundamentally still C. So it was no Smalltalk. Programmers are still fundamentally responsible for memory management (there's a refcounting scheme for helping) and this requires a high skill level. In large programs, tracking memory leaks could take time. Also, ObjC was not nearly as clean as Smalltalk in other respects. Some of the object semantics in ObjC were hacked on through the use of cpp macros. You could not stay entirely in the object world-- the facade of OO was not complete. In dealing with the low level of the runtime you would have to handle c structs.
The state of the art moves on. But ObjC doesn't, for the most part. ObjC has some features that Java is lacking: method forwarding, posing, categories, etc. Still, there are no circumstances under which I would now choose ObjC over Java. Why? Advantages of Java over ObjC:
- Automatic memory management.
- No direct memory access. Because of this, I can feel comfortable working with junior programmers. Not the case under ObjC.
- Only Objects and a few sensible primitives. No other data types.
- Unicode based.
- Strongly typed (yep, it's an advantage, good ObjC programmers type as much as possible anyhow)
- Exception handling first class citizen of language (it's hacked on in ObjC)
- Fully integrated threading model (much more difficult on ObjC)
- multi-platform. I know java isn't perfect in this respect, but ObjC and the Foundation framework was much, much worse. Basic things like threading could work differently on Solaris vs. windows under OpenStep Foundation.
- multi-vendor.
- A tremendous number of third party tools.
- A tremendous amount of third party information.
I can go on and on. I really don't see the point of Apple pursuing Cocoa, except as far as they are locked into it for legacy reasons.
You *do* get the source with MFC...
the CWindow class is in the ATLWIN.H (yes all method implementations are in the header)
if (!signature) { throw std::runtime_error("No sig!"); }
I don't disagree with the review. This does look like a much better beginner's book than the O'Reilly/Apple Developer Connection book (though I think that O'Reilly made the right decision to get a book out early by working with Apple to put some of their online material out in book form--this was the only Cocoa information in print for a long time and helped people get started.) But it seems a bit off color to write a review praising a book you worked on and attacking a competing book without acknowledging the connection. If this isn't the same Michael Simmons, I apologize.
No, then I could just infer that the value of
(Apple == crap) is false, that they are not equal.
MAC? With all capital letters? Let me guess - you write "PERL" too, don't you?
A big strenght of ObjC is that it integrates wonderfully with scripting languages. This is really great!
Look at this article at O'Reilly:
http://www.oreillynet.com/pub/a/mac/2001/11/30/sc