Re: What's the differnece between API and Framework?
Re: What's the differnece between API and Framework?
- Subject: Re: What's the differnece between API and Framework?
- From: Gunnar Proppe <email@hidden>
- Date: Thu, 21 May 2009 20:30:03 -0700 (PDT)
There are also multiple definitions of "framework."
Here's Apple's definition:
http://developer.apple.com/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/WhatAreFrameworks.html
"A framework is a hierarchical directory that encapsulates shared resources, such as a dynamic shared library, nib files, image files, localized strings, header files, and reference documentation in a single package. Multiple applications can use all of these resources simultaneously. The system loads them into memory as needed and shares the one copy of the resource among all applications whenever possible."
In the Finder, go to /System/Library/Frameworks. There, you'll find a bunch of directories that end in ".framework". For example, CoreAudio.framework. These are the frameworks the above definition refers to.
In the wider software development world, however, the term "framework" has additional nuance:
http://en.wikipedia.org/wiki/Software_framework
"A software framework, in computer programming, is an abstraction in which common code providing generic functionality can be selectively overridden or specialized by user code providing specific functionality.
Frameworks are similar to software libraries in that they are reuseable abstractions of code wrapped in a well-defined API. Unlike libraries, however, the overall program's flow of control is not dictated by the caller, but by the framework. This inversion of control is the distinguishing feature of software frameworks."
In this definition, a framework is like a machine that you can plug your custom gears into, while a library is like a box of Legos that you can build stuff out of one block at a time.
Cocoa is a framework in both the Mac-specific sense, and the wider, computer science sense.
Here's where it gets potentially confusing: some Mac frameworks fit the machine/gears metaphor and some fit the Legos metaphor.
As others have said, an API is the "menu" or "blueprint" for how your code should use a framework or set of libraries.
Gunnar
----- Original Message ----
> From: Chunk 1978 <email@hidden>
> To: cocoa-dev Dev <email@hidden>
> Sent: Thursday, May 21, 2009 6:38:45 PM
> Subject: Re: What's the differnece between API and Framework?
>
> ok... so an API is like a lower level framework? wikipedia states
> that Carbon and Cocoa are APIs on Mac, but i always thought those were
> frameworks.
>
> On Thu, May 21, 2009 at 8:50 PM, Jonathan Hess wrote:
> > An API is a set of functions, classes, methods, and other bits that give you
> > a method to interface with a piece of software. A framework is one concrete
> > way to package a body of software with a set of header files that describe
> > its API. A web service is another way to give clients an API to a set of
> > software functionality that exists on a far away server.
> >
> > So, you might think of a framework as one of many methods of delivering a
> > package of software with an API.
> >
> > Jon Hess
> >
> > On May 21, 2009, at 5:33 PM, Chunk 1978 wrote:
> >
> >> my learning is still shady on what is actually an API... sounds like a
> >> framework to me... ?
> >> _______________________________________________
> >>
> >> Cocoa-dev mailing list (email@hidden)
> >>
> >> Please do not post admin requests or moderator comments to the list.
> >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >>
> >> Help/Unsubscribe/Update your Subscription:
> >>
> >> This email sent to email@hidden
> >
> >
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden