boy in green shirt
Photo by CDC on Pexels.com

[Class Report] Introduction to System Development – Week 23: Mini API Integration Projects – Presentation & Improvement

In the 23rd week of class, students presented and improved their mini-projects using external APIs learned the previous week (e.g., weather apps and quote generators). The focus was on creating functional apps while enhancing error handling and usability — a highly practical session.


■ Instructor’s Opening: “APIs are a ‘connecting power,’ but require caution”

Prof. Tanaka:
“Connecting to external services can greatly enhance an app’s value. But we also need to anticipate connection errors and unexpected data. Today, let’s not just make things ‘work’ — let’s make them robust.”


■ Presentation Time: Team Demos and Notable Features

Each student team presented their self-made apps in turn. Here are some highlights and class reactions:

  • Weather App Team:
    Displays current weather and temperature based on city input. They implemented a “Loading…” message during fetch and handled cases where the city wasn’t found.
    Feedback: “Having a loading screen is reassuring when the internet is slow!”

  • Random Quote App Team:
    Fetches one quote via an API, and falls back to a local quote list if the API is down.
    Feedback: “Now I understand the value of not depending entirely on external services!”

  • Translation + Display Workflow Team:
    Sends short sentences to a translation API and displays the result. They explained how they handled auth errors and length restrictions on output.
    Feedback: “I realized how important it is to design around API limitations like character limits.”


■ Technical Practice: Implementation Tips for Reliability

Key coding practices discussed and improved during the session:

1) Timeouts and Exception Handling

Always assume that external communication may fail. Example using requests (pseudocode for learning):

import os
import requests

API_URL = "https://api.example.com/weather"
API_KEY = os.getenv("API_KEY")  # Use environment variables for secrets

try:
    resp = requests.get(API_URL, params={"q": "Tokyo", "appid": API_KEY}, timeout=5)
    resp.raise_for_status()  # Raise error if not 2xx status
    data = resp.json()
    # Safely access nested JSON (handle missing keys)
    temp = data.get("main", {}).get("temp")
    if temp is None:
        print("Temperature data could not be retrieved.")
    else:
        print(f"Current temperature: {temp}℃")
except requests.exceptions.Timeout:
    print("The request timed out. Please try again later.")
except requests.exceptions.RequestException as e:
    print(f"A communication error occurred: {e}")

2) Fallback Strategy

Teams implemented fallback options (e.g., local cache) to maintain user experience when APIs were unavailable.

3) Rate Limiting and Caching

To avoid frequent API calls, some teams cached responses for identical queries using an in-memory dictionary — a practical strategy in the classroom setting.


■ Usability Improvements: Interface and Messaging

Besides technical improvements, time was given to enhance the app from the user’s point of view.

  • Replace generic messages like “Error occurred” with specific ones like “Could not retrieve information due to [reason]. Please try again later.”
  • Extract and display only essential parts of long JSON responses for better readability
  • Show helpful tips or usage instructions while the network is loading to reduce drop-off

Student Comment:
“Just improving the error message got me praise from the teacher for being user-friendly!”


■ Instructor’s Note

“Apps that connect to external services are powerful, but also increase design complexity due to external dependencies. Today, we focused on the three essentials for developers:
robustness (error handling),
usability (guidance & fallback), and
rule compliance (API keys, rate limits).”


■ Coming Up Next: Introduction to Generative AI (Prep Session)

Next week, students will be introduced to the fundamentals of generative AI, a topic usually covered in the third year. We’ll explore:

  • What is generative AI?
  • Ethics and responsible use
  • Differences between REST APIs and model APIs
  • Prompt design basics

Week 23 connected students to the “outside world.” They experienced not only the joy of integration but also the responsibility it entails, sparking curiosity for what’s to come.

By greeden

Leave a Reply

Your email address will not be published. Required fields are marked *

日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)