Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6677721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:09:23+00:00 2026-05-26T04:09:23+00:00

Users of our system are able to submit un-validated contact data. For example: Forename:

  • 0

Users of our system are able to submit un-validated contact data. For example:

  • Forename: null
  • Surname: 231
  • TelephoneNumber: not sure
  • etc

This data is stored in a PendingContacts table.

I have another table – ApprovedContacts. This table has a variety of constraints to improve consistency and integrity. This table shouldn’t contain any dirty or incomplete data.

I need a process to move data from one table to another. Structure of both tables is nearly identical, however, one table has the constraints, when another doesn’t.

I have two states: Pending and Approved, gut feeling tells me that I should use a state pattern details here. In theory this should allow me to change contact’s state from Pending to Approved, depending on whether the contact has been successfully validated. Problem is that I don’t see how is this going to work.

Am I going in a right direction or should I be looking at something completely different?

Presentation layer is in MVC 3, so I have view models for pending contacts and approved contacts, as well as domain models for pending contacts and approved contacts. My view models are generally DTOs with some validation routines, but now my view models represent state too. This doesn’t seem right.

For example, all contacts must have a state and they can be saved and removed , so I need an interface for that:

public interface IContactViewModelState
{        
    void Save(ContactViewModel item);
}

I then add an implementation for saving pending contacts into the PendingContacts table:

public class PendingContactViewModelState: IContactViewModelState
{
    public void Save(ContactViewModel item)
    {
        // Save to the pending contacts table
        // I don't like this as my view model now references data access layer 
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T04:09:24+00:00Added an answer on May 26, 2026 at 4:09 am

    Short answer: no, because you only have two states. You’d use a state pattern to help deal with complex situations with many states and rules. The only reason you might want to go with a full-blown state pattern based implementation is if you there’s a very high chance such a situation is imminent.

    If the result of a success transition to Approved is the record ending up in the approved table then you really just need to decide where you want to enforce the constraints. This decision will/can be based on many factors including the likely frequency of change (to the constraints) and where other logic resides.

    A lot of patterns (but not all) tend to deal with how to structure an application, but here I think it’s just a case of deciding where and how implementing some logic. In other words – you might just be accidentally over-analyzing the problem – it’s easily done 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working on a ticketing system which allows our users to submit tickets
I was wondering how to built a system in which users are able to
I'm looking for a CMS for our extranet. We need users to be able
My requirement is Our users are Authenticated by External System using SSO. On successful
Our system uses a lot of large Bitmaps (System.Drawing.Bitmap) and sometimes we run out
I have a process where an incoming user request to our system is being
As part of one our system's we enable a user in the backoffice to
I work at a small company and our production system uses a hand-rolled RESTful
Our code uses a lot of system properties eg, 'java.io.tmpdir', 'user.home', 'user.name' etc. We
I saw that one of our tools uses a ConsoleAppender to System.err next to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.