I think one of the best ways to learn a new programming language is to dive into source code and see how experienced coders write. I've found this kind of question asked here on Stack Overflow for other languages, but none targeted at Objective-C. The closest I've found is this question about good-looking Cocoa user interfaces, but I'm thinking in terms of general code quality, such as good use of idioms and design patterns, and usable documentation. Another good characteristic would be a code-base that is large enough to require real organizational discipline, but small enough that a beginner can fit his/her head around.
What do you think is a high-quality open source project that meets these criteria?
There's a decent list of open source Mac projects on CocoaDev: http://cocoadev.com/CocoaOpen
Not all of the projects are still active, but a decent number of them are. I particularly recommend:
BWToolkit - http://bitbucket.org/bwalkin/bwtoolkit/
BGHUDAppKit - http://www.binarymethod.com/bghudappkit/
CHDataStructures - http://cocoaheads.byu.edu/code/CHDataStructures
MGTwitterEngine - http://mattgemmell.com/source
Sparkle - http://code.google.com/p/sparkleplus/
Colloquy - http://colloquy.info/project/wiki/Source%20Code
CocoaRest - http://github.com/sdegutis/CocoaREST
CorePlot - http://code.google.com/p/core-plot/
I've found Adium to be a well-designed and written Objective-C project. It has a huge codebase, too.
I don't think there's any one place to learn all the Objective-C idioms and best practices, but you can pick them up here and there over time and practice. Cocoa mailing lists and blogs are good resources for this. (There are several SO questions relating to that.)
I haven't dived into the source myself, but the Omni frameworks are well-respected in the Mac community.
I work on a framework of my own that's still rough around the edges, but I strive for quality documentation in addition to understandable, well-structured code.
Google Quick Search Box [ qsb-mac - Google Code ]
I think The Google Quick Search Box (QSB) is worth a look. IMHO it's pretty much a cleaner googley rewrite of Quicksilver (Note: N. Jitkoff, the QS programmer, is also involved in the Google QSB).
Apple has tons of downloadable examples on their developer website. You get to see the source, and the license is BSDish from what I recall (use it for whatever, but don't repost original code without the license).
http://developer.apple.com/samplecode/Cocoa/index-date.html
Check Out lots off open source project here.
http://code4app.net
http://code4app.com
https://www.cocoacontrols.com
Here's a test app I wrote earlier today. Download links under “get source” in the top-right.
It's small, but it demonstrates good organizational discipline (separate controller object, instead of everything crammed into AppDelegate), a simple model layer with one model class (Header), and correct use of Cocoa Bindings.
I used to work on the GNUstep sources, they've got a good consistent coding style and the code is well-organised. Of course the project is hardly small, but given that you know what most of the classes do as you've used them in your Cocoa projects it's easy to zoom in on a piece that interests you. Some of the GNUstep Applications Project or Étoilé apps may also be a good place to start.
Check out PSTreeGraph, a view control for iPad applications.
iMedia Browser
, shows support of 10.4 - 10.7 strategies, is neatly and purposefully organized, and deeply commented. inherent problems using ImageKit have been boldly approached and solved.
i aspire to this level of thought mixed with practicality.
Related
I wanted to start working on a simple game concept I have, just as a side project/hobby/learning experience.
Pygames or Pyglet came immediately to mind, but it looks like they aren't being actively developed. Or perhaps they are, but extreeemely slowly.
I want a high-level programming language, multi-OS support, 2D focus (or suitable for 2D stuff, anyway), and active development. What are my options?
I use Pygame and think it is a great option. The community is fairly active, I see a new or updated project posted about every other day on Pygame's homepage.
Another good option would be the Love2d framework, which you can find here: http://love2d.org/. Love2d uses the language Lua, which is a high level, beginner-friendly language like Python.
Pygame and Pyglet are indeed excellent choices. If the level of activity concerns you, just take a look at the Google Code page for Pyglet, seems it's fairly active to me.
If you prefer more actively developed engine (less documentation, but more up-to-date approaches), check out the Monacle Engine:
http://monoclepowered.org/
If want to get your hands dirty and take a more Do-It-Yourself approach, projects like
SDL, SFML and Allegro may provide a good foundation for a cross-platform 2D engine.
Another, more recent project that provides a very useful set of 2D primitives is the Clutter framework:
http://www.clutter-project.org/
Add a sound library like FMOD or BASS and physics engine like Box2D or Chipmunk and you may build pretty much everything.
The PopCap (a.k.a. SexyApp) engine was a popular choice in the past.
http://sourceforge.net/projects/popcapframework/
For real-world example, check out the acclaimed indie game World of Goo, which is using it.
http://en.wikipedia.org/wiki/World_of_Goo
If python API is preferred, there seems to be an effort to provide one here:
http://www.farbs.org/pycap.html
What are the most valuable parts of Computer Science studies for Cocoa developers?
Another way I might word this question is:
If I’m not going to go to school for Computer Science but want to be a developer working primarily with Cocoa, what are the things I should make sure I learn that I otherwise might miss by being self-taught, and be worse off for it.
Update: Replaced the term "professional Cocoa developer" with "developer primarily working with Cocoa", in hopes that the intent of my question is somehow clearer.
To be clear, I've been working with Cocoa for two years and am comfortable with Objective-C and the Cocoa frameworks, as well as Cocoa design patterns and the developer toolset, and thus am for the most part fluent with the Mac and iPhone platforms. But I have wondered whether I'm missing important CS or SE elements due to being self taught/no formal training, and not coming from other languages or platforms.
This question is for Cocoa developers.
There are many, but things that come to mind imediatly
-Design Patterns (the Cocoa framework relies on many Design Patterns, if you follow them it will make your life very easy, most obvious example is MVC)
-Algorithms and Data structures(this applies to any framework really)
-Memory Management (No garbage collection on the iphone!)
I would question whether there's really such a thing as a "professional Cocoa developer" (from a philosophical standpoint), or if you would want to be one. There's "professional developer", who may work with Cocoa primarily. A professional developer is language-agnostic and as such has a solid career ahead of him/her. A language- or platform-specific hacker has very limited usefulness.
The question to ask is do you want to be a developer or not? If there aren't any good Cocoa jobs available at the moment, or Cocoa is replaced by something newer and better and very different, a professional developer changes gears and follows. Are you OK with that?
If so, a computer science degree definitely cannot hurt. If not, you should probably not put all your eggs in the Cocoa basket and pursue a non-CS degree.
In addition to what's been pointed out already, I highly recommend reading "The Pragmatic Programmer". It contains a wealth of information on how to write software, how to manage projects, and how to develop your career, advice that goes well beyond the documentation you look at every day in Xcode. Some of the topics they cover are ones that you might have been exposed to during a standard computer science degree.
"Professional" is a relative term.. but anyways, this is what i had to go through so that i could easily learn a new language anytime i want and also master it:
started by learning a simple console language (pascal or c++, but i consider pascal being simpler than c/c++), then learned another language just to see if i can do it (c++)
i learned a lot of algorithms and data structures, until i was able to recreate them and even create my own
i moved to a visual approach on programming with Visual Basic 6 (another simple one to start with), and tried to copy lots of apps just to see if i can do it
i learned about Object-Oriented Programming and finished by mastering it
from this step on, learning a new language was like a hobby, like playing!
then i wanted to learn some different topics, like design patterns, multithreading, and so on..
moved from windows to mac, and started learning objective-c: because i already knew lots of languages, it took me 5 days to learn objective-c, and yes, i took breaks like any human being :P
after i learned obj-c, i now had to learn cocoa... this one took me a lot of time to learn, and i still don't know it all.. but i do know most of it :D
What are the most valuable parts of Computer Science studies for Cocoa developers?
Learn that it's important to understand the differences between languages, not learning a particular language.
Are you writing numerical method solvers with a Cocoa frontend? You'll want to take numerical methods. Writing a 3-D plugin with a Cocoa UI? Better learn about Catmull-Rom splines.
A good understanding of computer graphics is required if you want to make some good looking animations :)
I have built some basic apps for iPhone and Mac with a general understanding of Cocoa, but haven't had a detailed understanding. Now I want to go deeper.
I have just finished the Objective-C documentation at MacDevCenter. It was great to get in-depth look but took far too much time, specially because a lot of it is conceptual, and it's hard to build detailed examples to make use of the concepts.
Now I am on to Cocoa, but feel like it would be too much work to go through 250 page documents for Cocoa itself, then KVC, Cocoa Bindings, and Core Data.
Would I be better off at this stage picking up a good book on Cocoa (Hillegass' is too sparse I think) or should I just bite the bullet and go through the docs?
Apple's documentation is generally excellent. The API reference in the very least is some of the best I've read (right up there with Java's API reference), and is a very valuable asset.
I'd suggest reading the overview pages for topics you're interested in to get a general "feel" for how they work and a starting point, and then just start writing code. You can refer to the documentation to fill in blanks that you encounter while writing code.
Writing a small project to exercise your use of APIs you'd like to learn is a great way to get started.
I've found Hillegass's book to be far from sparse. In fact, I've found it to be one of the most dense books on programming I've read. I've re-read most of the chapters at least 4 times, and each time understood more. By re-reading, I've understood the reason he included a certain paragraph and how it fits with the bigger picture. He spells everything out very clearly and doesn't waste words. I'm amazed at the amount that's contained in that book.
You mentioned that you want to learn by doing, instead of by reading. The Hillegass book has a section at the end of each chapter where you put what you've learned to the test, by building an application.
Of the three things you talked about, KVC, Cocoa Bindings and Core Data, the first two are covered very well. I did find the Core Data chapters to be a lot more sparse. That's the only part of the book that I haven't been able to understand without other documentation. The Pragmatic Programmers book covers it much better.
Anyway, the answer to your question is: it depends. If you've managed to work your way through the Mac Dev Center documentation, it may be that you're the kind of person who learns easily from that style of resource. If you like learning from books, the best one is Hillegass.
I'd recommend an excellent book released some time ago: ‘Cocoa Design Patterns’ by Erik M. Buck and Donald A. Yacktman.
Of course you can dive into Apple's documentation, but to me, I found Hillegass' book is a good start for learning Cocoa. The value of the book, I think, is the introduction of the conventions and idioms of Cocoa.
Is it really clear for a new Cocoa developer to find out information on issues like when and when not to send message autorelease to an object? You can argue that a single Googling will do, but how do you know there are these kind of issues in the first place?
Go get a good book, look through it and take notes. It could save your time. For me, on Cocoa, the book is Hillegass'.
Hillegass' book will drive you to the free documentation every time he fails to make sense in order to be "funny" (i.e. every other paragraph) anyway, so unless you just want to give him $40, you will be much better off sticking to what Apple gives you au gratis. At the very least you won't pick up any of his horrible UI design habits.
You don't really need to go through ALL the bindings and Core Data docs page by page--half of it is stuff you'll likely never use. Knowing where to look for more information is far more valuable a skill than memorizing APIs.
The reference is great and invaluable, but might not be the easiest way to start coding (as people have mentioned).
I started looking at the stanford lectures on iphone development, then coded as I went along. I've actually used them as reference once or twice as well... They are available on itunes for free.
It depends on what other programming experience you have and how you learn best. If you're fairly new to programming in general, I'd recommend Hillegass to start. If you're fairly competent at OOP but don't know Objective-C, you can go for Apple's "Introduction to The Objective-C Programming Language" to learn ObjC's language features. If you've programmed using paradigms other than OOP, you could look for general OOP book recommendations here on SO (e.g. "Best Referece to learn OOP independent of languages?"). I also second Jonatan's recommendation to check out what programming videos iTunes University offers. They are recordings of lectures from top-tier universities and generally of good scholastic quality (I only qualify this with "generally" because I haven't seen them all; the ones I have seen invariably were of quality). No matter where you go to learn ObjC and Cocoa, you'll still yourself using Apple's docs as reference.
As you learn, you might also find CocoaDev a useful ancillary source.
Aaron Hillegass's book is the text for his one-week cocoa development seminar, and it has been revised over several years of teaching Cocoa to beginners. Aaron's course is where Apple sends their own employees, now that they don't do the Cocoa course in-house anymore.
Apple's documentation is an excellent reference, but I agree that it's a huge resource to try to learn Cocoa from in the first place. Besides, you probably don't need to know the whole API up front -- just learn each part as you need it.
When I started learning, I just picked a project, sat down and started trying to code. When I ran into something I didn't know, I just googled it, which led to a tutorial and/or the relevant page of Apple's documentation.
In my experience, the best way to learn something like this is, well, experience.
Apple's documentation generally contains excellent API references, but (in my opinion) lacks equivalent topical guides. This makes it a bit hard to follow for beginners (Jacob Kaplan-Moss in the link I just gave makes the point that Python's documentation is like this, but I think Apple's is much more).
My recommendation would be to pick up Hillegass's book, alongside a project. The first few chapters explain fundamentals, so make sure to read those (and do the exercises!), or you won't be able to get far. Then try and implement your project idea; when you reach a wall, look through the Table of Contents and the glossary of the book and see if there's something that covers it. If you find something, use this as an excuse to read it fully and understand it. When you're finished, you'll have both a greater understanding and a project to show for it. Furthermore, you'll know what to search for in Apple's API references next time you try to implement something. This helped motivate me to finish the book, maybe it'll be helpful for you.[1]
[1]: (disclaimer: I have an odd learning style)
I downloaded Squeak, the Image file, and the Sources file, but I can't figure out how to write Smalltalk code. Is there something obvious I'm missing? Is Squeak even the right IDE for serious Smalltalk development?
Squeak is a great environment for learning Smalltalk, but don't confuse that particular implementation with 'Smalltalk'. Some of the other implementations are very professional, but not surprisingly come at a financial cost.
Squeak is an excellent IDE for serious Smalltalk development. That is not to say that it cannot be improved. The pharo guys are eleminating from the squeak image the parts you might not want for professional development.
Download (or buy) the book Squeak by Example to get started.
I don't think Squeak is really oriented towards "serious Smalltalk development". It's intended as a first programming environment for children. Which isn't to say that you can't do useful stuff with it, it's just not aimed as much towards large-scale development.
Check out the Wiki for getting started tips. It's been a while since I last used Squeak, but I don't remember it being particularly hard to get started.
Squeak is nice to learn the language and to see how creative a system like it can make people, which has two aspects: you see many interesting ideas and new concepts tried, but also a lot of junk and bad looking (some even abandoned) experiments.
I admit that, for a beginner, it may be hard to see the big picture, or if there is any at all. An example is the use of multiple GUI schemes (MVC vs. Morphic): at a time, where the mainstream is junping on MVC (they just understood in Java, what the ST guys talked about 20 yrs ago, and so they went from callbacks and AW to Swing), the Squeak guys are fed with MVC and move on, trying other aproaches. There is also a lack of "professional look" in squeak. And a chaotic community, some of which are quite ego-driven individuals.
It can be argued, if Squeak alltogether is good or bad for Smalltalk's reputation, as it certainly pisses of all those who want to write "conservative" windows apps, with menubars, icons, toolbars etc. Also performance used to be a problem (but since ELiot is working on the VM, is getting better...)
On the other side, there are wonderful applications, which are almost impossible in other environments: look at croquet (having a browser on the wall, with fishes swimming around), Etoys, Scratch, nice Seaside apps etc. And also almost all things which are now considered mainstream have originated from the Smalltalk and the Squeak community. And these guys are moving on...
So please take a look at the other Smalltalk's too: there are at least GNU-ST, Visualworks and Smalltalk/X. The later two are more biased towards blassical business apps, and the language and base libraries are almost the same. VW is not free, for commercial work, though.
I am learning Cocoa and Objective-C (well, and C) to make a few Mac apps I've had floating around. I need to use Distributed Objects, but am having trouble finding simple, concise examples. Does anybody know of any?
A google search came up with plenty of hits. The Apple docs are also good. Late Night Cocoa also has an episode on it.
I maintain the comp.lang.objective-c FAQ, and there's an example in there: How can I forward messages between remote objects? It's very short but should give you the basic idea, on which you can then hang the Apple and GNUstep docs to which it links.
It's a fairly old article but this is probably a good starting point for distributed objects. I personally found it easier to start with the older tutorials and work my way up to the more recent ones which use new technologies such as Core Data.
http://cocoadevcentral.com/articles/000062.php
I discovered this project at SourceForge which is a fairly large Cocoa project. It uses bonjour and distributed objects, and other then that I've found it to be a good resource and example. Just thought I'd put that out there in case anybody comes across this question.