Somewhat advanced OO design question

Discussion in 'ASP .Net' started by Guest, May 22, 2005.

  1. Guest

    Guest Guest

    Hoping to get some ideas from more experienced hands regarding the best way
    to use object-oriented design to assist my development of a content
    management system destined for multiple devices. Imagine this class
    structure:

    clsContentData [interface to complex database.]
    clsPages [abstraction of pages, not sure whether I need this
    or not]
    clsClientDiscover
    clsRender [this class brings us to the crux of my question]

    Imagine also that you're working with a language that supports a full OO
    featureset. You want to design a class structure so that "pages" can be
    built for all existing devices and can also be built for future
    presentational technologies.

    I'm wondering what the good OO design is here. My insight is limited by the
    fact that I've only recently started working with languages that support
    full OOP.

    An amateur tack is to make a Jack-of-All-Trades "render" class with a
    bazillion one-shot methods:

    objRender.RenderMyUweekArticlePageForHtml
    objRender.RenderMyNewsReleaseWithThe2004DesignForBlackberry
    objRender.RenderMyNewsReleaseWithThe2004DesignForText

    .... etc. This approach sucks.

    Another possibility is to shift the complexity to clsPages, which would hold
    declarative XML descriptions/ page templates, and then have a bunch of
    methods on clsRender for rendering those pieces using different
    presentational technologies:

    objRender.RenderNavbar
    objRender.RenderBody

    Ideally use of the class involves two abstractions:

    + Hiding the specific page/content type in question. So we can call
    ".RenderNavbar" instead of ".RenderNewsreleaseNavbar" (a specific
    implementation of navbar)

    + Hiding the device type. We can call ".RenderNewsRelease" rather than
    ".RenderNewsReleaseForBlackberry", confident that the render method will
    interact appropriately with clsClientDiscover to determine what the clients
    capabilities are and send the right page.

    What's the right OO structure here? I'll be using ASP.NET with C# or VB.NET.
    Yet another possiblity is that I might take advantage of some intrinsic part
    of ASP.NET (e.g. user controls, server controls) to manage some aspects of
    the complexity, but I don't know offhand if that's the cleanest or best
    approach.

    General question. Any insights gratefully accepted. I'll be going to TechEd,
    so if you know of sessions I should be paying particular attention to,
    please let me know.

    Thanks.

    Ken Fine
     
    Guest, May 22, 2005
    #1
    1. Advertising

  2. Short answer -- look into "Strategy pattern"

    http://www.dofactory.com/Patterns/PatternStrategy.aspx

    --
    Manohar Kamath
    Editor, .netBooks
    www.dotnetbooks.com


    <> wrote in message
    news:%23bN$...
    > Hoping to get some ideas from more experienced hands regarding the best
    > way to use object-oriented design to assist my development of a content
    > management system destined for multiple devices. Imagine this class
    > structure:
    >
    > clsContentData [interface to complex database.]
    > clsPages [abstraction of pages, not sure whether I need this
    > or not]
    > clsClientDiscover
    > clsRender [this class brings us to the crux of my question]
    >
    > Imagine also that you're working with a language that supports a full OO
    > featureset. You want to design a class structure so that "pages" can be
    > built for all existing devices and can also be built for future
    > presentational technologies.
    >
    > I'm wondering what the good OO design is here. My insight is limited by
    > the fact that I've only recently started working with languages that
    > support full OOP.
    >
    > An amateur tack is to make a Jack-of-All-Trades "render" class with a
    > bazillion one-shot methods:
    >
    > objRender.RenderMyUweekArticlePageForHtml
    > objRender.RenderMyNewsReleaseWithThe2004DesignForBlackberry
    > objRender.RenderMyNewsReleaseWithThe2004DesignForText
    >
    > ... etc. This approach sucks.
    >
    > Another possibility is to shift the complexity to clsPages, which would
    > hold declarative XML descriptions/ page templates, and then have a bunch
    > of methods on clsRender for rendering those pieces using different
    > presentational technologies:
    >
    > objRender.RenderNavbar
    > objRender.RenderBody
    >
    > Ideally use of the class involves two abstractions:
    >
    > + Hiding the specific page/content type in question. So we can call
    > ".RenderNavbar" instead of ".RenderNewsreleaseNavbar" (a specific
    > implementation of navbar)
    >
    > + Hiding the device type. We can call ".RenderNewsRelease" rather than
    > ".RenderNewsReleaseForBlackberry", confident that the render method will
    > interact appropriately with clsClientDiscover to determine what the
    > clients capabilities are and send the right page.
    >
    > What's the right OO structure here? I'll be using ASP.NET with C# or
    > VB.NET. Yet another possiblity is that I might take advantage of some
    > intrinsic part of ASP.NET (e.g. user controls, server controls) to manage
    > some aspects of the complexity, but I don't know offhand if that's the
    > cleanest or best approach.
    >
    > General question. Any insights gratefully accepted. I'll be going to
    > TechEd, so if you know of sessions I should be paying particular attention
    > to, please let me know.
    >
    > Thanks.
    >
    > Ken Fine
    >
     
    Manohar Kamath, May 22, 2005
    #2
    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. John Salerno
    Replies:
    4
    Views:
    306
    John Salerno
    Mar 25, 2006
  2. Replies:
    3
    Views:
    300
  3. Michele Simionato
    Replies:
    1
    Views:
    611
    Lacrima
    Mar 27, 2010
  4. Stupid48
    Replies:
    6
    Views:
    155
    Ken Schaefer
    Mar 18, 2005
  5. David Squire
    Replies:
    5
    Views:
    97
    Uri Guttman
    Apr 8, 2006
Loading...

Share This Page