All posts tagged ‘Programming’

File Under: Glossary

API

The application program interface (API) is a set of building blocks for programmers.

APIs are made up of routines, protocols, and tools. Most operating environments provide an API so that programmers can write applications consistent with that environment. For example, developing software using the Windows API ensures that your user interface will be consistent with other Windows applications, making it easier for users to learn your new programs.

Use on the Web

Web APIs provide simple ways to interact with websites. Using an API, you can extract public data from sites like del.icio.us, Flickr and Digg to create mashups, reuse data or just about anything else you can imagine.

APIs are also useful for extracting your own private data from a web service so that you can back it up elsewhere or display it on another site.

When talking about APIs you’ll here the following terms quite a bit.

Common Web API Related Terms

  • Web service/API — These terms are largely interchangeable and simple refer to the ways you can interact with the data on your favorite websites.
  • Method — A method is just one aspect of an API; you might also see methods refered to a functions. For instance, if you’re interacting with Flickr, you might want to get your public photos. To do so you would use the get_user_photos method.
  • Response — The information returned by the API method that you’ve called.
  • REST — Short for Representational State Transfer. REST treats data as a web document that lives at a specific URL. REST APIs use standard HTTP requests such as GET, PUT, HEAD, DELETE and POST to interact with data.
  • XML-RPC — This older API scheme formats method calls and responses as XML documents which are sent over HTTP.
  • SOAP — Simple Object Access Protocol. A W3C standard for passing messages across the network. SOAP is the successor to XML-RPC. It’s complexity has led many to disparage SOAP and with more APIs leaning toward REST, SOAP’s future is uncertain.
  • Ajax — Asynchronous JavaScript and XML. Technically it has nothing to do with APIs, however many sites using APIs send their queries out using Ajax which is partially responsible for the popularity of JSON.
  • JSON — JavaScript Object Notation. JSON’s main advantage is that it is easy to convert from JSON to nearly any other programming language. JSON uses key-value pairs and arrays, something common to PHP, Python, Perl, Ruby and most other languages. The portability of JSON has made it an increasingly popular choice for sites developing APIs.


Popular Web APIs

File Under: Glossary

Event

Events are user interactions with their computer, such as a mouse click or key press.

In the good ol’ days, computers handled user interactions as input of batched data. The user fed a hunk of data in, the computer did something to that data, then produced the results. With the advent of interactive devices like the GUI interface, computers could display answers to computations onscreen. The input for these interactions are events caused by the user, which could be keystrokes, button clicks, or the position of the mouse pointer. (see Event Handler).

File Under: Glossary

Expression

In JavaScript, expressions are phrases that the interpreter can evaluate. For example,

x + 10
and
x < 10
are expressions since they can be evaluated, while
x = 10
is simply a statement.

In linguistical terms, JavaScript is made up of sentences, phrases, and words. The sentences are JavaScript statements, in which an entire action is expressed. The phrases are JavaScript expressions, in which the elements of the action can be created and put together to make a statement. The words are JavaScript operators, which are used to act upon the data passed to them.

File Under: Glossary

Function

A function is a named group of statements in a program that performs a task when it is invoked.

Other programming languages make a distinction between a function, which returns a value, and a procedure, which performs some operation but does not return a value. Since JavaScript does not make this distinction, you can create functions that return values elsewhere in your code.

File Under: Glossary

Hash

A hash, also known as an associative array, is a collection of data in which each piece of data has two components: a key and a value. Much like the hash at your local diner, JavaScript hashes go unordered: They’re not indexed by numbers. For example, if you wish to use JavaScript to put up a different GIF animation on your site every day of the week, you might throw all these animations into a hash associated to each weekday as a key. Then you would refer to the key day to invoke that day’s animation.

For example, in a normal array, you’d have:

  dinner[0] = "monkey brain";

  dinner[1] = "meatloaf";

But in a hash, you could use a string as the index:

  dinner["monday"] = "monkey brain";

  dinner["tuesday"] = "meatloaf";