Click here to Skip to main content
15,889,116 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
GeneralRe: DRY Pin
Eddy Vluggen13-Apr-11 10:19
professionalEddy Vluggen13-Apr-11 10:19 
AnswerRe: DRY Pin
RobCroll15-Apr-11 18:55
RobCroll15-Apr-11 18:55 
GeneralRe: DRY Pin
Member 448708315-Apr-11 22:52
Member 448708315-Apr-11 22:52 
AnswerRe: DRY Pin
GParkings2-Sep-11 2:17
GParkings2-Sep-11 2:17 
QuestionHow do you specify states? State Pattern, Enums or ...? Pin
Keld Ølykke11-Apr-11 8:49
Keld Ølykke11-Apr-11 8:49 
AnswerRe: How do you specify states? State Pattern, Enums or ...? Pin
RobCroll15-Apr-11 19:04
RobCroll15-Apr-11 19:04 
GeneralRe: How do you specify states? State Pattern, Enums or ...? Pin
Keld Ølykke24-May-11 2:28
Keld Ølykke24-May-11 2:28 
QuestionSetup global settings with abstract class and reflection to avoid xml configuration file Pin
Kannan Ar25-Mar-11 18:33
professionalKannan Ar25-Mar-11 18:33 
Hi All,

I am developing a library component which requires some global settings. Personally I don’t like to maintain an xml configuration file for this.

An idea strikes for me that to write an abstract class with an abstract method which can override and set global setting by the implementers of this library.

The abstract class will look like something like this.

public abstract class LibSetting
{
     public int MaxCount { get; set; }

     public abstract void SetCount();
}


The end users will implement this abstract class in their application is as follows.

public class MySetting : LibSetting
{
    public override void SetCount()
    {
        MaxCount = 100;
    }
}


To get the end user setting from my library, I am using following code.

public int ShowCount()
{
       Assembly asm = Assembly.GetCallingAssembly();

       IEnumerable<Type> types = asm.GetTypes().Where(t => t.IsClass && t.BaseType == typeof(LibSetting));

       LibSetting setting =(LibSetting) asm.CreateInstance(types.First().FullName);

       setting.SetCount();

       return setting.MaxCount;
}


This will work perfectly. My doubt is that, is it feasible in architecture level of view? I think the performance of read an xml file and loading a class using reflection would be same ( I didn’t test it). So is this a good practice? Kindly advice me on this.


Thanks and Regards,
Kannan
AnswerRe: Setup global settings with abstract class and reflection to avoid xml configuration file Pin
Keld Ølykke4-Apr-11 12:17
Keld Ølykke4-Apr-11 12:17 
QuestionGUI design for Harware configuration Pin
Praveen Raghuvanshi15-Mar-11 8:57
professionalPraveen Raghuvanshi15-Mar-11 8:57 
QuestionChat Feature Pin
Civic068-Mar-11 7:38
Civic068-Mar-11 7:38 
AnswerRe: Chat Feature Pin
grmihel28-Mar-11 22:14
grmihel28-Mar-11 22:14 
AnswerRe: Chat Feature Pin
Richard MacCutchan8-Mar-11 23:28
mveRichard MacCutchan8-Mar-11 23:28 
QuestionGRASP: Controller architecture, correct and wrong. Pin
grmihel28-Mar-11 3:42
grmihel28-Mar-11 3:42 
AnswerRe: GRASP: Controller architecture, correct and wrong. Pin
Piccadilly Yum Yum8-Mar-11 5:25
Piccadilly Yum Yum8-Mar-11 5:25 
GeneralRe: GRASP: Controller architecture, correct and wrong. Pin
grmihel28-Mar-11 22:12
grmihel28-Mar-11 22:12 
GeneralRe: GRASP: Controller architecture, correct and wrong. Pin
Piccadilly Yum Yum8-Mar-11 22:57
Piccadilly Yum Yum8-Mar-11 22:57 
QuestionDatabase alerts [modified] Pin
gbovee7-Mar-11 11:25
gbovee7-Mar-11 11:25 
AnswerRe: Database alerts Pin
Eddy Vluggen8-Mar-11 2:05
professionalEddy Vluggen8-Mar-11 2:05 
QuestionI dont find anything for my Business Logic Layer !! Is it wrong to let my Presentation Layer talking to Data Access Layer ? [modified] Pin
Nadia Monalisa27-Feb-11 14:59
Nadia Monalisa27-Feb-11 14:59 
AnswerRe: I dont find anything for my Business Logic Layer !! Is it wrong to let my Presentation Layer talking to Data Access Layer ? Pin
Pete O'Hanlon27-Feb-11 20:40
mvePete O'Hanlon27-Feb-11 20:40 
GeneralRe: I dont find anything for my Business Logic Layer !! Is it wrong to let my Presentation Layer talking to Data Access Layer ? Pin
Nadia Monalisa27-Feb-11 21:24
Nadia Monalisa27-Feb-11 21:24 
GeneralRe: I dont find anything for my Business Logic Layer !! Is it wrong to let my Presentation Layer talking to Data Access Layer ? Pin
Pete O'Hanlon27-Feb-11 22:21
mvePete O'Hanlon27-Feb-11 22:21 
GeneralRe: I dont find anything for my Business Logic Layer !! Is it wrong to let my Presentation Layer talking to Data Access Layer ? Pin
Nadia Monalisa27-Feb-11 23:15
Nadia Monalisa27-Feb-11 23:15 
AnswerRe: I dont find anything for my Business Logic Layer !! Is it wrong to let my Presentation Layer talking to Data Access Layer ? Pin
Eddy Vluggen27-Feb-11 22:14
professionalEddy Vluggen27-Feb-11 22:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.