Question: I recently had a homework question where we were supposed to work with a chess board, and place a number of queens on the board. 

The question was trivial in terms of difficulty, but what I wanted to ask was this:

Should I just make a boolean 2-D array and change every position that contains a queen to 1 or should I make a private class to represent a queen, that has x and y coordinates as instance variables? 

This might not seem very important or pressing, but I'm using Java and it kinda gets to the core of the concept of OO programming. If we never use the modular capabilities of Java, then why use Java at all? We might as well have written the same thing in C or Python. 

Which would be more appropriate in general do you think? I would appreciate it if you could restrict your answers to ones that are backed by reason, as opposed to opinions or personal preferences.

Answer: 
> 
> Should I just make a boolean 2-D array and change every position that contains a queen to 1 or should I make a private class to represent a queen, that has x and y coordinates as instance variables? 
> 
> 
> 

There is no single general answer to such questions. Either one can be suitable in specific situations, solving specific problems. 

> 
> If we never use the modular capabilities of Java, then why use Java at all? We might as well have written the same thing in C or Python.
> 
> 
> 

The fact that Java is an OO language does not mean we *must* define and use classes and objects for every piece of data we need to represent.

If I understand your question correctly, you are asking about an implementation detail. Object oriented programming is not so much concerned about the specific implementation details as it is concerned about *encapsulating* those implementation details behind a suitable interface which represents some important domain concept well. Hence clients of the class need not know nor think about its implementation details, only about the higher level abstraction represented by an interface.
In this case having a 2D array of Queens (separate class but without containing x,y coordinates) or booleans (indicating either a presence or absence of a queen) should be the correct choice. 
The reasoning is as follows:

* Queens as such do not have a position. You should design your objects (POJOs) independently of where they will be used and include as class members only properties that are relevant to them on their own.
* The positioning data has nothing to do with the queens and should be separated from them. Put in simpler terms, it is not a queens' job to take care of her position, but rather that of an external party (player, program, whatever). This is called **separation of responsibilities**.
* Most algorithms that you would like to use will be more difficult to implement and very hard to read and follow logically. Simple iterations of the board would be made impossible (or useless, at the least).

You will have to clearly define the role of each object in your system in order to be able to design it in a way that's both extensible & easy to work with. Not having a good idea of what exactly each object will be doing might lead to a wrong decision somewhere along the path, which itself will lead to more bad decisions down the road that deal with it until it becomes so bloated with hacks and workarounds that you would decide to start over :)