title: What's the advantage of POJO?
body: <p>In my project I have a small data structure <code>Key</code>.</p>
  
  <pre><code>public class Key implements Serializable {
  
    private static final long serialVersionUID = 1L;
  
    public String db;
    public String ref;
    public Object id;
  
    protected Key() {
    }
  
    public Key(String db, String ref, Object id) {
      this.db = db;
      this.ref = ref;
      this.id = id;
    }
  }
  </code></pre>
  
  <p>Yes this class is simple and every field is publicly accessible.</p>
  
  <p>But someone has suggested I use <strong>POJO</strong> style classes instead but when I asked why they were unable to tell me.</p>
  
  <p>In my opinion , calling <strong>getters</strong> and <strong>setters</strong> is slower than direct access to a field.</p>
  
  <p>So why I must use <strong>POJO</strong> programming style?</p>