Views are transformations of data. They are usually used to combine information from multiple tables, but they can’t have parameters in them, so they are not what to use if you want to filter your data
User defined function or Stored procedure is the Swiss knife of SQL server. They can do anything from automated transformation of data to data retrieval. Code generation tools usually support calling them