title: Selenium - Page Object Model vs Defining public static final
body: <p>In Selenium we can maintain the Object Repository as Page Object Model. But we can maintain OR through a separate class by defining variables as public static final and use in the other classes whenever required.</p>
  
  <p>for e.g. </p>
  
  <pre><code>package ObjectRepository;
  
  public class OR_SFStandard 
  { 
     public static final String NewBtn = "//a[@title='New']";
  }
  </code></pre>
  
  <p>and use the same in code as </p>
  
  <pre><code>package common;
  import ObjectRepository;
  
  public class Deal 
  {
      public void newDeal(WebDriver driver)
      {
      driver.findElement(By.xpath(ObjectRepository.NewBtn)).click();
      }
  }
  </code></pre>
  
  <p>Can anyone please help me understand the difference and what is better way?</p>