Click here to Skip to main content
15,892,161 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
GeneralRe: Creating interface that can read network traffic Pin
that_dude_tj17-Jul-09 14:48
that_dude_tj17-Jul-09 14:48 
QuestionConsultant/Principal/Senior Software Engineer Pin
leowangrenbenmg15-Jul-09 23:24
leowangrenbenmg15-Jul-09 23:24 
AnswerRe: Consultant/Principal/Senior Software Engineer Pin
Pete O'Hanlon15-Jul-09 23:34
mvePete O'Hanlon15-Jul-09 23:34 
GeneralRe: Consultant/Principal/Senior Software Engineer Pin
Paul Conrad25-Jul-09 19:26
professionalPaul Conrad25-Jul-09 19:26 
GeneralRe: Consultant/Principal/Senior Software Engineer Pin
Pete O'Hanlon29-Jul-09 9:11
mvePete O'Hanlon29-Jul-09 9:11 
GeneralRe: Consultant/Principal/Senior Software Engineer Pin
Paul Conrad29-Jul-09 12:39
professionalPaul Conrad29-Jul-09 12:39 
AnswerRe: Consultant/Principal/Senior Software Engineer Pin
Eddy Vluggen16-Jul-09 2:27
professionalEddy Vluggen16-Jul-09 2:27 
QuestionIs this an existing pattern Pin
sadavoya15-Jul-09 7:30
sadavoya15-Jul-09 7:30 
Does the following C# code belong to a design pattern? If so, which one?
public class Fee
{
    private Bar<Baz>.Getter myBaz = Bar<Baz>.GetAGetter();

    public void Fi()
    {
        myBaz().DoStuff();
    }
    public void Fo()
    {
        myBaz().DoStuff();
    }
}
public class Bar<T>
    where T : new()
{
    public delegate T Getter();

    public static Getter GetAGetter()
    {
        T requestedItem = default(T);
        return () =>
            {
                if (requestedItem == null)
                {
                    requestedItem = new T();
                }
                return requestedItem;
            };
    }
}
public class Baz
{
    public Baz()
    {

    }
    public void DoStuff()
    {

    }
}

Bar returns a closure with an upvalue of type T. In this example, Fee's myBaz method will always return the same Baz object, and it won't be instantiated until the call to myBaz().DoStuff() during either the Fee.Fi() or Fee.Fo() method, whichever is called first.
So basically Bar provides lazy initialization of a Baz (in this case) to Fee (and presumably other classes). Do we have a name for this?
If this question has already been asked in this forum, please point me to the message.
AnswerRe: Is this an existing pattern Pin
CodingYoshi15-Jul-09 17:27
CodingYoshi15-Jul-09 17:27 
GeneralRe: Is this an existing pattern Pin
sadavoya17-Jul-09 5:31
sadavoya17-Jul-09 5:31 
QuestionDTO design supporting multiple tables Pin
Leftyfarrell15-Jul-09 6:10
Leftyfarrell15-Jul-09 6:10 
AnswerRe: DTO design supporting multiple tables Pin
CodingYoshi15-Jul-09 17:33
CodingYoshi15-Jul-09 17:33 
QuestionRe: DTO design supporting multiple tables Pin
Leftyfarrell16-Jul-09 1:51
Leftyfarrell16-Jul-09 1:51 
AnswerRe: DTO design supporting multiple tables Pin
CodingYoshi16-Jul-09 3:24
CodingYoshi16-Jul-09 3:24 
GeneralRe: DTO design supporting multiple tables Pin
Leftyfarrell16-Jul-09 3:58
Leftyfarrell16-Jul-09 3:58 
GeneralRe: DTO design supporting multiple tables Pin
CodingYoshi16-Jul-09 8:05
CodingYoshi16-Jul-09 8:05 
GeneralRe: DTO design supporting multiple tables Pin
Leftyfarrell16-Jul-09 9:56
Leftyfarrell16-Jul-09 9:56 
GeneralRe: DTO design supporting multiple tables Pin
CodingYoshi16-Jul-09 17:13
CodingYoshi16-Jul-09 17:13 
QuestionOODB or RDB for checkbook/budget program? Pin
copec10-Jul-09 17:15
copec10-Jul-09 17:15 
AnswerRe: OODB or RDB for checkbook/budget program? Pin
riced11-Jul-09 10:06
riced11-Jul-09 10:06 
GeneralRe: OODB or RDB for checkbook/budget program? [modified] Pin
copec11-Jul-09 11:25
copec11-Jul-09 11:25 
GeneralRe: OODB or RDB for checkbook/budget program? Pin
riced12-Jul-09 2:12
riced12-Jul-09 2:12 
GeneralRe: OODB or RDB for checkbook/budget program? Pin
copec12-Jul-09 7:08
copec12-Jul-09 7:08 
GeneralRe: OODB or RDB for checkbook/budget program? Pin
riced12-Jul-09 21:07
riced12-Jul-09 21:07 
GeneralRe: OODB or RDB for checkbook/budget program? Pin
copec14-Jul-09 11:15
copec14-Jul-09 11:15 

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.