Thursday, February 19, 2009

Difference between Framework and API(API vs. Framework, Framework vs. API)


Software Framework vs. API

In this article, I will quickly explain what a software framework is, what is an API, and are key differences between an API and a software framework.


Software Framework:

It is a re-usable design for a software system (or subsystem). A software framework may include programs, code libraries, a scripting language, and other software to help develop and glue together the different components of a software project. An API(Application Programming Interface) may expose various framework parts.
dot_net_framework
Microsoft's .Net framework is a very good example of a software framework. It contains compilers, class libraries, an IDE(Visual Studio), and a runtime. Another example is OpenCog: A Software Framework for Integrative Artificial General Intelligence.
Now that you know what a framework is let me tell you what an API is so that you can answer the question Framework vs. API.

API (Application Programming Interface):

It is a set of routines( AKA methods or functions), data structures, object classes, and/or protocols provided by libraries and/or operating system services to support applications' building.
Good examples of API are Microsoft TAPI(Telephony API), MySQL connectivity API, and Google MAPS API.










In Microsoft's .Net Framework, only the Base Class Library or BCL is the API. The framework is a bigger thing. API is a part, and the framework is a whole. Although, API can exist on its own without a framework as well.
Now you know what's the answer to API vs. Framework :)


A friend told me yesterday "I interviewed someone; he had no idea about the difference between Framework and an API." I replied, "Owwww that's dumb." In fact, had no idea about the difference either.
Well, I think this is enough to illustrate the difference between Software Framework and API, or Software Framework vs API.



Another example of a software platform is pictured below, Google's Android Mobile Platform, 


android-system-architecture


You see this platform contains many things, a kernel for low-level tasks, certain libraries for OS-level chores, Dalvik Virtual Machine (an enriched clone of Java Virtual Machine), and the "Application Framework" on the "third story." Any software we write for Android smartphones will reside on the 4th floor, labeled "Applications" here.
Some might search this topic as API vs framework; this blog entry will be equally helpful for those friends as well.

12 comments:

  1. Are frameworks like templates?
    Eg:We want to develop an application in some programming language. The framework for that language provides a ready made generic program in that language and when we write code using the APIs or libraries(I still don't understand the difference b/n APIs and Libraries), we are just customizing that readymade program to suit to our purposes? Just like customising a web template to represent a specific website?

    It so happens that I am working with J2EE for my semester project. The project is built using IBM Wepsphere Application Server Toolkit and tested in Websphere Application Server 6.1. The features of the IDE are so bewildering for someone who wrote and executed C code on Turbo C++ 3.5 Compiler. After reading about frameworks and APIs (J2EE has a lot of APIs!) I am curious to learn whether the IDE I am working in is providing a Framework, which makes coding easier.

    ReplyDelete
  2. Haritha, sorry for very late reply.
    NO FRAMEWORKS ARE NOT LIKE TEMPLATES. Framework is a set of many things. Frameworks are like echo systems.
    API is one function call, for example clrscr() is one API. Library is one or more such function calls bundled together. Just to keep things nice and clean, we usually group these functions in different files or packages.
    And no, you are not "customizing" the ready made programs to solve your problems, you are only "using" them.
    First of all just don't be afraid of J2EE or anything related to programming, if you can code stuff up in Turbo C++ you can pretty much handle anything. Because Java and C#, both languages are created based on C++.
    IDE stands for Integrated Development Environment, and it has nothing to do with a framework. IDE is just a tool which is is helpful in consuming services provided by a framework or API.
    Feel free to ask any more questions. I'll try to spare some time and do a brief post about API vs Library soon. cheers...

    ReplyDelete
  3. Thanks for your reply. It has been very helpful. A lot of my misconceptions have been cleared.

    ReplyDelete
  4. Framework: Collection of libraries with their implementation.
    API contains only the definition the libraries.(like a user manual)
    An API can be implemented differently by 2 different companies.

    ReplyDelete
  5. Thank you so much for this one
    Logo Design

    ReplyDelete
  6. Thank you for providing this informative post. looking forward to read more.
    API Web Development Services

    ReplyDelete
  7. Thanks for sharign this information. If you're seeking relevant, high-quality content choose a creative and skilled creative content agency such as Atula Technologies, Ltd. They're specialists in the design of customized content that's appealing and SEO-friendly, which means that the people you're trying to reach will be able to comprehend and appreciate the message. If you require content for your website such as blogs, posts on the blog content, and video scripts Their team comprised of experienced writers will provide results that will exceed your expectations. For more information, call +44-(0)207.101.4351.

    ReplyDelete
  8. Thanks for sharing this information.
    If you want to know abot Best Web Development Frameworks visit InvoIdea, a best Web Development Company in Delhi

    ReplyDelete

Feel free to talk back...