lundi 3 février 2020

Validation Logic software Pattern

I have Software Products that can be installed on one or more systems (Servers/ Desktops/ Hardwares) Each product has logic on how it keyCode is defined (specification). The logic may be same for many Software Products with little change.

Product-> defined by ProductCode ->required unique keyCode for installation

I need to validate key entered by a user against the keycode validation for that product.

What is a good software pattern for this kind of process

The way I have done so far is

{
    readonly arrayofproductCodes;
    public CanProcess(string productCode)
    {
        return  arrayofproductCodes.contains(productCode);
    }


    public validate(string keyCode)
    {
        return validation result;
    }
}

There could be several 100 Software Products and new ones added every other month.

I feel that there should be some creation pattern to create Instantiate validation logic based on ProductsCode.

Let me know if my quetion is clear.

Regards,

Mar

Aucun commentaire:

Enregistrer un commentaire