Overview
This lecture explains how APIs connect the front end and back end of apps, using everyday analogies and outlining key technologies in app development.
Introduction to APIs and App Structure
- APIs (Application Programming Interfaces) connect app front ends (user interface) to back ends (servers and databases).
- The front end is what users interact with (app screens); the back end handles processing and data storage.
- Communication between front end and back end is crucial for accurate, timely data transfer.
Analogy: Food Outlet
- Front end = counter where orders are placed and received.
- Back end = kitchen (processing) and storage (ingredients/data).
- Orders (user inputs) are received, passed to the kitchen (processing), which fetches ingredients (data) and prepares the meal (output).
Front End and Back End Roles
- Front end is designed for ease of use and a welcoming user experience.
- Back end is responsible for receiving, processing, and retrieving data securely and efficiently.
- Most modern apps (like TikTok, WhatsApp) communicate continuously with back-end servers.
Communication Layer: The API
- The API acts as a standardized, secure interface between front end and back end.
- It validates, checks, and sends data; rejects incomplete or suspicious information.
- APIs ensure only authorized, correct data passes to the back end and back to the appropriate front end.
Data Flow and HTTP Methods
- User input on the front end is sent to the API, which forwards it to the back-end processor.
- Processor fetches/stores data from/to the database, then returns results via the API to the front end.
- APIs commonly use HTTP methods: GET (retrieve), POST (create), PUT (update), DELETE (remove), PATCH (partial update).
Technologies Used
- Front end: HTML, CSS, JavaScript (for cross-platform apps).
- API communicates using the HTTP protocol.
- Back end: Java, PHP, Python, .NET.
- Databases: SQL (MySQL, PostgreSQL, MSSQL) or NoSQL for large/unstructured data.
- Full stack development covers front end, API, and back end.
Key Terms & Definitions
- API (Application Programming Interface) — Communication layer between front end and back end of an app.
- Front End — The part of the app users interact with directly.
- Back End — Server-side of an app where data is processed and stored.
- Database — Storage system for app data, can be SQL or NoSQL.
- HTTP Methods — Standardized ways to communicate with an API (GET, POST, PUT, DELETE, PATCH).
Action Items / Next Steps
- Prepare to build a contact book app covering front end, API, and back end interactions.
- Review concepts of front-end development and HTTP methods.
- Practice using JavaScript for app communication tasks.