• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Tutorial Doctor

So this is how APIs get so messy?

7 posts in this topic

Starting to understand why APIs get so messy. I am creating what I call a "Senses System" (in my journal), and I want the functions and variables to be easy to use. So I have to choose common sense names, and I have to make the use of the functions common sense also.

Now I find that I need to organize the functions and objects into logical groups. And i have to find a good presentation for the API. I really don't like the outline format.

I can see that the bigger the code gets, the more messy it can be. So, I know I need a good naming convention from the beginning, and that is why I have been posting lately about my habits and alternate naming conventions and data structures.

Question:
What would be YOUR ideal way of navigating an API? How would you present your documentation?
Most used functions/variables at the top?
You like the outline format?
Table format sounds good?
How could I make the associations between functions or variables clearer?
0

Share this post


Link to post
Share on other sites

Starting to understand why APIs get so messy. I am creating what I call a "Senses System" (in my journal), and I want the functions and variables to be easy to use. So I have to choose common sense names, and I have to make the use of the functions common sense also.

Now I find that I need to organize the functions and objects into logical groups. And i have to find a good presentation for the API. I really don't like the outline format.

I can see that the bigger the code gets, the more messy it can be. So, I know I need a good naming convention from the beginning, and that is why I have been posting lately about my habits and alternate naming conventions and data structures.

Question:
What would be YOUR ideal way of navigating an API? How would you present your documentation?
Most used functions/variables at the top?
You like the outline format?
Table format sounds good?
How could I make the associations between functions or variables clearer?

 

I like how the documentation for SFML is laid out in modules, classes, and files. If you don't like HTML much, the precompiled Windows binaries bundle a nice .CHM with a navigation outline. The SFML documentation was made with Doxygen. And yes, it has tables where it makes sense.

 

While presentation is very important, it won't save a poorly designed API. In my view, it will usually take a number of iterations, and a lot of refactoring, before an API becomes really elegant and intuitive. Good design is the end product of an evolutionary process; it is not at all unusual for the first iterations to be messy. So, don't be afraid to refactor, tinker, experiment, and improve.

1

Share this post


Link to post
Share on other sites

Any documentation is better than none. That being said there are a couple things I hate when reading documentation.

The only time documentation is worse then no documentation is when you simply run an auto document tool that gives no more information then intellisense would give, It's incredibly useless and wastes everyone's time.

 

That being said, I prefer documentation that details the API in a way that shows the user the way it was designed to be used. A list of namespaces/classes is useful only if you already know which class/namespace you are supposed to be looking into.. this is a good way to start your documentation (all the relevant information will exist), but then if you really want to create happy users, make a second pass explaining how to utilize your API with minimal set-up requirements with links on customizing behavior where appropriate.

 

Just remember that there are two types or people reading your documentation, the person that has never used your api before and the people who are trying to push the limits of your api. 

2

Share this post


Link to post
Share on other sites
So, tinker and explain? Great tips.

You are right paragon about it being good to explain the way the API was intended to be used.

I have tried several times to use Unity, and every time I get overwhelmed by the API. I have found the engine I like to use for now though, but maybe I will go back to Unity. With the current API I use, the functions make sense, and are easy to understand. I can gain experience using APIs in general this way, and perhaps I will look towards more complicated (if that is just the case with Unity) APIs in the future.

But yeah, I dislike it when an API has no documentation at all. I've learned some good habits and naming conventions from the API I use though.

Right now I am making a bunch of small and useful functions to add functionality to a project that will be sort of a template anyone can use to start a game in the engine. It comes with a collection of models, sounds, fonts, and scripts, and I want it to be easy to use.

It turns out that what I am actually creating is a sort of library, and I have not done this before.

I am going to check out those links georger, to get some ideas on how to lay out the modules and classes. Thanks.

Any more tips would really help.
0

Share this post


Link to post
Share on other sites


