What is an API

Source: Internet
Author: User

Http://www.cnblogs.com/I-am-Betty/archive/2014/03/06/3584696.html

As a beginner of programming, API functions may be something that is often heard but feels mysterious. It's daunting to look at its complex syntax, but it always feels like it before we get into it. The purpose of our introductory API tutorial is to tell everyone the ins and outs of API functions, to break the fear of API functions and make it a good helper for our programming.
You may have seen in many books the English full name of the API (application programming Interface), the WIN32 API is the application programming interface of the MicrosoftWindows 32-bit platform. The understanding of this definition needs to be traced back to the development history of the operating system, and when the Windows operating system begins to dominate, the development of applications under the Windows platform becomes a requirement. In the early days of the development of Windows programming, the programming tools that Windows programmers can use are only API functions, which are interfaces that Windows provides to applications and operating systems, and they are like "block blocks" that can build up a wide variety of interfaces, A flexible application. So you can think of the API function as the cornerstone of building the entire Windows framework, underneath it is the core of Windows operating system, and it's all gorgeous Windows applications.
However, at that time, the development of Windows program is more complex work, the programmer must memorize a lot of common API functions, but also have a deep understanding of the Windows operating system. However, with the development of software technology, there are many excellent visual programming environments on the Windows platform, programmers can use "WYSIWYG" programming method to develop a beautiful user interface and powerful application.
These excellent visual programming environments are simple, user-friendly (such as VB, VC + +, Delphi, etc.), which provide a large number of class libraries and various controls, they replace the mysterious function of the API, in fact, these libraries and controls are architected on the basis of WIN32 API functions, is a collection of encapsulated API functions. They combine common API functions into a single control or class library, and give them a convenient way to use them, so they greatly accelerate the process of Windows application development. With these controls and class libraries, programmers can focus on the design of the overall functionality of the program without paying too much attention to the technical details.
In fact, if we want to develop more flexible, more practical, more efficient applications, it is necessary to involve the direct use of API functions, although the class libraries and controls make the application development is much simpler, but they only provide the general functionality of Windows, for more complex and special functions, Using class libraries and controls is very difficult to implement, and you need to implement them using API functions.
This is also the use of API functions, so we do not have to deal with the API function to study the use of each function, it is also unrealistic (can use the API function has thousands of).      As one prawn said: API does not learn, when needed to check the API help is enough. The API is the cornerstone of the system and is the brick by brick of windows.
Clear a concept, the software is running on the system platform support, the function of the software is actually to extend to the system, and by the system to complete these functions of the process.
So how does the software need to do things to the system, that is, the role of these APIs, the system defines these API functions, as a support software to perform system functions of the interface.
The natural API for different operating systems will be different. An API is a set of functions that call a function and service as an application. A program designer can compose a program based on an API function to have the operating system or a program activate a program to perform certain functions. Basically, the API is the framework of the operating system, usually contained in the name of the. DLL's dynamic connection library file, you can control the various components, skins, and services of Windows.    This pre-scheduled function can communicate with the core of the operating system below the API, calling other programs or services, and allowing the programmer to architect a variety of Windows applications based on the API. (Source: http://iask.sina.com.cn/b/4708399.html) (Source: http://tech.ccidnet.com/art/322/20050405/233693_1.html)

An API is an application programming interface. It is a set of functions that can be used to manipulate components, applications, or operating systems. Typically, the API consists of one or more DLLs that provide some special functionality. (Different in Java, but very similar) a DLL is a file that contains functions that can be called by any application running under Microsoft Windows. At run time, the function in the DLL is dynamically linked to the application that called it. No matter how many applications call a function in the DLL, only one file on the disk contains the function, and the DLL is created only when it calls into memory.

The API you hear most probably is the Windows API, which includes the various DLLs that make up the Windows operating system. Each Windows application interacts directly or indirectly with the Windows API. The Windows API guarantees that all applications running under Windows behave in a consistent manner.

Note with the development of the Windows operating system, several versions of the Windows API are now published. Windows 3.1 uses the Win16 API. Microsoft Windows Ntindows 95 and Windows 98 platforms use the Microsoft Win32 API. In addition to the Windows API, some other APIs have also been published. For example, Messaging Application programming Interface (MAPI) is a set of DLLs that you can use to write e-mail applications.

The API has traditionally been written for C and C + + programmers developing Windows applications, but other programming languages, including VBA, can also invoke functions in the DLL. Because most DLLs are written and organized primarily for C and C + + programmers, the method of calling a DLL function differs from calling a VBA function. You must understand how to pass parameters to a DLL function when using the API.

