An Application Controller is responsible for handling the overall flow of the application. It coordinates multiple use cases and manages the high-level application logic.

Key Characteristics:

Example: In a web application, an ApplicationController that manages user authentication and session state can be considered an Application Controller. Below is an example of an ApplicationController for a Rails app.

class ApplicationController < ActionController::Base
  before_action :authenticate_user!

  private

  def authenticate_user!
    unless current_user
      redirect_to login_path, alert: "Please log in to continue."
    end
  end

  def current_user
    @current_user ||= User.find(session[:user_id]) if session[:user_id]
  end
end