views:

58

answers:

1

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

  1. BusinessRules.dll (Compose of 2 subfolders ValueObjects(DTO) and BusinessObjects)

  2. AppDomainRules.dll (i put here the domain driven classes like registration, admission, sale service classes, will use the Business Objects and VOs)

  3. 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 :)

A: 

I would advise figuring out what your program needs to do, before constraining it to a specific design.

How this might not be flawed for a simple stand alone application that allows you to store and read users, it might not be a good design for a multi-user system that needs to have offline/online features and functionality.

Unless you are making a "fun" project, always figure out what you need to do, before you build it.

Tom Anderson
KISS and YAGNI - learn + love = easy to maintain code.
Tom Anderson
well, we have a a System (Loyalty Card System) and we have many clients using the system but they have different implementation, say, customizations.. right now, the project setup is , every Client has its own separate VS project solution because like I said, all clients would customize it like add some features to it, so we decided to separate the projects. the problem is, it becomes harder and harder to maintain as many clients subscribe to us, and everytime new client subscribe, we have to create another proj, my solution is this, combine all projects into 1 and just do the trick in design.
csharpnoob
look into composite applications (not CompositeUI Block), I think this is more on the lines of what you are looking for.
Tom Anderson