title: Design Phase - Many references to same object
body: <p>I am designing an application where a class named Rights is used. This class contains information about what the user can /can't do and also contains other classes like DocumentFilters. </p>
  
  <p>The issue here is that I have a lot of different parts of the application getting an instance of that class through their constructor or get method, in order to be able to verify a user action before allowing it. It seems like this is bad practice (I might be wrong). Are there ways to improve this? </p>
  
  <p>The way it works is having the main class of the application creating the Rights class and then creating different components and passing it to those. The components don't have instance of the main class ether.</p>
  
  <p>Example code. This is repeated over several Modules.</p>
  
  <pre><code>public class ModuleA{
      private Rights rights;
  
      public ModuleA(Rights rights){
  
          this.rights=rights;
      }
      private boolean verifyRights(ActionEvent e){
  
          if(e.getSource("copyButton"){
  
               if(rights.allowedToCopy){
                     return true;
               }
          return false;
      }
  }
  </code></pre>