title: C# Immutable Classes and Gaming Objects
body: <p>I was doing some reading <a href="https://stackoverflow.com/questions/31214446/immutable-classes-and-subclasses">here</a> about creating immutable object in java and I was wondering, is it okay to create a mutable object in certain situations? </p>
  
  <p>For example, let's say we were creating a ping-pong game in C#, obviously, we would have a class that represents a ball, and the two paddles, would you write the ball class like this:</p>
  
  <pre><code> class Ball
      {
          private readonly int xPosition;
          private readonly int yPosition;
          private readonly int ballSize;
          private readonly string ballColor;
  
          public Ball(int x, int y, int size, string color)
          {
              this.xPosition=x;
              this.yPosition=y;
              this.ballSize = size;
              this.ballColor = color;
          }
  
          public int getX
          {
              get
              {
                  return this.xPosition;
              }
          }
          //left out rest of implementation.
  </code></pre>
  
  <p>or like this:</p>
  
  <pre><code>    class Ball
      {
          private int xPosition;
          private int yPosition;
          private int ballSize;
          private string ballColor;
  
          public Ball(int x, int y, int size, string color)
          {
              this.xPosition=x;
              this.yPosition=y;
              this.ballSize = size;
              this.ballColor = color;
          }
  
          public int getX
          {
              get
              {
                  return this.xPosition;
              }
  
              set
              {
                  this.xPosition = value;
              }
          }
  
  
      }
  }
  </code></pre>
  
  <p>In a situation where our object(ball) can change position, size(smaller or larger depending on level) and color, wouldn't it be better to provide a setter property? In this case making it mutable makes sense? How would you approach this?</p>