Starting to understand why APIs get so messy.
Which API? Personally I found most APIs I worked relatively well designed, of course you have to consider the historical constraints but in general, I'm fine with them.
0

Share this post


Link to post
Share on other sites

So, tinker and explain? Great tips.

You are right paragon about it being good to explain the way the API was intended to be used.

I have tried several times to use Unity, and every time I get overwhelmed by the API. I have found the engine I like to use for now though, but maybe I will go back to Unity. With the current API I use, the functions make sense, and are easy to understand. I can gain experience using APIs in general this way, and perhaps I will look towards more complicated (if that is just the case with Unity) APIs in the future.

But yeah, I dislike it when an API has no documentation at all. I've learned some good habits and naming conventions from the API I use though.

Right now I am making a bunch of small and useful functions to add functionality to a project that will be sort of a template anyone can use to start a game in the engine. It comes with a collection of models, sounds, fonts, and scripts, and I want it to be easy to use.

It turns out that what I am actually creating is a sort of library, and I have not done this before.

I am going to check out those links georger, to get some ideas on how to lay out the modules and classes. Thanks.

Any more tips would really help.

 

Once your API has stabilized into something useable, write a "hello world" kind of sample for it to go along with the documentation, to help users get familiar with the general flow of your library. Assuming your API warrants something like this, of course, if it is trivially easy then who cares (but then, the author usually isn't the best judge of that).

 

Make sure to use your API yourself in nontrivial applications, this is colloquially referred to as the "dog food test" in software development and means that the author of the library actually uses his or her own product for themselves, and tends to be a good indicator of software quality (for obvious reasons). If you don't like to use your API, that doesn't inspire other people to.

 

Do not try and perfect your API too much, in my experience there is a point where you stop improving the API and start overdoing it without even realizing it, so stop "tinkering with it" once you start finding yourself making silly, trivial modifications. It is tempting to make it as perfect as possible, but it doesn't pay off, you can't please everyone, and people are not stupid, they will understand how to work with your API even if it isn't immaculate.

1

Share this post


Link to post
Share on other sites

 


Starting to understand why APIs get so messy.
Which API? Personally I found most APIs I worked relatively well designed, of course you have to consider the historical constraints but in general, I'm fine with them.

 

 

Well, as far as game development goes, I don't really like how scattered the Unity3D API is. And the naming conventions aren't that easy to pick up for beginners like me (like me). 

 

The API I am using now is great, and easier to use. Now, Unity does have more functionality, so I understand why it is larger, but the names don't mesh, so when I am trying to do even a simple task, I have to go link by link to find what it is I want to do. An API can be large and still easily understood. 

0

Share this post


Link to post
Share on other sites


Once your API has stabilized into something useable, write a "hello world" kind of sample for it to go along with the documentation, to help users get familiar with the general flow of your library. Assuming your API warrants something like this, of course, if it is trivially easy then who cares (but then, the author usually isn't the best judge of that).
 
Make sure to use your API yourself in nontrivial applications, this is colloquially referred to as the "dog food test" in software development and means that the author of the library actually uses his or her own product for themselves, and tends to be a good indicator of software quality (for obvious reasons). If you don't like to use your API, that doesn't inspire other people to.
 
Do not try and perfect your API too much, in my experience there is a point where you stop improving the API and start overdoing it without even realizing it, so stop "tinkering with it" once you start finding yourself making silly, trivial modifications. It is tempting to make it as perfect as possible, but it doesn't pay off, you can't please everyone, and people are not stupid, they will understand how to work with your API even if it isn't immaculate.

 

Great tips Bacterius. I am actually making a demo project that uses the main functions of the API. This way people can see how the code can be used rather than having to look at little code snippets in an outline somewhere online. 

 

You are right about me needing to be able to use my own API without hating it. And I will try not to tinker too much. hehe. I like to write my code for ease of use by others, and for my future self, just incase I want to look back on my own code sometime, and perhaps modify it a bit. 

 

Thanks again. Great tips everyone. 

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0