Loading...
Based on the requirements and use cases, identify the main objects of the system and analyze how they interact and relate to each other...
### 1. **Students** - The Learner Entity
**Purpose**: Primary actors who consume educational content and participate in assessments
Key Attributes:
id: Unique system identifier
name: Full name for identification
mobile: Contact information for notifications
Core Responsibilities:
Register in the system and create profiles
Enroll in multiple courses simultaneously
Access course content through modules and lessons
Attempt quizzes and receive grades
Track learning progress across courses
Receive notifications and updates
Relationships:
1 → * QuizAttempts (one student can attempt many quizzes)
* → * Courses (many-to-many enrollment via EnrollmentService)
1 → * LearningProgress (one student has progress in many courses)
Business Rules:
Maximum 10 concurrent courses per student
Cannot enroll in archived courses
Must complete prerequisites before accessing advanced content
2. Teacher - The Instructor Entity
Purpose: Content creators and course managers who design and deliver educational experiences
Key Attributes:
id: Unique system identifier
name: Full name for course attribution
mobile: Contact information for system notifications
Core Responsibilities:
Create and manage multiple courses
Design course structure with modules and lessons
Create and manage quizzes and assessments
Track student progress and performance
Publish and archive courses based on demand
Relationships:
1 → * Courses (one teacher creates and manages many courses)
1 → * Quizzes (one teacher creates assessments for their courses)
1 → * Modules (indirectly through course ownership)
Business Rules:
Teachers can only modify their own courses
Cannot delete courses with active enrollments
Must ensure course content meets quality standards
3. Course - The Learning Container
Purpose: Primary educational container that organizes content, manages enrollment, and controls access
Key Attributes:
id: Unique course identifier
name: Course title for discovery
description: Detailed course overview
instructor: Assigned teacher reference
price: Course pricing information
category: Subject area classification
level: Difficulty level (beginner, intermediate, advanced)
moduleList: Collection of learning modules
currentState: Lifecycle state (Draft/Published/Archived)
Core Responsibilities:
Organize content through modular structure
Manage enrollment through state-based access control
Track overall course metrics and student performance
Control course lifecycle (publish/archive)
Host assessments and track completion rates
Relationships:
* → 1 Teacher (many courses to one teacher)
1 → * Modules (one course contains many modules)
* → * Students (many-to-many via enrollment)
1 → 1 CourseState (composition for lifecycle management)
Business Rules:
Draft courses cannot accept enrollments
Published courses allow unlimited enrollment until capacity reached
Archived courses cannot accept new enrollments but retain existing data
Courses must have at least one module before publishing
4. Module - The Learning Unit Container
Purpose: Organizes related lessons into logical units and provides structural hierarchy
Key Attributes:
id: Unique module identifier
name: Module title for navigation
description: Module overview and objectives
courseId: Reference to parent course
lessonList: Ordered collection of lessons
Core Responsibilities:
Organize lessons in logical sequence
Provide learning unit boundaries
Track completion progress at module level
Enable prerequisite validation between modules
Support different learning paths within courses
Relationships:
* → 1 Course (many modules belong to one course)
1 → * Lessons (one module contains many lessons)
1 → * ModuleProgress (one module has progress tracking for many students)
Business Rules:
Modules must have at least one lesson
Lessons within modules maintain sequential order
Module completion requires all lessons to be completed
Cannot delete modules with active student progress
5. Lesson - The Individual Learning Content
Purpose: Delivers specific educational content through various media types
Key Attributes:
id: Unique lesson identifier
name: Lesson title
description: Learning objectives and content overview
videoUrl: Content delivery URL (video, text, interactive)
moduleId: Reference to parent module
quizList: Associated assessments
Core Responsibilities:
Deliver educational content through Template Method pattern
Validate student prerequisites before content access
Track individual lesson completion and engagement
Host lesson-specific assessments
Support different content delivery strategies
Relationships:
* → 1 Module (many lessons belong to one module)
1 → * Quizzes (one lesson can have multiple assessments)
1 → * LessonProgress (one lesson has progress for many students)
Business Rules:
Lessons must have accessible content URLs
Prerequisites must be satisfied before lesson access
Lesson completion requires content engagement validation
Cannot modify lessons with active quiz attempts
Template Method Pattern Implementation:
public final LearningResult deliver(Students student) {
validatePrerequisites(student); // Hook method
ContentDeliveryResult result = deliverContent(student); // Abstract method
return processResult(result); // Common processing
}
6. Quiz - The Assessment Tool
Purpose: Evaluates student knowledge and skills through structured assessments
Key Attributes:
id: Unique quiz identifier
totalMarks: Maximum possible score
passingMarks: Minimum score for completion
questions: Collection of assessment items
Core Responsibilities:
Define assessment criteria and scoring
Track student attempts and results
Calculate grades through strategy pattern
Support different quiz types (formative, summative)
Generate performance analytics
Relationships:
* → 1 Lesson (many quizzes can be associated with one lesson)
1 → * Questions (one quiz contains many questions)
1 → * QuizAttempts (one quiz attempted by many students)
Business Rules:
Quizzes must have at least one question
Total marks must equal sum of all question marks
Passing marks cannot exceed total marks
Quiz attempts have time limits and attempt restrictions
7. Questions - The Assessment Items
Purpose: Individual assessment items that evaluate specific knowledge points
Key Attributes:
id: Unique question identifier
name: Question title or prompt
description: Additional context or instructions
type: Question format (MCQ, Essay, True/False, Fill-in-blank)
options: Available choices for MCQ questions
marks: Point value for correct answers
ans: Correct answer or evaluation criteria
Core Responsibilities:
Define specific assessment content
Provide correct answers for automated grading
Support different question types and formats
Enable partial scoring for complex questions
Track question performance analytics
Relationships:
* → 1 Quiz (many questions belong to one quiz)
1 → * StudentAnswers (one question answered by many students)
Business Rules:
Questions must have clear, unambiguous correct answers
MCQ questions must have at least 2 options
Essay questions require manual grading
Questions cannot be modified after quiz attempts begin
🔄 Supporting Objects & Patterns
QuizAttempt - Assessment Context
Purpose: Tracks individual student quiz sessions with state management
Key Attributes:
currentState: Quiz lifecycle state
student: Reference to attempting student
quiz: Reference to quiz being attempted
answers: Student's responses to questions
startTime: When the attempt began
endTime: When the attempt was submitted
State Pattern Implementation:
NotStartedState: Quiz ready to begin
InProgressState: Student actively answering
SubmittedState: Quiz completed, awaiting grading
GradedState: Quiz evaluated with final score
LearningResult - Delivery Outcome
Purpose: Captures lesson delivery results with performance metrics
Key Attributes:
completed: Whether lesson was successfully completed
completionTime: Time taken to complete lesson
engagementScore: Student engagement metrics
`comprehensionScore**: Understanding assessment
ContentDeliveryResult - Content Performance
Purpose: Tracks content delivery performance metrics
Key Attributes:
success: Whether content was delivered successfully
completionTime: Time taken for content delivery
bandwidthUsed: Network resources consumed
errorMessages: Any delivery issues encountered
For each class, define the attributes (data) it will hold and the methods (functions) that operate on the attributes. Ensure they align with the object's responsibilities and adhere to the principle of encapsulation. Write your code in the code editor below.
Explain design tradeoffs you considered. Check and explain whether your design adheres to SOLID principles. Explain how your design can handle changes in scale and whether it would be easy to extend with new functionalities. Identify areas for future improvement...
## Design Patterns Summary
🎯 Command Pattern
Components: Command, CommandImpl, CommandInvoker
Usage: Undoable quiz addition and student enrollment
Benefits: Encapsulates operations as objects, supports undo/redo
🔄 State Pattern
Course States: DraftCourse → PublishCourse → ArchiveCourse
Quiz States: NotStartedState → InProgressState → SubmittedState → GradedState
Benefits: Clean state transitions, encapsulates state-specific behavior
🎲 Strategy Pattern
Components: GradingStrategy, AutoGradeingService, GradingService
Usage: Swappable grading algorithms
Benefits: Easy to extend with new grading strategies
🏛️ Facade Pattern
Component: LMSManager
Usage: Single entry point for all LMS operations
Benefits: Simplified API, hides complexity