Results 1 to 2 of 2

Thread: UI code duplication question

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2006
    Posts
    1

    UI code duplication question

    I'm trying to design an architecturally sound system but it seems like no matter how hard I try I can't get around duplicating code. I realize no matter how hard I try some duplication will occur but I'm curious how others with more experience would design different pieces of my system.

    My system is split into three tiers; data, business and UI. The UI is currently giving me headaches. The UI isn't overly complex but there are some dynamic work-flow processes which need to exist in both a windows form and a web form. Here is an example:

    Clocking Employee Into The System

    1) Display Clock-in form
    2) Get employee PIN from Clock-in form, perform employee lookup.
    3a) Employee Found.
    __Is the employee already clocked in?
    __YES
    ____Can employee sign into system?
    ____YES
    ____Sign employee in
    __NO
    ____Clock employee out
    ____Return to step #1
    __NO
    ___Can employee clock in?
    ___YES
    ____Clock employee in.
    ____Can employee sign in
    ____YES
    ______Sign employee in
    ____NO
    ______Return to step #1
    ___NO
    ____Display error
    ____Return to step #1

    3b) Employee NOT found.
    Display error
    Return to step #1

    This process needs to exist in both a windows and web application. My question is how do you abstract out a process that requires dynamic user interaction? I've been reading about the MVC design pattern but I'm obviously missing something. Can someone tell me how they would design the process above, or can you point me somewhere?

    If some of these steps change I'd love to re-write them in a single spot and have both the windows and web forms update.

    Thanks for your help!

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: UI code duplication question

    Without getting into detail, you can create a DLL that can be accessed by any UI you like. Winforms and WebForms use a completely different set of controls so the UI itself will have to be duplicated, but every event handler in each UI can call methods and properties of types from a common library.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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