Mac OS X: Core Foundation

Perhaps Mac OS X “took off” and without the Core Foundation, but not a fact. This object-oriented layer on pure C I have never seen. Even if there is something similar in the world, CF is worthy of separate consideration.

When this layer was designed and implemented, I do not know – I first encountered him at the beginning of 2001, when detailed and coherent “brand” of documents not yet exist, the development of Core Foundation continued bugs it was insane – and the task is transferred to the Carbon of the application size by almost a million rows became vital.

Perhaps, in the resurrection and revival of the Apple more to blame for her leadership and engineers but hundreds of third-party developers carrying their programme into this new unknown world is also involved.

This is the sixth part series about the transformation of Apple in the NeXT Apple. Previous parts:

  1. NeXT Apple.
  2. Apple chooses the path.
  3. The Carboniferous period (Carboniferous) in the history of Apple.
  4. Honeymoon carbonation
  5. Monster named Mac OS X

And we have a hand in this…

Competition and rivalries have not gone away, in Carbon transferred their products angry and bitter competitors, but the problems and misunderstanding were common, and people would share what they found out, sometimes the cost of trial and error. And did it (hiding their names with pseudonyms and not naming the place) with all my heart, knowing that the success of the platform need to all of them.

Environment changing, the information became obsolete very quickly – especially the “hacks”. Over time, the forums (there were several) Apple engineers have begun to report their affiliation to Apple, and apparently Steve decided that this is necessary and important, and officially lifted the ban. Much of what was reported on these forums would be a trade secret, if not for the gravity of the situation. Still hung on a thin thread.

The problem is an acute shortage of detailed documentation and inaccuracies in that which was all it concerned not only the Core Foundation, in my case the most difficult area was IOKit – and there were always people ready to answer all the questions – and eventually I began to help others. It was great. Something like Stack Overflow, but… what is the elusive otherwise.

We are all (relatively small Mac community ovsky the beginning of zero) dreamed incredibly beautiful and fabulous time when the world will finally love Apple like we do. It happened very soon, Apple is now all in chocolate – and something that words cannot Express, left. It was an incredible time, an alarming and unusual.

Funny: for 20 years, Core Foundation, I understood what was going on, but first decided to see how this phrase is translated into ordinary Russian. All of a sudden intuitive term has any meaning at all?

Is. This is the “main Fund”. So it was, really. Core Foundation, and derivatives library (Core Graphics, Quartz 2D she]6 and others) were and remain the primary Foundation of the system.

They are in our days very much alive. Swift changes them beyond recognition, and it looks like they are waiting for another moment, and again unbearably want to look there in the future…

Core Foundation framework and principles

If you call a spade a spade, not bothered about the inevitable inaccuracies “in their names” and other variants of analogies, this carefully rewritten in pure C (ANSI C, mostly) rather big fragment of the Foundation Kit, one of the two main frameworks, NeXTSTEP/OPENSTEP, Rhapsody inherited first, then YellowBox, and finally, once everything started to settle in, become part of Cocoa.

Transfer part of the Foundation on Wednesday at pure C demanded a revision of the concepts and essence of the original complex and the ruthless cut-off of all, without which you can do, fundamental errors and their correction. In fact, everything was written from scratch, the goal was compatibility and, oddly enough, easy to use.

The role of classes in CF perform “opaque types”. From the user’s perspective, CF is the links (references) on the types of data with hidden structure. Hid? And here and there. The system was created, changes were not many, but an awful lot – and, as a rule, all these changes were unpredictable. The essence of the interactions which carry out special functions – a good compromise.

These opaque data types called objects – in fact, they they were. It was value-types, to use the terminology of Swift. Opaque types are combined into a hierarchy, with the base type, which defines basic functions available to all other “classes” hierarchy. The role of base type was performed CFType, which specified the functions CFRetain, CFRelease, and CFEqual some others.

The types are the heirs of all these functions could be used, but usually each of them determines its own that is tailored to their “clients”.

CFRetain and CFRelease similar methods retain and release the base class Cocoa, NSObject is the main instruments for the allocation and deallocation of memory for objects. The principles are the same as those in Cocoa, somewhat simplified, based on the reference counting on the object.

With 2012 in Cocoa links and their deals counting ARC (Automatic Reference Counting), and come in any of the current incarnations of Cocoa with the esoteric practice of the “retain/release/autorelease” unknown – sorry. In our time only to learn precisely and without much thought to consider this aspect of reality could be considered mastered Cocoa, and held the mastery of this esoteric few months. Probably due to stress, the rest is absorbed easily, quickly and quietly.

To CF ARC got a couple of years.

In Cocoa and CF was (and is) a mutually compatible couple of classes and opaque types, such as NSString and CFString, data any of these types could be converted into the data associated with it by ties of kinship type from another library a type conversion (type casting). The structure of the data in both types were identical.

The source code is written in Core Foundation in contrast to the similar code in Cocoa significantly large number of letters. Core Graphics (Quartz) has inherited this feature.

To be continued

0 Comments on “Mac OS X: Core Foundation”

Leave a Reply

Your email address will not be published. Required fields are marked *