Question regarding oo design / layers

Discussion in 'ASP .Net' started by Rob Meade, Jun 21, 2007.

  1. Rob Meade

    Rob Meade Guest

    Hi all,

    Ok - I have a few objects I've created, some live in my dal, some in my bol
    and some in my ui...

    Here's the thing - I have the need to persist an ID which is used for
    display purposes only (control ID) and the only place I can persist this is
    in one of my objects (session variables are not acceptable)....the problem
    is - the object which it would most likely go in belongs in my bol...to me
    this feels wrong, oh so very wrong, as my understanding, whilst limited is
    that objects in my bol should not know about ui things equally not know
    about dal things...

    So, here's the question - would it be more appropriate to have a UI object
    specifically created and form part of my bol object as opposed to just
    having a class variables in bol object?

    Example...

    bol object

    Resource object

    private _displayControlID as guid


    OR

    Control object

    private _controlID as guid

    and then have

    Resource Object

    Private _controlObject as ControlObject

    Does the above make any sense? Hope so - not easy to explain and didn't want
    to write mammoth amounts of code to explain it...any advice would be
    appreciated..

    Regards

    Rob
     
    Rob Meade, Jun 21, 2007
    #1
    1. Advertising

  2. I don't know if this is any help, but we usually create UI objects that hold
    the sort of thing that you're talking about, if I understand you correctly.
    We store references to them in the Session. The data in these objects
    reflects their state resulting from user input or other UI-specific things
    (like default display values and so on). This data is validated as
    appropriate, and has the appropriate business rules applied each time the
    user leaves a page (or saves the data). It is at this point that the data
    is passed from the UI layer to the business layer: and obviously we only
    pass the data that we need at the BOL and DAL levels.

    HTH


    Peter

    "Rob Meade" <> wrote in message
    news:...
    > Hi all,
    >
    > Ok - I have a few objects I've created, some live in my dal, some in my
    > bol and some in my ui...
    >
    > Here's the thing - I have the need to persist an ID which is used for
    > display purposes only (control ID) and the only place I can persist this
    > is in one of my objects (session variables are not acceptable)....the
    > problem is - the object which it would most likely go in belongs in my
    > bol...to me this feels wrong, oh so very wrong, as my understanding,
    > whilst limited is that objects in my bol should not know about ui things
    > equally not know about dal things...
    >
    > So, here's the question - would it be more appropriate to have a UI object
    > specifically created and form part of my bol object as opposed to just
    > having a class variables in bol object?
    >
    > Example...
    >
    > bol object
    >
    > Resource object
    >
    > private _displayControlID as guid
    >
    >
    > OR
    >
    > Control object
    >
    > private _controlID as guid
    >
    > and then have
    >
    > Resource Object
    >
    > Private _controlObject as ControlObject
    >
    > Does the above make any sense? Hope so - not easy to explain and didn't
    > want to write mammoth amounts of code to explain it...any advice would be
    > appreciated..
    >
    > Regards
    >
    > Rob
    >
     
    Peter Bradley, Jun 21, 2007
    #2
    1. Advertising

  3. Rob Meade

    Rob Meade Guest

    "Peter Bradley" wrote ...

    >I don't know if this is any help, but we usually create UI objects that
    >hold the sort of thing that you're talking about, if I understand you
    >correctly. We store references to them in the Session. The data in these
    >objects reflects their state resulting from user input or other UI-specific
    >things (like default display values and so on). This data is validated as
    >appropriate, and has the appropriate business rules applied each time the
    >user leaves a page (or saves the data). It is at this point that the data
    >is passed from the UI layer to the business layer: and obviously we only
    >pass the data that we need at the BOL and DAL levels.


    Hello Peter,

    Thank you for your reply.

    That makes sense to me I think, and I think it will fit with my current
    project - just to run it past you in more depth...

    I have a registration process with three stages, the third stage the user
    selects "resources" which they require access to, this is done via a link on
    the page which launches a popup window listing all available resources.
    When the user selects one a little bit of a javascript populates a hidden
    element on the parent page and fires a Click() event on a hidden button on
    the parent page. Ajax then enables me to perform an asynchronous postback -
    and this is where the magic happens!

    I populate a "Resource" object, and using the ResourceID get the available
    Access Levels for it.

    The ResourceName is displayed on the page, underneath a drop down list
    containing all of the AccessLevels, a second drop down box is also
    displayed, this is populated again using Ajax when the user selects an
    AccessLevel.

    Because the user can add as many Resources as they wish the page builds up
    with these controls, the problem I have run into is that I need the ability
    to give it collection of bits a unique ID - and persist it. I am unable to
    use the ResourceID as they can select the same resource more than once (by
    design), therefore I want to create a GUID but store it.

    If I was to create a UI object, and part of that object stores the GUID and
    another part stores my Resource, AccessLevel choice, Parameter (second drop
    down) choice - would this still *fit* the OO / Layers rules?

    A screenshot of the page in question can be seen here:
    <http://www.avon.nhs.uk/RobsToGo/ScreenShot.jpg>

    Any further information would be appreciated.

    Regards

    Rob
     
    Rob Meade, Jun 22, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jan Brunia
    Replies:
    1
    Views:
    554
    Pronab Pal
    Feb 10, 2004
  2. kbutterly
    Replies:
    3
    Views:
    387
    kbutterly
    Jan 30, 2007
  3. subtenante

    Design problem : security layers

    subtenante, Apr 17, 2007, in forum: Java
    Replies:
    26
    Views:
    741
    subtenante
    Apr 19, 2007
  4. tigozilla

    question on javascript layers in aspnet

    tigozilla, Dec 23, 2005, in forum: ASP General
    Replies:
    1
    Views:
    144
    Bob Barrows [MVP]
    Dec 23, 2005
  5. Tim W
    Replies:
    10
    Views:
    742
    Tim W
    Jan 26, 2012
Loading...

Share This Page