Pdf Cocoa Programming For Mac
Contributed this review of what he claims is the best of the very few books out there for folks who want to learn Cocoa programming. The field is so small, in fact, that he can give a nutshell review along the way of the only other one he's encountered, O'Reilly's Learning Cocoa. Update: 12/13 15:45 GMT by: Please note: Simmons is thanked in the acknowledgements of Hillegass' book. He explains: 'I went to the Big Nerd Ranch, where the author teaches an amazing Cocoa course. While there, I received a pre-release copy of the book (it's the coursebook, actually.) I had found a bunch of errors and typos, and helped Aaron correct those errors and inconsistencies, so I'm guessing he is thanking me for my contributions to quality.' Just to clear that up! Cocoa Programming for Mac OS X author Aaron Hillegass pages 416 publisher Addison-Wesley rating 8.5 reviewer ISBN summary Learn to program OS X applications Intro to Cocoa If you're interested in programming for Mac OS X, you've definitely heard of Cocoa by now.
I have a Mediasmart server at home running Windows Home Server 2011. I have tried Safari using develop/user agent and Internet Explorer and it doesn't work. I have a Mac running El Capitan. Unfortunately, to have remote web access to the server, it requires either a Windows computer or a Mac running a virtual environment. Any recommendation/alternative for swannview link for mac.
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. You can write Cocoa applications with either Objective-C or Java. If you aren't familiar with Objective-C, it's an extension to the C language that makes it object-oriented. I'm not sure why Apple decided to offer Java support for Cocoa, since almost every source of information on the Internet and all Cocoa resources seem to only refer to Objective-C.
Since Java-written Cocoa applications will not run on any platform other than OS X, it was probably done as a marketing 'thing' - Apple is giving Java programmers the ability to program Cocoa applications, opening up the potential for more Cocoa engineers. Until today, there was only one book if you wanted to learn Cocoa. That book is, 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. Want to see your own review here?
Read the first:). Actually, what came before both of them, I imagine, was Apple's long-lost.other.
Cocoa. Cocoa was a multimedia authoring environment for kids. Apparently, a pretty interesting one too- a object-oriented IDE for kids, believe it or not. I think Alan Kay had something to do with it while he was still with Apple. How I long for the days when Apple would do interesting research! Am I the only one who misses it? (the original) Cocoa, Dylan, MacLisp- a lot of interesting things that they seem to have given up on.
Actually, it looks like your Cocoa came first- they started calling it that around 1990, it appears. Link: http://hometown.aol.com/schmucker1/index.html. Actually, what came before both of them, I imagine, was Apple's long-lost.other. Cocoa. Cocoa was a multimedia authoring environment for kids. Yes, it did come first, but it's not lost!
That project was spun off from Apple into the company stagecast.com. Apple retained rights to the original name. Actually, the earlier name for the project was acm.org. The prime movers for KidSim were David Smith and Alan Cypher. Larry Tesler was Stagecast president. Both Smith and Tesler originally came from Xerox PARC. For anyone interested in developing for Apple's platform, the apple.com 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 apple.com). 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.
![Programming Programming](https://weltbild.scene7.com/asset/vgw/cocoa-programming-for-mac-os-x-174153815.jpg)
OmniWeb used to seem to hideiously slow and bloated on OS X, compared to iCab and even IE. It seems OmniWeb has caught up. Once again, it is my primary browser.
And damn- I forgot how sweet pages look in OmniWeb! What was my point again? Cocoa has no intrinsic advantages as far as what the user sees- especially considering that Services are being largely ignored. The advantage comes to the developer, who is allowed more time to work on important things in their app, rather than pidly things. But Composer could've been written in Carbon or MFC- it just would've taken a lot longer.;) (but wait!
I suppose that is an advantage for end users!).and this is coming from me, a NeXTie, who still has a NeXT cube (working MO drive!) and ran OpenStep 4.2 and Rhapsody DR2/x86 on his PC until I finally just bought a Mac a year.5 ago. So, if anything, I'm positively biased toward the Cocoa API. 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.
![Pdf Cocoa Programming For Mac Pdf Cocoa Programming For Mac](https://pxhst.co/avaxhome/24/4d/00264d24.jpeg)
Have you thought about how useful it would be for end-user applications to have guaranteed access to a compiler? Granted the programming of the application is going to be hard, but imagine things like database front ends or presentation software where the user can hit a button that says 'make this thing I've built with the GUI run 100 times faster' and after 10 seconds or so there is a compiled plugin. They don't have to know C or shell scripts or type anything, but the compiler could be a huge advantage. The only reason to not include the compiler by default is so that Apple could make money selling it (the GPL means any buyer can give away free copies, but Apple could include something non-GPL such as a library or header file in order to make that not useful). But Apple seems to be giving it away for free, so I am at a loss as to why they did not include it.
There is junk on the system disk dozens of times larger than all the development tools (like sample movies and images) so they are not saving much space. And it seems the sales record keeping and pressing of extra $19.95 disks and the free download site are costing more than the marginal cost of sticking them on the distribution. 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. They won't object because it's not the same thing.
Apple created an Objective-C/Java bridge to allow programmers to access Objective-C objects and classes from Java. An external, native library, accessed through JNI funkiness. A person not running Mac OS X just doesn't have the Cocoa library, do they cannot use apps that depend on it. MS fuddled with the spec, and the VM, making what could've been standard Java apps not run on other platforms and virtual machines. So Sun couldn't object on the same grounds- unless interfacing with any native library is grounds enough for you.
And if it is, why not stop the people making GTK+ bindings for Java too? I can't tell if this is anti-Apple FUD, anti-Sun FUD, or anti-Java FUD.
The fact is that Sun had no problems with MS making it easier to tie Java apps to Windows via J/Direct. What they objected to was MS leaving out bits of functionality by obeying the letter of the spec and not the spirit (RMI support, for example, required accessing an FTP server at MS that would change from time to time). Apple has been providing ways to bridge Mac OS calls and Java for about 4 years. Sun has never objected, because Apple also implements the Java spec to aching accuracy. They just add extra stuff on top of it. Neither this book, nor 'Learning Carbon' are for beginners!
There's not much in the way of introductory text in either. 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. 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 everythingmac.org for loads of MacOS X goodness. There are tons of posts here saying Objective C has an ugly syntax. 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;), but these people are too ignorant or blinkered to realise this.
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.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. 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!
The only complains I have about ObjC are the obscenely long method names, and the memory management. The infix notation for specifying method parameters is novel, since it allows for a message to read much like natural language. However, that tends to breed really long method names/parameters, which means the programmer is forced to type more. The collections libraries is evidence of that. I don't like typing that much. Its a minimal complaint, but it has dampened by initial enthusiasm for the language. As for the memory management, I hate manual reference counting.
It's one of the most egegious aspects of COM on Windows, and I was quite disappointed to discover it is an issue in Objective C. I do still have much to learn about Cocoa and Objective C, but those two issues have been a source of frustration to me. I think the complaint about Objective C is not that 'foo.' is uglier than 'foo(.)' but that it uses both styles in the same program. SmallTalk only used the square bracket syntax for all function calls. The problem is that the original Objective C was a C preprocessor that did not even parse things, it acted like a macro processor and replaced any '.' sequence preceeded by anthing other than a C identifier with a C function call taking string arguments.
If they had worked harder to parse C some more I'm sure they would have used a syntax like 'method(object.)' so that you could easily switch function calls to method invocations. Or they could have used SmallTalk unchanged. But the actual compromise is not something anybody should be proud of! You're splitting hairs. Of course it depends on who you are and what you want, but for most people most of the time, the libraries is where the action is at. Technically, you're right, of course.
You don't.need. stdclib, you don't need javax. or STL. Its just that most of the time you'd want to use these things, unless your needs are specialised. Things like gjc are niche applications.
Technically, you're right, you don't need the Java or.NET Runtime. In practice almost everyone uses or will use it. It doesn't mean I wouldn't like to see more ppl using gcj, but currently its niche.
The reason people use it is because they perceive it will allow them to develop more complex applications more quickly (and hopefully more secure, and more robust etc). And that's what's relevant when comparing class libraries. To some extent I'll shut my mouth over MFC, for indeed there I don't know how much more useful it is or isn't. In this context it doesn't really matter whether its a good library or not though.
My point was that its a waste of time to compare languages if you should be comparing libraries. If you compare MFC and find its unnecessary, that's a valid thing to do. I'll give you that I should have been more specific. Eg, a client side Java programmer probably doesn't need javax., but a server side programmer almost certainly will at some point.
Sure, they could code it all from first principles, or java. classes, but most people will never need to.
So no, its not essential, its just 'extremely useful'. If one's splitting hairs, then yes, that's not the same thing. The NeXTStep API has been around for quite a while, and has never really had a following. It's been sold as a basic API on the original vnunet.com. When that failed, they tried to sell just the OS. When that failed, they tried to sell it as an API that would run under Unix.
When that failed, they finally managed to sell the whole ball of wax to Apple after Copeland self-destructed. (A close relationship between the chairmen of the two companies helped.) I find it terribly interesting that:. there's so much breathless enthusiasm for an API that has repeatedly failed to catch on;. people actually think that Cocoa is going to seduce a significant numbers of Carbon, Windows, or Linux/Unix developers - isn't it a little late in the game for that kind of realignment?. this discussion seems to be dominated by Objective C people; wasn't a big part of the development effort to make this OS accessible to other languages?. why this whole thing took so long - this isn't a new OS, it's a port of an existing one! Here are some more books on MacOS X / Cocoa / Carbon Programming: 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. And you can develop 'X-only' applications with this). I'm not entirely sure, but I was pretty involved in it up to a point. I think they stopped developing it, but I think it was done out of house, so those guys kept working on it. That's the last I heard of it, and I'm betting it's dead and buried now.
Cocoa Programming For Mac Os X Pdf
It's pretty unfortunate too, it was a great way to write simple little apps. I wrote a whole Mendelian genetics breeding simulation (which I still have somewhere), and I have a couple of books that have pictures and descriptions from tons of little programs people wrote. It wasn't meant for serious work, but could make some nifty little demos very easily. Great way to get kids programming. I've thought repeatedly about doing a free version for linux, but it's a lot more work than I have time for. Still, it'd be a very worthy project.
I've never seen Applescript studio. Unfortunatley, I kicked my Mac habit a few years back, so I won't get to try it out. It looks pretty different than Cocoa was though. Cocoa wasn't about creating apps really, there weren't what you'd call 'widgets'. Instead, the concept was to have a grid and according to the state of the grid you'd alter the objects on the grid.
Now that I think about it, it's a hell of a lot like cellular automata, but as a programming method. So you have these different items that would appear on the board. You could make a rule saying 'If the fly moves next to the frog, then the fly disappears and the frog's tongue appears.' This would be done visually, by having a before and after panel, making definining state changes really easy. There would also be rules to respond to events, like 'If you hit the right arrow key, move Jimmy to the right.' It could play sounds too.
The coolest thing about it was that there was a plugin that allowed you to view the apps in your browser. They were talking about moving the apps to java to make this easier, but it was too much work. Anyhow, the project was never designed to build apps that would be really useful. It was, however, a great way to get kids started on programming, and it really was fun to use. It was, by nature, the kind of app that encouraged playfulness, which I've never encountered in the same way in another environment. I've never actually worked with hypercard, but Cocoa was so insanely simple that you just had to play with it.
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. 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. 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 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. 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. 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. 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. 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. 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. 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. 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'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.
Objective-C is a real Object Oriented Language. To quote Alan Kay, 'I invented the term Object-Oriented, and I can tell you I did not have C in mind.' Objective-C is the closest thing to Smalltalk in compiled form. 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. There's only one core syntatic addition to C 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.
Cocoa Programming For Mac Os X For Dummies Pdf
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). 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 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.). 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.
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.org introduction linuxjournal.com (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:).
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. 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'. 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. 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!). 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. 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.
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. You know, if you spent a little less time trying to troll and a little more time fashioning a rational post together, you might have been able to go someplace with this. But I'll take a few of your more coherent complaints and answer them, just because. First up, let me cover a few of your 'quickie' style complaints.
You talk about how Apple screwed up 'Carbon 1.0', then never shipped it. Isn't this a good thing? Would you rather they release something worse than Windows 95?
Second, you talk an awful lot about speed issues with OSX and Cocoa. I suppose you haven't used 10.1. OSX 10.1 is amazing.
Coupled with Office v.X (I'm a student, need Office compatibility or I don't pass my classes) OSX 10.1 is just stunning in speed, stability, and functionality. Granted, OSX may seem a bit bloated on the surface, but I decided after ten years of using Wintel that I'd trade bloat for stability, a choice Microsoft never offered. Was NeXTStep awesome? Sure, seemed like it was to me anyhow. But back then, you didn't have the newer requirements of being out-of-the-box simple, and supporting so many hundreds of standards to make everything run as transparently as possible. Back in the days of NeXT, you had a NeXT if you were a developer, not an end user.
Keep in mind, as a lot of people fail to do, that Apple is a company geared toward the consumer market, not simply the developer market. Are there flaws? Are most of the flaws you pointed out accurate representations of the issues facing the Apple userbase?
In November, I bought my first current Mac after only having an ancient '030 simply to say I had one. When I was younger, I felt that Apple had great hardware, but a lousy OS. Now, after X.1, I'm convinced that Apple has a far superior consumer grade OS than anyone else with market share. And simply by it's nature, it's also the best OS out there for developers. After all, you didn't have to shell out $2500 for a copy of the development tools, did you?
Author by: Aaron Hillegass Languange: en Publisher by: Pearson Education Format Available: PDF, ePub, Mobi Total Read: 43 Total Download: 964 File Size: 46,7 Mb Description: Covering the bulk of what you need to know to develop full-featured applications for OS X, this edition is updated for OS X Yosemite (10.10), Xcode 6, and Swift. Written in an engaging tutorial style and class-tested for clarity and accuracy, it is an invaluable resource for any Mac programmer. The authors introduce the two most commonly used Mac developer tools: Xcode and Instruments. They also cover the Swift language, basic application architecture, and the major design patterns of Cocoa. Examples are illustrated with exemplary code, written in the idioms of the Cocoa community, to show you how Mac programs should be written. After reading this book, you will know enough to understand and utilize Appleās online documentation for your own unique needs. And you will know enough to write your own stylish code.
This edition was written for Xcode 6.3 and Swift 1.2. At WWDC 2015, Apple announced Xcode 7 and Swift 2, both of which introduce significant updates that (along with some changes to Cocoa for OS X 10.11) affect some of the exercises in this book. We have prepared a companion guide listing the changes needed to use Xcode 7 to work through the exercises in the book; it is available at https://github.com/bignerdranch/cocoa-programming-for-osx-5e/blob/master/Swift2.md.