CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2012
    Posts
    10

    Factories and Tracing

    Hi all,

    Apologies if this could've been answered with a 'search' but I'm not an experienced programmer and don't know exactly what I'm even looking for. I do know that there are 'many different ways to skin a cat' but I'd like to start-off with the best way for my problem.
    So if anybody can either answer or point me to an answer for these questions then I'd be very grateful. Thanks.

    (1) Factories . . .
    I have some classes that can be used to achieve some task. Each one in a different scenario. However there is some configuration that would be common to each of these classes, although the mechanism by-which they are configured (the methods that each class exposes to perform the configuration), varies. So I've gone down the road of building a factory<T> class.
    The configuration data can be quite verbose, and I was considering putting it into an XML file and have the factory able to read configuration data from this file so that I could just do something like this:

    Factory f = new Factory<object>;
    f.ReadConfiguration(<<<somefile>>>);
    Object = f.Build();

    Hopefully this would provide a way to configure all these different types of object using a standardised configuration file and let that factory configure that actual object.

    Question:
    Have I totally misunderstood the factory pattern?
    Does this sound like something that happens in the real world?

    (2) Tracing:
    I love logging and I've recently discovered tracing.
    If I build multiple libraries and want to make sure that they are all giving me logging data, to the same place, am I correct in thinking that the best way to do this is to setup trace listeners and then just keep using the trace.writeline method wherever I want trace information, safe in the knowledge that trace listeners should be setup somewhere and I'll get the output?

    If none of this makes sense then it's because I probably don't know what I'm taking about.
    If I even get a list of links to checkout then I'll be happy.

    Thanks.

  2. #2
    Join Date
    Jun 2012
    Posts
    10

    Re: Factories and Tracing

    I'm using .net version 4.

    Does anybody know how to edit posts?

  3. #3
    Join Date
    Jun 2012
    Posts
    10

    Re: Factories and Tracing

    Hey,
    I'm looking into the spring framework for both these things, so it's cool for now.

    Cheers,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured