Description
Problem
OpenCSE currently provides learning resources, notes, and documentation for various Computer Science and Engineering subjects. However, users do not have a built-in environment to practice and execute code while learning programming concepts.
Learners often need to switch between OpenCSE and external platforms or IDEs to test code, which interrupts the learning flow.
Proposed Solution
Introduce a dedicated Code Playground page that allows users to write, execute, and test code directly within OpenCSE.
The playground should provide an interactive coding environment that complements existing learning resources and enables hands-on experimentation.
Features
Phase 1 (Initial Implementation)
- Add a Code Playground link/button to the navigation bar.
- Create a dedicated route/page for the playground.
- Add a code editor area.
- Add language selection support.
- Add a Run Code button.
- Add an output console.
- Maintain consistency with the existing OpenCSE design language.
Phase 2 (Enhanced Experience)
- Monaco Editor integration.
- Multiple programming language support.
- Input section for custom test cases.
- Output formatting improvements.
- Save and restore code sessions.
Proposed Architecture
+------------------+
| User |
+--------+---------+
|
v
+------------------+
| Navigation Bar |
| Code Playground |
+--------+---------+
|
v
+------------------+
| Playground Page |
+--------+---------+
|
v
+----------------------------+
| Code Editor |
| (Monaco Editor) |
+-------------+--------------+
|
v
+----------------------------+
| Language Selector |
+-------------+--------------+
|
v
+----------------------------+
| Run Code Button |
+-------------+--------------+
|
v
+----------------------------+
| Code Execution Service/API |
| (Judge0 / Piston / etc.) |
+-------------+--------------+
|
v
+----------------------------+
| Output Console |
+----------------------------+
User Flow
OpenCSE
|
v
Code Playground
|
v
Write Code
|
v
Select Language
|
v
Run Code
|
v
Execution Engine
|
v
Display Output
Benefits
- Enables hands-on learning directly within OpenCSE.
- Reduces dependency on external IDEs and coding websites.
- Improves learner engagement.
- Supports practical understanding of programming concepts.
- Creates a foundation for future coding-related features.
Possible Future Enhancements
- Monaco Editor integration
- Custom input support
- Test case execution
- Practice problems
- Save code functionality
- Share code snippets
- Coding challenges
- AI-assisted code explanations
Technical Considerations
Possible approaches for code execution:
-
Judge0 API
- Easy integration
- Supports multiple languages
- Secure sandboxed execution
-
Piston API
- Open-source
- Lightweight integration
-
Self-hosted Docker-based runner
- Maximum control
- Higher maintenance requirements
Judge0 or Piston may be suitable for the initial implementation due to simplicity and broad language support.
Description
Problem
OpenCSE currently provides learning resources, notes, and documentation for various Computer Science and Engineering subjects. However, users do not have a built-in environment to practice and execute code while learning programming concepts.
Learners often need to switch between OpenCSE and external platforms or IDEs to test code, which interrupts the learning flow.
Proposed Solution
Introduce a dedicated Code Playground page that allows users to write, execute, and test code directly within OpenCSE.
The playground should provide an interactive coding environment that complements existing learning resources and enables hands-on experimentation.
Features
Phase 1 (Initial Implementation)
Phase 2 (Enhanced Experience)
Proposed Architecture
User Flow
Benefits
Possible Future Enhancements
Technical Considerations
Possible approaches for code execution:
Judge0 API
Piston API
Self-hosted Docker-based runner
Judge0 or Piston may be suitable for the initial implementation due to simplicity and broad language support.