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 4267368
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:53:24+00:00 2026-05-21T06:53:24+00:00

Well, this architectural issue has been wandering in my mind for a while. Suppose

  • 0

Well, this architectural issue has been wandering in my mind for a while. Suppose the following scenario:
I have a Licenses table. Conceptually, each license can be limited to (License Types):

  • Type 1: Number of tries. (e.g. allowing to run 7 times)
  • Type 2: Trial (Time-limited).
  • Type 3: Full
  • …

So, each license should store some custom value. (Type 1: Integer, Type 2: DateTime, Type 3: null)

What’s the best architecture for this scenario?

  • If I decide to put all the licenses in one table, I have at least 1 unused column for every row (EndDate would be null for Type 1, TryTimes would be null for EndDate and both would be null for Type 3):
    LicenseID---LicenseType---CustomerID---EndDate---TryTimes
    On the other hand, I’d like my design to be as flexible as possible (Maybe more license types in the future?)
  • Another possible solution would be using some metadata-like approach:
    LicenseID---LicenseDefinition---CustomerID---
    Where LicenseDefinition contains information about the type and limit of the license and is parsed on the code side.

Which one do you suggest to be more conventional? Do you suggest any other way to implement it?

UPDATE:
Just found out about Sparse columns is SQL Server. Sounds very promising…

  • 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-21T06:53:24+00:00Added an answer on May 21, 2026 at 6:53 am

    Off the top of my head (I haven’t implemented anything like this yet), I might do something like this:

    Create database tables for Customer and License. Within Customer, along with all of the other generic customer information I would add a column for licenseType, which would reference the License table.

    License would store the licenseId as well as any relevant meta data. This would not include license-specific rules.

    On the code side, I would create a LicenseFactory class which would create an instance of a license interface (ILicense). ILicense might look something like this (in PHP):

    interface ILicense
    {
        public isValid($customer);
    }
    

    Then, I would have license-specific implementations:

    class TrialLicense implements ILicense
    {
        public isValid($customer)
        {
            // business logic for this specific license type here
        }
    }
    

    The factory class would look something like:

    class LicenseFactory
    {
        public static function getInstance($type)
        {
            switch($type)
            {
                case 0:
                    return new TrialLicense();
                    break;
            }
        }
    }
    

    So now, my application code might look something like this:

    public function isLicenseValid($customer)
    {
        return LicenseFactory::getLicense($customer->licenseType)->isValid($customer);
    }
    

    None of this has been tested and are just my (rather long winded) initial thoughts. Hope it helps a little though (even though your app may not be php driven :))

    Edit:
    Forgot to mention – the power in this approach is the extensibility. Any time you want to add a new license type, you’d simply add a new row to the License table and a new ILicense implementation with whatever business rules are required.

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

Sidebar

Related Questions

well i have this messages table with sample values like these: msg_id recipient_id read
Well I have this MySQL stored procedure that I wrote and if I run
Ok another WPF question, well I guess this is just general .NET. I have
Well basically I have this script that takes a long time to execute and
Well, this is my first post here and really enjoying the site. I have
my issue lokks similar to this one: (link) but i have one-to-many association: <set
Hi Developers/Architects, This is more of an Architectural question: I have a web application.
Well this is incredibly frustrating. After being nagged by Rails that I need to
I am using Delphi TApplication.OnException Event to catch unhandled exceptions This works well but
Well I was reading this post and then I came across a code which

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.