I am working on a project that involves a "team builder" type application, if you will using C#.
For the sake of simplicity, let us say it involves the user creating a "Team." There are three teams to choose from.
Each team has "positions," for example, such as Captain, Shooter and Runner.
Each Captain has 3 possible choices, with different attributes such as "Name", "Skill" and "Age".
To give more of a visual representation of this:
- Team1
- =>CaptainATeam1
- ===>Name
- ===>Skill
===>Age
=>CaptainBTeam1
- ===>Name
- ===>Skill
===>Age
=>CaptaniCTeam1
- ===>Name
- ===>Skill
===>Age
Team2
- =>CaptainATeam2
- ===>Name
- ===>Skill
===>Age
=>CaptainBTeam2
- ===>Name
- ===>Skill
===>Age
=>CaptaniCTeam2
- ===>Name
- ===>Skill
- ===>Age
Now, all of these attributes would be predefined and never change. So, CaptainATeam1 will ALWAYS be "James", "Skillful", "22".
With all of that being said, this information would need to there for run-time usage. This application would not be connected to any type of database of some sort, and would run strictly as a stand alone application.
My question is what is the correct way to go about doing this?
The current thought I have is storing the data in a package with the application in the form of a flat-file for each team and position and having the application read them to memory at run time when needed.
But I have also considered creating the datasets within individual classes as well, with something similar to this (not tested and written quickly on Notepad, but the concept is there):
class Team1
var Captain;
var Shooter;
var Runner;
DataSet ds_team1 = new DataSet();
//used to populate a dataset to be used for a DropDown style selection list
public void PopulateCaptains()
{
DataTable dt_caps = new DataTable("Capitans");
dt_caps.Columns.Add("Name");
dt_caps.Columns.Add("Skill");
dt_caps.Columns.Add("Age");
DataRow dr_cap1 = new DataRow("Cap1");
DataRow dr_cap2 = new DataRow("Cap2");
DataRow dr_cap3 = new DataRow("Cap3");
dt_caps.Rows.Add(dr_cap1);
dt_caps.Rows.Add(dr_cap2);
dt_caps.Rows.Add(dr_cap1);
dr_cap1["Name"] = "James";
dr_cap1["Skill"] = "Skillfull";
dr_cap1["Age"] = "22";
//so on and so forth.
}
Obviously the example above would be very cumbersome coding wise as opposed to just writing a foreach
loop through flat files stored in the application's folder. However, that allows for the user to manipulate information in this file, causing the program to break.
So, what would be the correct approach to dealing with this?
IS there a correct way for dealing with this?
Note If this is considered way too much of a subjective or broad question, please let me know so I can either go look for more information, provide more information, or clarify anything.
Thank you for you time.