---
# System prepended metadata

title: SLogo_Team07 Design.md

---

# SLogo_Team07 Design.md

## What are the project's design goals, specifically what kinds of new features did you want to make easy to add

 ### Frontend

One aspect of the project we wanted to design such that it was easy to read and very flexible was the instructions page and the tables associated with each command type. In order to accomplish this, factory and inheritance was used to be as general as possible, with each command instruction listed inside of a properties file to be read off.
    
### Backend
The backend is structured to process user input in a linear, streamlined fashion. It must enable easy addition of new command object, interpreting a new language as well as leaving flexibility for adding controls on program flow.

## 2. Describe the high-level design of your project, focusing on the purpose and interaction of the core classes

## Frontend
The MainWindow class also creates the help screen when the help button is clicked on the main window, which creates a new HelpScreen object that has its own stage and scene. From there, additional tables can be viewed as the instruction set is loaded directly from the HelpScreen class.
    
## Backend
The string user input is passed from the front end to controller, which is then passed into interpreter.

Interpreter parses and translates the user string input into a tree of command object, where each node represents a command and the children of each node are the parent command's argument. Interpreter returns the root of this command tree to the controller.

The controller then passes the command tree node to executor, which will start calculate and execute actions embedded in the command in a reverse DFS fashion. The executor creates appropriate number of turtle object and passes them into each command and execute them.These command return the same turtle objects with modified states. And executor returns these turtles to controller for frontend visualization.
    
A turtle class contains an list of turtlestates which is called turtleHistory. Each state in turtle history contains basic information about the turtle including its x,y position, pen status, turtleshowing status etc.

As the action of each command is carried out, a new turtlestates will be added to the turtle object passed into the command.

The command returns the turtle object with added states back to executor.

## 3. What assumptions or decisions were made to simplify your project's design, especially those that affected adding required features

## Frontend
In implementing the help section, we assumed that each of the instructions needed no more than four columns to display all the information. Additionally, we also assumed that there would be no “@” signs in any of the instructions so that we could split the strings via “@” signs. Neither of these assumptions complicated or affected the extensions in any way.
    
## Backend
Design wise I think backend has a pretty compact structure. Not much simplications are made.


### 4. Describe, in detail, how to add new features to your project, especially ones you were not able to complete by the deadline


## Frontend
In implementing the help section, we assumed that each of the instructions needed no more than four columns to display all the information. Additionally, we also assumed that there would be no “@” signs in any of the instructions so that we could split the strings via “@” signs. Neither of these assumptions complicated or affected the extensions in any way.

## Backend
 - Unlimited argument. 
     - Because our command tree is structured in a way that all children are argument to its parent. To be able toaccommodate a variable number of argument, the addCommandNode() method under interpreter will be needed to modified. When more than enougharguments are offered for the current command, the method needs to decide whether giving these additional argument to current method or giving them to the parent command thats still needing argument. This potential source of ambiguity is one major reason that stops me from implementing this feature.


- Recursion. 
    - An additional local variable tracker needs to be added to executor in order to differentiate between the same variable of different levels of recursion. Right now the program cannot identify predefined variables in deeper levels of recursion.
