object oriented question

Discussion in 'ASP .Net' started by Russell, Nov 25, 2004.

  1. Russell

    Russell Guest

    Hello all,

    I have an object in business layer called
    JPPage
    Which has the properties:
    id
    title
    content
    parent
    level

    what I want to know is. I have a crumb trail on my front end which
    only requires the properties id and title. So do I use a collection of
    JPPage objects (even though the JPPage object has more properties that
    I need for my crumb trail) or do I create a crumb trail object with
    properties id and title? If I do this then in essense I have duplicate
    code.

    Or do I create an object, for example, called JPSimplePage with the
    properties id and title and then create an object JPPage which
    inherits JPSimplePage and has the additional properties of content,
    parent and level?

    Thanks in advance, just want to get my OO methology correct.

    thanks
    Russ
     
    Russell, Nov 25, 2004
    #1
    1. Advertising

  2. Russell

    Karl Seguin Guest

    Russell,
    First off, I don't see anything overly wrong with having a collection of
    JPPage objects which only have a couple of their properties set. The only
    real problem I see is that people might try to access other properties -
    since it's fairly reasonable to expect the entire set of properties to be
    properly set.

    I think your inheritance idea is the way to go. This way there's no
    confusion about what data is available when.

    KArl

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/


    "Russell" <> wrote in message
    news:...
    > Hello all,
    >
    > I have an object in business layer called
    > JPPage
    > Which has the properties:
    > id
    > title
    > content
    > parent
    > level
    >
    > what I want to know is. I have a crumb trail on my front end which
    > only requires the properties id and title. So do I use a collection of
    > JPPage objects (even though the JPPage object has more properties that
    > I need for my crumb trail) or do I create a crumb trail object with
    > properties id and title? If I do this then in essense I have duplicate
    > code.
    >
    > Or do I create an object, for example, called JPSimplePage with the
    > properties id and title and then create an object JPPage which
    > inherits JPSimplePage and has the additional properties of content,
    > parent and level?
    >
    > Thanks in advance, just want to get my OO methology correct.
    >
    > thanks
    > Russ
     
    Karl Seguin, Nov 25, 2004
    #2
    1. Advertising

  3. cheers Karl.. I thought you might say that. Im loving OO. no more
    spagetti code!!

    RuSs

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!
     
    russell mccloy, Nov 25, 2004
    #3
  4. Russell

    MattC Guest

    Russell if you have duplicate code then you may need a further level in your
    hierarchy

    How about:

    BaseObject
    id

    CrumbObject : BaseObject
    title

    JPPage : CrumObject
    content
    parent
    level

    MattC

    "Russell" <> wrote in message
    news:...
    > Hello all,
    >
    > I have an object in business layer called
    > JPPage
    > Which has the properties:
    > id
    > title
    > content
    > parent
    > level
    >
    > what I want to know is. I have a crumb trail on my front end which
    > only requires the properties id and title. So do I use a collection of
    > JPPage objects (even though the JPPage object has more properties that
    > I need for my crumb trail) or do I create a crumb trail object with
    > properties id and title? If I do this then in essense I have duplicate
    > code.
    >
    > Or do I create an object, for example, called JPSimplePage with the
    > properties id and title and then create an object JPPage which
    > inherits JPSimplePage and has the additional properties of content,
    > parent and level?
    >
    > Thanks in advance, just want to get my OO methology correct.
    >
    > thanks
    > Russ
     
    MattC, Nov 25, 2004
    #4
    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. Robert Hathaway
    Replies:
    0
    Views:
    420
    Robert Hathaway
    Jul 29, 2003
  2. Robert Hathaway
    Replies:
    0
    Views:
    422
    Robert Hathaway
    Jul 29, 2003
  3. Robert Hathaway
    Replies:
    1
    Views:
    460
    Robert J Hathaway III
    Jul 29, 2003
  4. Replies:
    2
    Views:
    433
    Bruno Desthuilliers
    May 26, 2008
  5. rolo
    Replies:
    3
    Views:
    175
    Robert Klemme
    Apr 9, 2004
Loading...

Share This Page