title: Is the Special case pattern redundant in Swift?
body: <p>In Robert Martin's Clean Code book there is a Java example of when to use the <a href="https://martinfowler.com/eaaCatalog/specialCase.html" rel="nofollow noreferrer">special case pattern</a>. Rather than write this:</p>
  
  <pre><code>try {
    MealExpenses expenses = expenseReportDAO.getMeals(employee.getID());
    expenseTotal += expenses.getTotal();
  } catch(MealExpensesNotFound e) {
    expenseTotal += getMealPerDiem();
  }
  </code></pre>
  
  <p>We'd use:</p>
  
  <pre><code>public class PerDiemMealExpenses implements MealExpenses {
    public int getTotal() {
    // return the per diem default
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>MealExpenses expenses = expenseReportDAO.getMeals(employee.getID());
  expenseTotal += expenses.getTotal();
  </code></pre>
  
  <p>In swift we have nil coalescing so we can skip creating an interface/protocol and go immediately to:</p>
  
  <pre><code>let expenses = expenseReportCalculator.getMeals(employee.id)
  expenseTotal += expenses.getTotal() ?? getMealPerDiem
  </code></pre>
  
  <p>Does this mean the special case pattern is redundant when using Swift? Perhaps I'm either missing the point or there are special circumstances in which this pattern would be valuable.</p>