# Data Structures
## Classes design
### 1. Communities
This is the class with the most technical complexity.
As each community should have a direct lineage to the 0-level community, `<earthCommunityInstance>`, so as to create a chain where an issue can escalate till its topmost ancestor community.
#### + Options:
**Option 1: Create hierarchical class blueprint with each a subset of the parent community. **
##### Pros
- Space complexity O(N).
##### Cons
- Searching will be of O(N).
- Will increase depth of inheritance.
**Option 2: Create a class object where it contains a sorted (with regards to level of ancestry) array of descendants addresses and another of ancestors addresses.**
##### Pros
- Searching will be O(1) as long as you know the level of ancestry required.
- Insertion will be O(1). As object will inherit parent array of ancestors and since each descendant does not interact with
##### Cons
- Space Complexity O(Ancestors + Descendants)
- Deletion will be O(N)
**Option 3: Create a unique id per instance of community with the first characters being the `<parentTitle>` : this will recurse thus ensuring a new community instance will contain it's ancestral information with every descendant creation updating the descendants table***
##### Pros
- Deletion: O(N)
- Search: O(1) as you will know the
- Space: O(1)
#### + Discussing options:
+ Deletion:
Common logic dictates that deletions will rarely happen with communities being a fairly stable and taking a case study of reddit.
+ Space:
-- Option 2: This is a tricky variable;
In the short-term and medium term, with communities being low and the depth of trees being shallow; there will be no need to worry about the storage of ancestors and descendants array. But if in the long-term there exists an innumerable number of ancestors and descendants to a particular instance, the storage of the arrays with each iteration will grow the space with the rate of N-1 for each iteration. A community carrying addresses of a million ancestors will have to contend will carry 8 million bytes with it. Scaling will present a huge challenge.
+ Search:
Search will be of major concern as retrieval of communities will be important to user commands.
*The suitability of Option 3 shines out in part to its rate of space growth and its performance in frequent functions.*
### 2. Issue
Is also a crucial structure as it must be reliable, transparent.
an argument object will contain the issue for discord as well as the statistics of for and against votes. With the votes forming the basis of engagement it is sensitive and there is a need to ensure a strict way to modify them.
The argument object will also contain the method to initiate the debate session.
And since this object can be modified by various `<userInstance>` this needs to be protected against race conditions. Thus explore various multi-threading methods and access on the server side.
###### Some functions:
```
self.votingFor(votingUserInstance)
self.votingAgainst(votingUserInstance)
if self.qualifiedForDebate():
panelists = self.gatherPanelists()
self.debateSession = Debate(**panelists)
```
### 3. Debate
This will contain the information contained in a debate session on an `<issueInstance>` and the logic to the moderation of the session.
###### Some functions:
`self.authorizedPanelists() = {for: [] against: []}
self.postArgumentFor(userID, argumentTextFile)`
### 4. User
This class will define the `<userInstance>` active on the session and will contain the authorization details of a user.