transparent
Programmer
I am writing a bespoke Contacts Information system.
The system will allow the user to search for companies, employees based on the data stored about them.
Each company will have a core set of information. For example Name, Head office address, telephone number. Each company will also have a collection of employees.
So I have defined a base class called Company
The Person Object is a base class which defines the core information/functionality:
In this case then I need to extend my Person and override the Read method so that it uses the exchange server
i.e.
To populate a companies Employees in the case of the acme corporation, once again I need to use the exchange server. Ordinarily I have to use a database, so I will extend the Company object
This is a little verbose - I have to override the base classes everytime a different data source is used. However by placing the data access code within these classes I force all data to adhere to my business rules.
Anyway. I have just been informed that different people within each company will be required to have different blocks of data associated with them. They could have any number of these blocks of information.
Example blocks of info:
1st Aid Knowledge
Experience with particular software etc
Spoken languages and fluency.
Every person wouldnt have all blocks of information
For example, a Medical Writer will have additional information about their previous publications etc etc, but not neccessarily info about 1st aid
I dont want to create one huge class to store all this information. I may be required to define additional blocks of information.
To complicate matters further, some of an individuals data may be stored in exchange server, and some of it in the database.
So to me, this would suggest a base class called person (as previously defined) with an additional collection of blocks of information.
Each block would be responsible for grabbing its own data from which ever source.
Does this sound like a good design?
I'm not sure how a person search could be implemented using this appraoch that would include all the data held in the blocks - I dont want to have to load in all the data into the system and then search!
What do people think?
The system will allow the user to search for companies, employees based on the data stored about them.
Each company will have a core set of information. For example Name, Head office address, telephone number. Each company will also have a collection of employees.
So I have defined a base class called Company
The type PersonCollection is a strongly typed collection of Person objects.class Company
{
private string name;
private string address;
private string telephone;
private string fax
private PersonCollection employees;
//Rest of code here
//CRUD methods
}
The Person Object is a base class which defines the core information/functionality:
All the People that work for my company (Acme) are currently registered with our exchange server, so rather than duplicate this data, my code will talk to the exchange server directly.class Person
{
public enum sex {male,female,other}
private string name;
private sex sex;
private int age;
//Other information
//contains CRUD methods
public virtual Read ()
{
//Grab data from the database
}
}
In this case then I need to extend my Person and override the Read method so that it uses the exchange server
i.e.
class AcmePerson : Person
{
//contains CRUD methods
public overrides Read ()
{
//Grab info from the exchange server
}
}
To populate a companies Employees in the case of the acme corporation, once again I need to use the exchange server. Ordinarily I have to use a database, so I will extend the Company object
class AcmeCompany : Company
{
//contains CRUD methods
public overrides Read ()
{
//Grab info from the exchange server
}
}
This is a little verbose - I have to override the base classes everytime a different data source is used. However by placing the data access code within these classes I force all data to adhere to my business rules.
Anyway. I have just been informed that different people within each company will be required to have different blocks of data associated with them. They could have any number of these blocks of information.
Example blocks of info:
1st Aid Knowledge
Experience with particular software etc
Spoken languages and fluency.
Every person wouldnt have all blocks of information
For example, a Medical Writer will have additional information about their previous publications etc etc, but not neccessarily info about 1st aid
I dont want to create one huge class to store all this information. I may be required to define additional blocks of information.
To complicate matters further, some of an individuals data may be stored in exchange server, and some of it in the database.
So to me, this would suggest a base class called person (as previously defined) with an additional collection of blocks of information.
Each block would be responsible for grabbing its own data from which ever source.
Does this sound like a good design?
I'm not sure how a person search could be implemented using this appraoch that would include all the data held in the blocks - I dont want to have to load in all the data into the system and then search!
What do people think?