How to Design an Easy to Use API

If you don't understand computer programming, check out my guide on how to understand computer programming.

1.4k Views 62 Likes 2 Comments
How to Design an Easy to Use API
35 Steps
Supplies
Embed
1

An API is an APPLICATION PROGRAMMING INTERFACE. It is an interface that helps you program for someone else's program. Twitter's API lets people make twitter apps.

2

Twitter provides app makers with certain CLASSES, FUNCTIONS, and VARIABLES so that they can use them to interact with Twitter's website. Any app that can post to Twitter used the Twitter API.

Recommended For You
3
Twitter API

Twitter API

4
UNITY 3D scripting reference (Their API is just as confusing)

UNITY 3D scripting reference (Their API is just as confusing)

5
No thank you.

No thank you.

6
This is one is designed by the CODEA APP developers. A bit better.

This is one is designed by the CODEA APP developers. A bit better.

7

One major issue with most APIs is that the way they name their variables and functions and classes is unintuitive.

8
Just about every API I have tried to use has a very confusing and un-organized setup. And it is hard to find anything I want easily. So I thought of a neater way to display an API to users.

Just about every API I have tried to use has a very confusing and un-organized setup. And it is hard to find anything I want easily. So I thought of a neater way to display an API to users.

9

Instead of using an OUTLINE format, it is better to use a TABLE format for your API. Organizing CLASSES, FUNCTIONS, AND VARIABLES into tables is easier to read than an outline with multiple links.

10

I will make a sample GAME ENGINE API

11
This is an ANIMATION CLASS. Inside of it are three functions. JUMP, MOVE, and SPIN are the three functions. Make the function names easy to understand. I can easily tell what these functions do.

This is an ANIMATION CLASS. Inside of it are three functions. JUMP, MOVE, and SPIN are the three functions. Make the function names easy to understand. I can easily tell what these functions do.

12

Clicking on the MOVE function takes you to another table.

13

NOTE: A period at the end of a word signifies it is a CLASS. A period at the beginning of a word signifies it is part of a class.

14
Inside of the MOVE function are several variables. Button, Direction, Speed, Animation, and Sound are the variables inside of the MOVE function. You can also adjust variables from the table.

Inside of the MOVE function are several variables. Button, Direction, Speed, Animation, and Sound are the variables inside of the MOVE function. You can also adjust variables from the table.

15

As a sentence this function would "Move, using the "RIGHT" button in the "0" direction with a speed of "4" while playing the "walk" animation and the "walking" sound."

16
This is the JUMP function

This is the JUMP function

17
And this is the SPIN function. Notice how LOOP is a BOOLEAN variable. SPEED is a FLOAT variable.

And this is the SPIN function. Notice how LOOP is a BOOLEAN variable. SPEED is a FLOAT variable.

18

Games have several key parts. The ANIMATION class animates stuff.

19
The SOUND CLASS handles sounds. This class has a SOUND variable and a LOOP variable. It also has a PLAY function and a STOP function.

The SOUND CLASS handles sounds. This class has a SOUND variable and a LOOP variable. It also has a PLAY function and a STOP function.

20

We need objects in the game to give animations and sounds to.

21
OBJECT CLASS. Static or unintelligent things should be a part of the OBJECT class.

OBJECT CLASS. Static or unintelligent things should be a part of the OBJECT class.

22

And we need CHARACTERS. These are very advanced objects. These are objects with intelligence.

23
CHARACTER CLASS.

CHARACTER CLASS.

24

LIGHTS.CAMERAS.ACTION.

25
LIGHT CLASS

LIGHT CLASS

26
CAMERA CLASS

CAMERA CLASS

27
CUTSCENE CLASS

CUTSCENE CLASS

28

Every game has a menu!

29
MENU CLASS

MENU CLASS

30

Now we put our animated objects with sound and lights into a LEVEL!

31
LEVEL CLASS. See how the objects are already organized by their CLASS? The "STUDIO" sound is from the "LIGHTS" class. STUDIO LIGHTS!

LEVEL CLASS. See how the objects are already organized by their CLASS? The "STUDIO" sound is from the "LIGHTS" class. STUDIO LIGHTS!

32

Bring it all together with a STORYBOARD CLASS

33
The STORYBOARD CLASS is like the CONTROL CENTER for your game or game engine. It organizes the events of your game. So this game has a CUSTSCENE followed by a MENU and then by a LEVEL.

The STORYBOARD CLASS is like the CONTROL CENTER for your game or game engine. It organizes the events of your game. So this game has a CUSTSCENE followed by a MENU and then by a LEVEL.

34

You can also put comments at the bottom of your tables with detailed information on how things work.

35
Of course, your info would be more detailed. Perhaps a few examples on how the classes work would be included.

Of course, your info would be more detailed. Perhaps a few examples on how the classes work would be included.

keyboard shortcuts:     previous step     next step
Comments
2 COMMENTS
View More Comments