Hi! Im planning to design a project (n-tier) that is easy to customize and maintain without compromising efficiency... here is the draft of my (unique :)) design layout base on what I learned on how to built ntierarchitecture...
The project is composed of 3 DLLs (+1 for Helper Classes) and the UI
BusinessRules.dll (Compose of 2 subfolders ValueObjects(DTO) and BusinessObjects)
AppDomainRules.dll (i put here the domain driven classes like registration, admission, sale service classes, will use the Business Objects and VOs)
DataAccessLayer.dll here is the code:
// in BusinessRules.DLL, sub folder ValueObject
public class Person
{
// getters and setters
public string ID { get; set; }
public string Name { get; set; }
}
// in BusinessRules.DLL, sub folder Business Objects
public class PersonBLL
{
public void AddNewPerson(Person Person)
{
new PersonDAL().SaveNewPerson(Person);
}
//side-question:
//should I inherit the Person VO and do it like this
//public void AddNewPerson()
//{
// new PersonDAL().SaveNewPerson(this);
//}
// which is more efficient???
}
// in DataAccessLayer.DLL
public class PersonDAL
{
public void SaveNewPerson(Person Person)
{
// Save to DB
}
}
// in AppDomainRules.DLL, base class
public abstract class RegistrationTemplate
{
public virtual void RegisterNewPerson(Person m)
{
new PersonBLL().AddNewPerson(m);
}
}
//Client 1 registration domain logic
public class RegistrationForClient1 : RegistrationTemplate
{
// will use the template
}
// Client 2 registration domain logic
public class RegistrationForClient2 : RegistrationTemplate
{
// overrides the template
public override void RegisterNewPerson(Person m)
{
// change the behavior of PersonBLL.AddNewPerson
// different implementation
}
}
// UI Implementation for Client1
static void Main(string[] args)
{
Person m = new Person()
{
ID = "1",
Name = "John Mortred"
};
new RegistrationForClient1().RegisterNewPerson(m);
}
My priorities/Goals are: 1. Efficiency 2. Maintainability / Customizable / Reliable /Scalability 3. RAD (fast development of the system)
My questions: In your opinion, 1. Is the design flawed? how about code efficiency? performance? 2. Do I violate some rules on OOP archi or Tiered design? 3. Is this design Loosely/ Low coupled? 4. Can I achieve my Goals using this? 5. Suggestions?
thanks in advance :)