Warning calling the Windows API and other DLL functions may adversely affect your application. When you call DLL functions directly from your own code, you bypass some of the security mechanisms that VBA typically provides. If an error occurs when you define or invoke a DLL function (all programmers are unavoidable), you may cause application errors (also known as universal protection errors, or GPF) in your application. The best solution is to save the project before running the code, and be sure to understand the rationale for DLL function calls.

(Source: http://www.360doc.com/content/07/0910/17/43302_733716.shtml)

An interface is an abstract concept that typically has several layers of interfaces. Interface can be translated into interface can also be translated as interface, the origin of the interface should be from the socket of electrical appliances (not done textual research). Popular saying: The interface is used to connect and open the entrance.

There are roughly these types of interfaces: hardware interface, user interface (UI), software interface, object-oriented interface.

The programming interface (API) should be a branch of the software interface. Of course, the interface in different fields have n-more classification.

The API is generally limited to the programming interface of the application. The popular explanation should be: a component (or library) that is provided to developers for programmatic use, through which the code can communicate with the portal. For example, if you download a control package, read the instructions that you know how to create context, initialize, set properties, invoke, callback, event handling, which is the API for this control package.

API General correspondence function, in the object-oriented domain may correspond to the characteristics of the class, and for the transport protocol generally refers to the protocol of an implementation of the method provided by the use of the Protocol.

The return value method name (parameter 1, parameter 2 ...) This can be considered an interface

Interface: So the name Incredibles is to provide a cut of the transfer.

You can understand a way to exchange data between multiple programs that follow the same rule.

To the big say, there is a network interface. For example, if you request http://sf.gg in HTTP get and get the return value, HTTP://SF.GG can be considered an interface. MySQL client uses IP port user password to access MySQL server on an IP port, and this server can also be considered an interface. Of course, JavaScript requests HTTP server through XMLHttpRequest to also be treated as an interface communication.

To the small said, there is a program internal interface. Invoking the methods provided by other classes within a class can also be considered an interface.

Give two examples: 1. Sina Weibo is a website, all the data are on Sina Weibo. Sina Weibo provides a complete set of interfaces, which we can get to the data inside. (equivalent to your understanding) 2. Windows is a well-packaged system, and the user does not have the right to do anything in Windows, but Windows provides a complete set of interfaces that we can manipulate windows to do some behavior.

So my personal understanding is that using interfaces, we can operate on a well-packaged whole, not just to get the data (the front-end says it might be biased, to get the data from the whole or to the whole), and to operate on the whole. Normally written classes can also be considered to provide an interface, the class is the whole, the member function of the class is the interface.

(Source: http://segmentfault.com/q/1010000000171568)

Application Interface(English: Application Programming Interface, abbreviation: API), also known as the application programming interface , Is the agreement that the different components of software system converge. Because of the large scale of software in recent years, it is often necessary to divide complex systems into small components, and the design of programming interfaces is very important. In the practice of program design, the programming interface is designed to make the responsibility of software system be divided rationally. Good interface design can reduce the mutual dependence of various parts of the system, improve the cohesion of the constituent units, reduce the coupling degree between the components, thus improving the maintainability and expansibility of the system.

The application interface is: "' Computer operating system (Operating systems) ' or ' library ' provided to the code used by the application call". Its primary purpose is to allow application developers to invoke a set of routine functions without regard to the underlying source code, or to understand the details of its internal working mechanism. The API itself is abstract, and it defines only one interface, not the details of how the application is implemented.

For example, a set of APIs in a graphics library defines how pointers are drawn, which can be displayed on a graphics output device. When the application requires pointer functionality, it can be linked to this set of APIs at reference, compile time, and the runtime invokes the implementation (library) of the API to display pointers.

An application interface is a set of thousands of extremely complex functions and sub-programs that allow programmers to do many tasks, such as "Read Files," "Show Menus," "Display pages in Windows," and so on. The operating system's APIs can be used to allocate storage or read files. Many system applications are implemented by API interfaces, such as graphics systems, databases, Web services, and even online games.

There are many different designs for application interfaces. The interfaces used for quick execution typically include functions, constants, variables, and data structures. There are other ways, such as using an interpreter, or providing an abstraction layer to mask the information associated with the API implementation, ensuring that the code using the API does not need to be changed to accommodate the change.

Application interfaces are often part of the Software Development Kit (SDK)

API is also divided into (Windows, Linux, UNIX and other systems) system-level API, and non-operating system level of the custom API. As an effective code encapsulation model, the Microsoft Windows API development model has been developed for many commercial applications, and has developed some of the commercial application of the API functions to publish, facilitate the third-party function expansion. such as Google, Apple Computer, and Nokia and other mobile phone development API and so on.

(Source: http://zh.wikipedia.org/zh-cn/%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E6%8E%A5%E5%8F%A3)

What is an API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.