J’aimerais remercier tous ceux qui ont assisté à cette première édition de mon atelier Cocoa-Xcode.
Si vous avez des commentaires ou des suggestions, je suis très intéresser à savoir ce qui doit être améliorer.
J’aimerais remercier tous ceux qui ont assisté à cette première édition de mon atelier Cocoa-Xcode.
Si vous avez des commentaires ou des suggestions, je suis très intéresser à savoir ce qui doit être améliorer.
Quoting from a reaction to Brent Simmons’s recent entry on large Cocoa projects:
As noted by Michael Tsai, NSNotificationCenter is a singleton, and thus essentially is one big honkin’ global. Globals are bad ™.
This was posted by Andy Finnell echoing Michael Tsai.
But in fact, NSNotificationCenter isn’t a singleton. You can create as many as you want. I agree that sending every notification to the default center isn’t a good idea. It turns it into a monolithic entity it isn’t meant to be. The default notification center should be kept only for communication with the rest of Foundation and AppKit.
However, if you are careful in your designs, you can easily have sub-system notification centers which only certain class clusters know about. That way, you get the benefits of NSNotificationCenter without the problems that have been underlined by several people already.
Je vous propose les lectures suivantes comme préparation à l’atelier.
Mac OS X Technology Overview
The Objective-C Programming Language
Cocoa Fundamentals Guide
Il est fortement recommandé d’installer Subversion pour l’atelier. Subversion est une logiciel de gestion de code source libre.
Vous pouvez soit télécharger un paquet binaire, soit compiler Subversion à partir du code source ou en utilisant un système de paquetage comme MacPorts ou Fink.
Il est fortement recommandé d’installer la suite Xcode pour l’atelier. Elle est gratuite est disponible sur le site d’Apple. Vous devrez vous faire un compte ADC avant de pouvoir télécharger le logiciel.
Update: mpqfs 0.3 is available.
MPQFS 0.2 is now available. This release can load external listfiles, which is useful when an archive’s internal listfile is incomplete, resulting in missing files or “unknown xyz” files at the root of the archive (MPQKit generates those filenames for files it can open but whose filename is unknown).
You can specify any number of listfiles using the -l or –listfile options when invoking mpqfsd directly. In addition, mpqfs.app has bundled listfiles for Blizzard games. To load those listfiles, use the File > Open… menu item and check the checkbox.
Update: mpqfs 0.3 is available.
MPQFS (or MoPaQ Filesystem) is a FUSE filesystem that allows one to mount a MoPaQ archive and use regular system tools such as the Finder or standard UNIX programs to access the content of the archive.
Before you can use MPQFS, you will need to install (or compile) MacFUSE, the Mac OS X FUSE implementation written by Amit Singh (author of the excellent Mac OS X Internals: A Systems Approach, the reference outside of Apple on Mac OS X’s architecture). MPQFS expects FUSE (specifically libfuse) to be installed in /usr/local/lib, so for those of you who have installed FUSE through MacPorts or Fink, you will need to either recompile MPQFS or create a symbolic link.
Version 0.1 is read-only (sorry!), but I fully intend on introducing write capabilities in the future. You can mount as many archives as you want, even the same one multiple times. You may even mount MPQ archives stored inside mounted MPQ archives, something MPQKit doesn’t even handle yet.
If you get a crash of find something that doesn’t work right, I have created a new MPQFS component on the MPQKit development wiki, so make sure to report those in.
Finally, it should be noted that inside the application bundle (in Contents/MacOS), you will find mpqfsd, the program that actually implements MPQFS. mpqfsd can be invoked from the command-line (even from non-graphical sessions for all you SSH people) and provides a rich command-line interface to let you play with mount options.
MPQKit 1.0b1 is the culmination of many months of development. It fully supports version 0 (the original format limited to less than 4 GB) and version 1 (or the extended format not limited to 4 GB) MoPaQ archives, all known compression methods, all known file metadata attributes, weak and strong signature verification, extensive error handling capabilities with NSError variants of most methods, and an undo operation method. Still missing from this release are a number of performance optimization, the rename operation and the test suite.
Indeed, the next big step towards MPQKit 1.0 is the construction of an extensive test suite to make sure MPQKit never regresses in functionality or performance and to ensure it remains compliant with the MoPaQ specification. The test suite will include a large number of operation sequences, detailed archive structural checks, and a collection of good and bad MoPaQ archives utilizing all aspects of the specification. It is my hope not only MPQKit, but all third-party MoPaQ libraries, will benefit from the MPQKit test suite.
I’ve also taken the liberty to clean up the MPQKit Subversion repository, which now sports the standard trunk, branches and tags structure. Obviously, there is now a 1.0b1 tag for those wanting to compile from source. Of course, you can also checkout the trunk.
Finally, the documentation has been updated to reflect all the changes in the code. Not everything is done yet, but all the important constants, structures and methods are accurately documented.
Download MPQKit 1.0b1. More information on the project is available on the MPQKit project page and on the MPQKit development wiki.
Jeff Johnson recently posted an entry about using NSError in Cocoa to dramatically improve error handling. I wholeheartedly agree with the idea, and in fact adding NSError “variants” during MPQKit’s refactor was one of my top priorities.
That being said, there are a few annoyances with using NSError, one of which is constantly having to check if the NSError ** variable your method was given isn’t nil before you dereference it to assign it a new NSError object. There’s also the verbosity of creating those instances.
So in order to make my life a little bit easier, I wrote a set of macros that cover the specific case where you want to create an NSError instance and then bail out of the method. They check if the NSError ** is nil or not, create an NSError instance and assign it to the reference (or set the reference to nil for the no error ones), then return a provided value to the caller. It’s important to note that you shouldn’t use a semi-colon after them, since the macros expand to a block ({…}). This is necessary for the macros to work correctly in situations such as if statements.
You can download the header file from the MPQKit Trac wiki. There are no license restrictions whatsoever.