The AR4T Classroom: A Scheme of Work [proto-type:beta]

The AR4T Classroom: A Scheme of Work

The AR4T Classroom: A Scheme of Work

1. The Project Concept

This document outlines a two-week project-based learning plan for a programming class. It uses the "A Radically-reduced Text" (AR4T) paradigm to empower students to build a feature-rich, self-contained Python application, while abstracting away complex backend services. The goal is to let students focus on UI/UX, application logic, and database fundamentals, using a workflow modelled on the industry-standard GitHub Flow.

Students will each build a simple "Report Writer" GUI application within a single Python file. This application will allow them to write, save, load, and even get AI-powered summaries of their reports.

The Innovation: The student's main application class inherits from a `BaseView` class provided by the teacher. This inheritance automatically and safely "injects" all necessary services (like the database and the AI summarizer) into the student's project without them needing to write any complex setup code. This mimics the early, empowering days of web development where everything was in one HTML file, but brings in modern concepts like Clean Architecture and Dependency Injection in an accessible way.

2. The Teacher's Role & Setup (services.py)

The teacher's primary role is to act as the Project Maintainer and to provide the core services that the students will use. The setup requires creating one crucial file, `services.py`, which contains the "magic" that students will access.

The Teacher's "Black Box" Module

# services.py - Provided by the teacher

import sqlite3
import requests
from PyQt6.QtWidgets import QWidget

# 1. Concrete Service Implementations
class SQLiteReportRepository:
    """Handles all database operations."""
    def __init__(self, db_path="class_project.db"):
        self._conn = sqlite3.connect(db_path)
        self._conn.execute("""CREATE TABLE IF NOT EXISTS reports (...)""")
        self._conn.commit()
    # ... (methods for save, get, etc.)

class FictionalAIService:
    """Handles calling the external AI summarization API."""
    def __init__(self, api_key):
        self._api_key = api_key
    def summarize(self, text):
        # ... (implementation for calling requests.post)
        return "This is an AI summary."

# 2. The Dependency Container
class AppContainer:
    """The master container that builds and provides all services."""
    def __init__(self, api_key):
        self.db_repo = SQLiteReportRepository()
        self.ai_service = FictionalAIService(api_key=api_key)
    def get_report_repository(self):
        return self.db_repo
    def get_ai_summarizer(self):
        return self.ai_service

# 3. The Base Class for Inheritance
class BaseView(QWidget):
    """The base class that all student views will inherit from."""
    def __init__(self, app_container: AppContainer, parent=None):
        super().__init__(parent)
        self._app_container = app_container
    def get_repo(self):
        return self._app_container.get_report_repository()
    def get_summarizer(self):
        return self._app_container.get_ai_summarizer()

3. The Student's World (report_writer.py)

Each student receives a starter version of this file. Their task is to build out the application logic and UI, focusing on the creative aspects of development.

The Student's Main Application File

# report_writer.py - The student's world

import sys
from PyQt6.QtWidgets import QApplication, QMainWindow, QTextEdit, QPushButton, QVBoxLayout, QLineEdit
# The ONLY imports the student needs from the teacher's file
from services import BaseView, AppContainer

# The student's main window inherits from the teacher-provided BaseView
class MainWindow(BaseView):
    def __init__(self, app_container: AppContainer):
        # The app_container is passed up to the parent, which handles it
        super().__init__(app_container)

        # --- Student's Focus: UI Design ---
        self.setWindowTitle("My Report Writer")
        self.title_input = QLineEdit()
        self.content_editor = QTextEdit()
        self.save_button = QPushButton("Save Report")
        # ... UI layout setup ...

        # --- Student's Focus: Application Logic ---
        self.save_button.clicked.connect(self.save_report_action)

    def save_report_action(self):
        title = self.title_input.text()
        content = self.content_editor.toPlainText()
        
        # Student uses the INHERITED method to get the repository
        # They don't know or care how it's made!
        repo = self.get_repo()
        repo.save_report(title, content)
        print(f"Report '{title}' saved!")

# --- The Composition Root (pre-written for the student) ---
if __name__ == "__main__":
    app = QApplication(sys.argv)
    api_key = "STUDENT_API_KEY"
    main_container = AppContainer(api_key=api_key)
    window = MainWindow(app_container=main_container)
    window.show()
    sys.exit(app.exec())

4. Two-Week Scheme of Work

This schedule breaks the project into manageable daily tasks, guiding students from basic setup to advanced feature integration and collaborative development.

Week 1: Foundations & Core Features

Day(s) Topic Student Activities Teacher Focus
1 Project Kick-off & Git Setup Clone the main repository. Create a personal feature branch (`git checkout -b feature/student-name`). Introduce the project goal and AR4T concept. Guide Git setup.
2 Intro to PyQt6 & UI Basics Add basic widgets (QLineEdit, QTextEdit, QPushButton) to MainWindow and arrange them. Teach GUI fundamentals: widgets, layouts, and the event loop.
3-4 Application Logic & Event Handling Connect button clicks to placeholder methods. Use `print()` to test connections. Explain event-driven programming. Show how to link a UI event to a Python function.
5 Database Interaction & SQL Implement the `save_report_action` method. Use `self.get_repo()` to get the repository and call its methods. Teach basic SQL (INSERT, SELECT). Explain how the repository abstracts the database connection.

Week 2: Advanced Features & Collaboration

Day(s) Topic Student Activities Teacher Focus
6 Integrating External Services Implement the `summarize_report_action` method. Use `self.get_summarizer()` to call the AI service. Explain the concept of an API. Show how the injected service makes using a complex API a one-line call.
7 Independent Feature Work Work on a unique feature: adding a report list, a delete button, character count, etc. Circulate and provide individual support. Encourage creative problem-solving.
8 GitHub Flow: Pull Requests Commit all changes. Push the branch. Create a Pull Request on GitHub. Teach the purpose of a Pull Request (PR). Demonstrate how to write a clear PR description.
9 Peer Review & Collaboration Review a classmate's Pull Request, leaving constructive comments on the code and UI. Model a constructive code review. Emphasize giving positive feedback and asking clarifying questions.
10 The Merge & Project Showcase The teacher reviews PRs and merges the best features into the main branch, creating a "class version". Lead a session where the class showcases their individual features and the final merged application.

Comments

Popular posts from this blog

Code-Gurus Wanted: Bridging the gap - supporting the transition.

Using throw away app to help me get back into the vibe space post stack/structure/perfection enlightenment

Re-finding my coding muse: step 1