Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8787069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:47:38+00:00 2026-06-13T21:47:38+00:00

When designing an API for, say, a game. Would it be better to keep

  • 0

When designing an API for, say, a game. Would it be better to keep the data structures private, or would would returning the structures to the developers/who ever is using the API considered good design? So here’s an example.

Assume I have a chess board game API. Which of the following two examples would be considered “better”? Note that for the purpose of this question, I am assuming that the chess board size can vary and is controlled by the developer.

public void createboard(ChessBoard board);
public void move(Player playerNumber, Move move);

or

public void createboard(int x, int y);
public void move(Player playerNumber, int from[], int to[]);

I understand that there may be no better answer and it’s just a matter of design decision. I am just trying to see what other people think, or if there are any useful tips that anyone has.

Basically, I am assuming that the game contains an object called ChessBoard which contains a 2D array for the actual board.

The first example requires the developer to create the object and pass it and requires the developer to actually know what the underlying data structure is.

The second however, would require the developer to only pass in numbers. This would ask the developers using this to maintain their own data structures.

Which approach would you consider better design? Any tips?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:47:40+00:00Added an answer on June 13, 2026 at 9:47 pm

    When you’re exposing APIs the more of the internal implementation you keep hidden the better. Otherwise you’re potentially limiting yourself in the future with regards to further enhancements/changes as you’ll not want to break binary compatibility with developers using a previous revision of your API. (In ‘real-world’ cases there may be written agreements between client and customer regarding APIs saying they cannot be broken without explicit permission from the customer).

    You should aim for allowing configuration through APIs yet not locking yourself internally to any particular implementation. It’s harder than it sounds and the language used is also a factor.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am designing RESTful Api's and would like some advice on designing an API
When designing a C API for configuring a library/utility, I have a co-worker who
I am designing a RESTful API and I would like to know what the
I'm in the process of designing a .NET API to allow developers to create
I am designing the API for a client of a service that retrieves data
I am designing an API in PHP using slim framework. These are working fine
I'm designing an API for a web service and I can't decide between using
Are there any best practices to keep in mind while designing API's which ensures
I am in the process of designing an API. I would like to know
I'm designing an API to go over HTTP and I am wondering if using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.