API, an abbreviation of application program interface, is a set of routines, protocols, and tools for building software applications. A good API makes it easier to develop a program by providing all the building blocks. A programmer then puts the blocks together.
Most operating environments, such as MS-Windows, provide an API so that programmers can write applications consistent with the operating environment. Although APIs are designed for programmers, they are ultimately good for users because they guarantee that all programs using a common API will have similar interfaces. This makes it easier for users to learn new programs.
An API can be created for applications, libraries, operating systems, etc, as a way to define their “vocabularies” and resources request conventions (functions calling conventions). It may include specifications for routines, data structures, object classes, and protocols used to communicate between the consumer program and the implementer program of the API
An API is an abstraction that describes an interface for the interaction with a set of functions used by components of a software system. The software providing the functions described by an API is said to be an implementation of the API.
An API can be
- general, the full set of an API that is bundled in the libraries of a programming language, e.g. Standard Template Library in C++ or Java API.
- specific, meant to address a specific problem, e.g. Google Maps API or Java API for XML Web Services.
- language-dependent, meaning it is only available by using the syntax and elements of a particular language, which makes the API more convenient to use.
- language-independent, written so that it can be called from several programming languages.
- Purpose : The Microsoft Windows application programming interface (API) provides services used by all Windows based applications.
- You can provide your application with a graphical user interface; access system resources such as memory and devices; display graphics and formatted text; incorporate audio, video, networking, or security.
- Where Applicable : The Windows API can be used in all Windows based applications. The same functions are generally supported on 32-bit and 64-bit Windows.
- Developer Audience : This API is designed for use by C/C++ programmers. Familiarity with the Windows graphical user interface and message-driven architecture is required.
Application Programming Interface (API)
API s are implement using 3 Libraries in windows.
It is library named KERNEL32.DLL, which supports capabilities associated with OS such as
- Process Loading.
- Context switching.
- File I/O.
- Memory Management.
It is library named USER32.DLL, which allows managing the user interface such as
- Dialog Boxes.
It is library named GDI32.DLL, using GDI windows draws windows, menus and dialog boxes
- It can create graphical output.
- Also use for storing Graphical Images.
Why is API Design Important?
APIs can be among a company’s greatest assets
- Customers invest heavily: buying, writing, learning
- Cost to stop using an API can be prohibitive
- Successful public APIs capture customers
Can also be among company’s greatest liabilities
- Bad API can cause unending stream of support calls
- Can inhibit ability to move forward
- Public APIs are forever – one chance to get it right
Why is API Design Important to You?
- If you program, you are an API designer
- Good code is modular each module has an API
- Useful modules tend to get reused
- Once module has users, can’t change API at will
- Good reusable modules are corporate assets
- Thinking in terms of APIs improves code quality
Characteristics of a Good API
- Easy to learn
- Easy to use, even without documentation
- Hard to misuse
- Easy to read and maintain code that uses it
- Sufficiently powerful to satisfy requirements
- Easy to evolve
- Appropriate to audience
|Read More Topics|
|Passing arrays to function|
|Function declaration in C|
|User defined function|
|Inline function in C++|
|Recursion in C++|