Results 1 to 8 of 8

Thread: Singleton Design Pattern & Facade Pattern

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2003
    Location
    UK
    Posts
    95

    Singleton Design Pattern & Facade Pattern

    An interesting FAQ about the singleton design pattern. The examples are in C# altho the VB.NET implementation is very similar. (one difference is I tend to use the Mutex class rather than the VB Synclock or lock in C#)

    Singleton Design Pattern
    Last edited by shutty; Jun 9th, 2003 at 08:34 AM.

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    It seems easier to make good use of shared methods although I could see how that may not fit every situation.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Feb 2003
    Location
    UK
    Posts
    95
    The product I'm involved with uses a singleton to control access to a database. Once the user starts up the application a connection is made. Only one connection is allowed and the use of a singleton ensures that the connection object cannot be created multiple times. Therefore the connection handle retrieved is guarenteed to be the correct one.

    Of course shared methods are still used for other tasks when the uniqueness of the object is not as important.

  4. #4
    Fanatic Member VBCrazyCoder's Avatar
    Join Date
    Apr 2003
    Posts
    681

    Facade too.

    And it's so easy to do! Sweet.

    A pattern that I always use is Facade. The intent of the Façade design pattern is to provide a unified interface to a set of interfaces in a sub system. Using the facade pattern basically defines a high level interface that makes the subsystem easier to use.

    This ultimately serves to reduce complexity, and to minimize the communication and dependencies between subsystems.

    I can ALWAYS find a case to use this in every application - such as using a facade handle all database interaction.

  5. #5
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Can you give us an example of a Facade Pattern or links to info on it?

  6. #6
    Fanatic Member VBCrazyCoder's Avatar
    Join Date
    Apr 2003
    Posts
    681
    Couldn't actually find any good links in English - but I reference the GOF's book - "Design Patterns" ISBN 0201633612.

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Feb 2003
    Location
    UK
    Posts
    95
    This site has a few links about it. Haven't actually looked at them all so don't know how good they'll be.

    I tend to use the books below...

    Amazon link to VB Design Patterns Book

    Amazon link to the 'bible' of all Design Pattern books.

  8. #8
    New Member
    Join Date
    Apr 2003
    Location
    Nottingham
    Posts
    14

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