title: What's the deal with Java's public fields?
body: <p>I've been reading two articles <a href="http://www.javaworld.com/javaworld/jw-09-2003/jw-0905-toolbox.html">(1)</a><a href="http://www.javaworld.com/javaworld/jw-01-2004/jw-0102-toolbox.html">(2)</a> on javaworld.com about how all class fields should be private and getter/setter methods are just as bad. An object should act on the data it has rather than allowing access to it.</p>
  
  <p>I'm currently working on a University assignment for <a href="http://en.wikipedia.org/wiki/Connect_Four">Connect Four</a>. In designing the program the Agents playing the Game need access to the Board's state (so they can decide what to move). They also need to pass this move to the Game so it can validate it as a legal move. And during deciding what to move pieces are grouped into Threats with a start and end Points.</p>
  
  <p>Board, Threat and Point objects don't really do anything. They are just there to store related data that can be accessed in a human readable way.</p>
  
  <p>At the start of design I was representing Points on the board as two element int arrays, however that got annoying when creating points or referencing components of them.</p>
  
  <p>So, the class:</p>
  
  <pre><code>public class Point {
      public int x;
      public int y;
      public Point(int x, int y){
          this.x = x;
          this.y = y;
      }
  }
  </code></pre>
  
  <p>Perfect in every way I can think of. Except it breaks every rule I've learned. Have I sinned?</p>