owned this note
owned this note
Published
Linked with GitHub
**1. Functional Requirements**
---
**1.1 User Requirements**
---
**1.1.1 Browsing Programming Languages**
- **1.1.1.1** Users **shall be** able to browse a catalog of programming languages sourced from Wikidata.
- **1.1.1.2** Users **shall be** able to view detailed information about the language's origin.
- **1.1.1.3** Users **should be** able to filter programming languages based on attributes such syntactic similarity or domain of use.
- **1.1.1.4** Users **shall be** able to search for programming languages by name or attributes.
- **1.1.1.5** Users **should be** able to see related programming languages, such as predecessors, successors, or those with similar features.
- **1.1.1.6** Users **should be** able to compare multiple programming languages side by side and see the streghts and weaknesses.
- **1.1.1.7** Users **should be** able to bookmark or save programming languages for future reference.
- **1.1.1.8** Users **should be** able to report incorrect or outdated information.
- **1.1.1.9** Users **should be** able to access code examples or snippets associated with programming languages.
---
**1.1.2 Question Search**
- **1.1.2.1** Users **shall be** able to search for questions within the forum using keywords. Those keyword may be assigned by admins.
- **1.1.2.2** Users **should be** able to filter search results by date range, programming language, tags, or user.
- **1.1.2.3** Users **should be** able to sort search results by relevance(?), date posted, or number of responses.
- **1.1.2.4** Users **should be** able to receive suggestions for similar questions when viewing a question. (?)
- **1.1.2.5** Users **should be** able to save or bookmark search queries for future use. (?)
- **1.1.2.6** Users **shall be** able to search within specific forums or categories.
- **1.1.2.7** Users **should be** able to search for code snippets within questions and answers.
- **1.1.2.8** Users **should be** able to receive notifications for new questions matching their saved search criteria. (?)
- **1.1.2.9** Users **shall be** prevented from posting duplicate questions by being prompted with similar existing questions.
- **1.1.2.10** Users **should be** able to use advanced search operators (e.g., AND, OR, NOT) in their queries.
- **1.1.2.11** Users **should be** able to see highlighted search terms in the search results.
---
**1.2 System Requirements**
---
**1.2.1 Browsing Programming Languages Functionality**
- **1.2.1.1** The system **shall** retrieve programming language data from Wikidata.
- **1.2.1.2** The system **shall** provide a user interface that displays programming languages in an organized manner, such as lists or grids (or both).
- **1.2.1.3** The system **shall** allow users to view detailed information and basic examples about each programming language.
- **1.2.1.4** The system **shall** implement filtering functionality, enabling users to filter programming languages based on fundamental attributes.
- **1.2.1.5** The system **shall** implement a search function to search programming languages by name or attributes.
- **1.2.1.6** The system **should** display related programming languages based on predefined relationships in the data.
- **1.2.1.7** The system **should** allow users to compare multiple programming languages side by side.
- **1.2.1.8** The system **should** allow users to bookmark or save programming languages for future reference.
- **1.2.1.9** The system **should** provide an option for users to report incorrect or outdated information, which will be reviewed by administrators. (?)
- **1.2.1.10** The system **should** support localization, displaying data in different languages if available in Wikidata. (?)
- **1.2.1.11** The system **shall** ensure that the user interface for browsing is accessible and user-friendly.
- **1.2.1.12** The system **should** provide access to code examples or snippets associated with programming languages.
- **1.2.1.13** The system **should** allow users to customize the display settings for browsing programming languages. (?)
- **1.2.1.14** The system **shall** ensure data consistency and integrity when fetching and displaying information from Wikidata.
---
**1.2.2 Question Search Functionality**
- **1.2.2.1** The system **shall** provide a search functionality for users to search questions in the forum using keywords.
- **1.2.2.2** The system **shall** include filtering options in the search functionality, such as date range, programming language, tags, or user.
- **1.2.2.3** The system **shall** display search results matching the search criteria, including question title, brief excerpt, date, and number of answers.
- **1.2.2.4** The system **shall** allow users to sort search results by relevance, date posted, or number of responses.
- **1.2.2.5** The system **should** provide suggestions for similar questions when users are viewing a question.
- **1.2.2.6** The system **should** allow users to save or bookmark search queries for future use. (?)
- **1.2.2.7** The system **shall** enable users to search within specific forums or categories.
- **1.2.2.8** The system **shall** make the search functionality accessible from any page within the forum.
- **1.2.2.9** The system **should** highlight search terms in the search results.
- **1.2.2.10** The system **should** handle misspelled search queries by suggesting corrections.
- **1.2.2.11** The system **should** support advanced search operators (e.g., AND, OR, NOT).
- **1.2.2.12** The system **shall** prevent duplicate questions by prompting users with similar existing questions when they attempt to post a new question.
- **1.2.2.13** The system **shall** ensure that search performance is optimized to return results promptly.
- **1.2.2.14** The system **should** allow users to search for code snippets within questions and answers.
- **1.2.2.15** The system **should** provide a "Did you mean..." feature for ambiguous or unclear search terms.
- **1.2.2.16** The system **should** respect user permissions and privacy settings, displaying only content the user has access to.
- **1.2.2.17** The system **should** allow users to receive notifications for new questions matching their saved search criteria. (?)
- **1.2.2.18** The system **shall** index all forum content regularly to maintain up-to-date search results.
- **1.2.2.19** The system **should** integrate with the code execution platform to allow searching for runnable code examples.
---
*Requirements marked with (?) are open to change.*
# Diagrams for Browsing Programming Languages and Question Search
### **2.1 Browsing Programming Languages Use Case**
```mermaid
flowchart
User --> BrowseLanguages;
BrowseLanguages -. "include" .-> FilterLanguages;
BrowseLanguages -. "include" .-> SearchLanguages;
BrowseLanguages -. "include" .-> ViewRelatedLanguages;
BrowseLanguages -. "include" .-> CompareLanguages;
BrowseLanguages -. "include" .-> BookmarkLanguages;
BrowseLanguages --> ViewLanguageDetails;
ViewLanguageDetails -. "extend" .-> ReportIncorrectInfo;
ViewLanguageDetails -. "extend" .-> ViewCodeSnippets;
ViewLanguageDetails -. "extend" .-> CustomizeView;
```
**Explanation:**
- **User** initiates the **BrowseLanguages** use case.
- **BrowseLanguages** includes functionalities like:
- **FilterLanguages**
- **SearchLanguages**
- **ViewRelatedLanguages**
- **CompareLanguages**
- **BookmarkLanguages**
- **BrowseLanguages** leads to **ViewLanguageDetails**.
- **ViewLanguageDetails** can be extended with:
- **ReportIncorrectInfo**
- **ViewCodeSnippets**
- **CustomizeView**
---
### **2.2 Question Search Use Case**
```mermaid
flowchart
User --> SearchQuestions;
SearchQuestions -. "include" .-> FilterSearchResults;
SearchQuestions -. "include" .-> SortSearchResults;
SearchQuestions -. "include" .-> SearchWithinForums;
SearchQuestions -. "include" .-> UseAdvancedSearch;
SearchQuestions -. "include" .-> SearchCodeSnippets;
SearchQuestions --> ViewQuestionDetails;
ViewQuestionDetails -. "extend" .-> SaveSearchQueries;
ViewQuestionDetails -. "extend" .-> ReceiveNotifications;
ViewQuestionDetails -. "extend" .-> ViewSimilarQuestions;
ViewQuestionDetails -. "extend" .-> PreventDuplicateQuestions;
```
**Explanation:**
- **User** initiates the **SearchQuestions** use case.
- **SearchQuestions** includes functionalities like:
- **FilterSearchResults**
- **SortSearchResults**
- **SearchWithinForums**
- **UseAdvancedSearch**
- **SearchCodeSnippets**
- **SearchQuestions** leads to **ViewQuestionDetails**.
- **ViewQuestionDetails** can be extended with:
- **SaveSearchQueries**
- **ReceiveNotifications**
- **ViewSimilarQuestions**
- **PreventDuplicateQuestions**
---
### **3. Class Diagram**
```mermaid
classDiagram
class User {
+userID: int
+username: string
+email: string
+bookmarkLanguage(languageID: int)
+searchQuestions(query: string)
+reportIncorrectInfo(languageID: int, report: string)
}
class ProgrammingLanguage {
+languageID: int
+name: string
+creator: string
+yearCreated: int
+paradigm: string[]
+typingDiscipline: string
+influencedBy: string[]
+influenced: string[]
+getDetails(): LanguageDetails
}
class LanguageDetails {
+languageID: int
+description: string
+codeExamples: string[]
+relatedLanguages: string[]
+displayDetails()
}
class Bookmark {
+userID: int
+languageID: int
+dateBookmarked: Date
}
class SearchQuery {
+queryText: string
+filters: FilterOptions
+executeSearch(): SearchResult[]
}
class FilterOptions {
+dateRange: DateRange
+languages: string[]
+tags: string[]
+applyFilters()
}
class SearchResult {
+questionID: int
+title: string
+excerpt: string
+datePosted: Date
+numberOfAnswers: int
}
class Question {
+questionID: int
+title: string
+body: string
+datePosted: Date
+tags: string[]
+codeSnippets: string[]
}
User --> ProgrammingLanguage : views
User --> Bookmark : creates
User --> SearchQuery : initiates
SearchQuery --> SearchResult : returns
SearchResult --> Question : links to
ProgrammingLanguage --> LanguageDetails : provides
ProgrammingLanguage --> ProgrammingLanguage : related to
User --> Question : posts, views
```
**Explanation:**
- **User** interacts with **ProgrammingLanguage**, can **bookmark** languages, and **search** for questions.
- **ProgrammingLanguage** provides **LanguageDetails**, which include descriptions and code examples.
- **SearchQuery** uses **FilterOptions** to refine the search and returns **SearchResult**.
- **SearchResult** links to **Question**, which contains the full details.
- **ProgrammingLanguage** may be related to other programming languages.
---
### **4. Sequence Diagram**
#### **4.1 Browsing Programming Languages Sequence Diagram**
```mermaid
sequenceDiagram
participant User
participant Browser
participant PageController
participant WikidataAPI
participant LanguageController
participant Database
User->>Browser: Navigate to Browse Languages
Browser->>PageController: Request BrowseLanguages Page
PageController->>WikidataAPI: Fetch Language List
WikidataAPI->>PageController: Return Language Data
PageController->>LanguageController: Process Language Data
LanguageController->>Database: Store/Update Languages
LanguageController->>Browser: Display Language List
User->>Browser: Apply Filters/Search
Browser->>LanguageController: Request Filtered/Search Results
LanguageController->>Database: Query with Filters/Search Terms
Database->>LanguageController: Return Filtered Language Data
LanguageController->>Browser: Display Filtered Language List
User->>Browser: Select Language for Details
Browser->>LanguageController: Request Language Details
LanguageController->>Database: Retrieve Language Details
LanguageController->>Browser: Display Language Details
User->>Browser: ViewCodeSnippets/ReportIncorrectInfo/CustomizeView
```
#### **4.2 Question Search Sequence Diagram**
```mermaid
sequenceDiagram
participant User
participant Browser
participant SearchController
participant ForumDatabase
participant WikidataAPI
participant ResultPage
User->>Browser: Enter Search Query
Browser->>SearchController: Submit Query
SearchController->>ForumDatabase: Search Questions
ForumDatabase->>SearchController: Return Question Results
SearchController->>WikidataAPI: Search Wikidata (if applicable)
WikidataAPI->>SearchController: Return Wikidata Results
SearchController->>ResultPage: Compile and Send Results
ResultPage->>Browser: Display Results
User->>Browser: Apply Filters/Sort Options
Browser->>ResultPage: Request Updated Results
ResultPage->>SearchController: Process Filters/Sort
SearchController->>ForumDatabase: Query with Filters/Sort
ForumDatabase->>SearchController: Return Updated Results
SearchController->>ResultPage: Send Updated Results
ResultPage->>Browser: Display Updated Results
User->>Browser: ViewQuestionDetails
Browser->>ForumDatabase: Retrieve Question Details
ForumDatabase->>Browser: Send Question Details
Browser->>User: Display Question Details
User->>Browser: SaveSearchQueries/ReceiveNotifications
```
**Explanation:**
- **Browsing Programming Languages:**
- The **User** navigates to browse languages.
- The **PageController** fetches data from **WikidataAPI**.
- Data is processed by **LanguageController** and stored in the **Database**.
- The **User** can apply filters or search terms, and the system updates the displayed languages accordingly.
- When a language is selected, detailed information is retrieved and displayed.
- **Question Search:**
- The **User** enters a search query.
- The **SearchController** searches the **ForumDatabase** and may also query **WikidataAPI**.
- Results are compiled and displayed on the **ResultPage**.
- The **User** can apply filters or sorting options to refine results.
- Upon selecting a question, details are retrieved from the **ForumDatabase** and displayed.
---