효율성을 떨어 뜨리지 않고도 쉽게 사용자 지정하고 유지 관리 할 수있는 프로젝트 (n-tier)를 계획하고 있습니다 ... 여기 내 디자인 클래스 초안이 있습니다. 내가 어떻게 구축 할 ntierarchitecture에 배운 내용에 기초 ... 2 하위 폴더 ValueObjects의다중 계층 응용 프로그램 디자인 (템플릿 스타일)
프로젝트는 3 DLL을 (도우미 클래스에 대한 +1)와 UI로 구성되어이
BusinessRules.dll (작성 (DTO) 및 BusinessObjects)
응용 프로그램 DomainRules.dll는
DataAccessLayer.dll 여기 코드입니다 (난, 비즈니스 개체 및 VO로를 사용합니다 판매 서비스 클래스 등록, 입학, 같은 여기에 도메인 중심의 수업을 넣어) :
// BusinessRules.DLL에서, 하위 폴더 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);
}
내 우선 순위/목표는 다음과 같습니다 1. 효율성 2. 유지 보수성/사용자 정의/신뢰성/확장 성 3. RAD (시스템의 빠른 개발)
내 질문 : 귀하의 의견으로는 1. 디자인에 결함이 있습니까? 코드 효율성은 어떻습니까? 공연? 2. OOP Archi 또는 Tiered 디자인에 대한 몇 가지 규칙을 위반합니까? 3.이 디자인은 느슨하게/낮게 결합되어 있습니까? 4. 이것을 사용하여 목표를 달성 할 수 있습니까? 5. 제안 사항? 사전에
감사합니다 :)
KISS 및 YAGNI - 코드를 유지하기가 쉽습니다. –
잘, 우리는 시스템 (로열티 카드 시스템)을 가지고 있고 우리는 시스템을 사용하는 많은 고객을 가지고 있지만, 그들은 다른 구현, 말, 사용자 정의를 가지고 .. 지금, 프로젝트 설정은 모든 클라이언트가 자신의 별도의 VS 프로젝트 솔루션을 가지고 있기 때문에 나는 모든 클라이언트가 기능을 추가하는 것처럼 사용자 정의 할 것이므로 프로젝트를 분리하기로 결정했다. 문제는, 우리가 구독하는 많은 클라이언트를 유지하는 것이 점점 더 어려워지고 새로운 클라이언트가 구독 할 때마다 다른 프로젝트를 만들어야한다는 것입니다. 내 솔루션은 모든 프로젝트를 1로 결합한 다음 디자인에서 트릭을 수행하는 것입니다. – csharpnoob
복합 응용 프로그램 (CompositeUI 블록 아님)을 살펴보면,이 기능은 사용자가 찾고있는 것 이상의 기능이라고 생각합니다. –