DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Design issue

  1. #1
    adriano Guest

    Design issue


    I am trying to understand how you would architecture a simple system.
    If you had a system where a precondition for every use case was that the
    user had logged in, and that login status was stored on a client cookie say,
    how would you ensure that precondition is met for every method on the other
    classes?

    Presumably somewhere there would be a method to check the login status for
    a user - but where should it go?



  2. #2
    Thomas Eyde Guest

    Re: Design issue

    I would create a main factory object which only works if preconditions are
    met (you have to initialize it, of course). Then implement factory methods
    on this object to create everything else.

    Then you know whenever an object is created the preconditions are met for
    all its methods.

    /Thomas

    "adriano" <adrian_osullivan@hotmail.com> wrote in message
    news:3a812a1b$1@news.devx.com...
    >
    > I am trying to understand how you would architecture a simple system.
    > If you had a system where a precondition for every use case was that the
    > user had logged in, and that login status was stored on a client cookie

    say,
    > how would you ensure that precondition is met for every method on the

    other
    > classes?
    >
    > Presumably somewhere there would be a method to check the login status for
    > a user - but where should it go?
    >
    >




  3. #3
    adriano Guest

    Re: Design issue


    Yes, that's very cunning. Thank you.

    "Thomas Eyde" <thomas.eyde@eunet.no> wrote:
    >I would create a main factory object which only works if preconditions are
    >met (you have to initialize it, of course). Then implement factory methods
    >on this object to create everything else.
    >
    >Then you know whenever an object is created the preconditions are met for
    >all its methods.
    >
    >/Thomas
    >
    >"adriano" <adrian_osullivan@hotmail.com> wrote in message
    >news:3a812a1b$1@news.devx.com...
    >>
    >> I am trying to understand how you would architecture a simple system.
    >> If you had a system where a precondition for every use case was that the
    >> user had logged in, and that login status was stored on a client cookie

    >say,
    >> how would you ensure that precondition is met for every method on the

    >other
    >> classes?
    >>
    >> Presumably somewhere there would be a method to check the login status

    for
    >> a user - but where should it go?
    >>
    >>

    >
    >



  4. #4
    Deborah Guest

    Re: Design issue

    A less elegant but useful solution for a simple system (that would allow for
    session state) would be to store the login status in a session variable.
    Every page can then simply check the session variable to ensure the user has
    logged in.

    The factory object solution may have problems within a stateless system
    whereby you lose your objects between pages.

    Good luck -
    Deborah

    "adriano" <adrian_osullivan@hotmail.com> wrote in message
    news:3a812a1b$1@news.devx.com...
    >
    > I am trying to understand how you would architecture a simple system.
    > If you had a system where a precondition for every use case was that the
    > user had logged in, and that login status was stored on a client cookie

    say,
    > how would you ensure that precondition is met for every method on the

    other
    > classes?
    >
    > Presumably somewhere there would be a method to check the login status for
    > a user - but where should it go?
    >
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center