First off, I didn't think I would have any followers or likes on any of my blog posts after just 3 posts. Wow, even though it's just one, I really appreciate it. Thanks Edidiong Asikpo. ๐
Secondly, now that I have a following ๐, I need to apologize for the lack of posting. The last two days were difficult and I couldn't commit to blogging. Damn you Covid.
Products vs Variants
This has nothing to do with coding at this stage but it's very important I discuss my thinking with regard to products and variants and why I chose to name them like that.
I want to be able to compare products across different brands and different sizes. For the brand loyal customers out there that place more emphasis on quality over price, this won't be important but then again, brand loyal customers will probably not use this application. This application will be for the price-conscious user who doesn't care about the brand and will buy the cheaper brand or buy in bulk to save.
In order to facilitate the ability to compare prices across brands and sizes, I had to split products into products and product variants. I'll refer to product variants as variants from this point forward. I know not a lot of people would know what I'm talking about when I talk about variants.
I considered calling it products and product groups, but groups just sounded like another grouping, which the category and subcategory are supposed to take care of. Even though products and variants is just another way of grouping similar items together, I think this is a little different than a category and subcategory, which I think is a lot more general than what I'm trying to achieve with products and variants.
What is the difference between a product and a variant
I don't have a formal definition of the two words as yet, but I do have an example that I'd like to share that might make it easier to understand.
A product would an item that is sold at a retail store that is abstracted to the level where it ignores the packaging's size, brand and flavour. A variant would take three attributes into consideration.
Example
For example, Lay's potato chips and Pringles potato chips. The product in this example would be Potato Chips. Then the variants would be Lay's Sour Cream & Onion Potato Chips 105g and Pringles Salted Vinegar 110g. Sorry, I use the metric system. I should probably also take that into consideration later to be able to convert from metric to imperial and vice versa.
So if I'm looking at a report, I can check how much potato chips cost instead of just looking at what Lay's or Pringles potato chips cost. Or when I'm in the store and I look at the Pringles potato chips, I can immediately compare it with any other potato chips I bought in the past or that is currently on promotion.
I plan to add a shopping list feature as well and adding products to the shopping list instead of variants would mean you can get any potato chips from the shelve and tick off that item instead of having to choose specific potato chips, in a specific brand, in a specific pack size and in a specific flavour, unless that's what you wanted, specifically.
The Class Models
Here are my class models for the product and the variant.
using System;
namespace PriceBookClubClassLibrary
{
public class Variant
{
public int Id { get; set; }
public int VariantId { get; set; }
public string VariantName { get; set; }
public string BrandName { get; set; }
public string Description { get; set; }
public decimal PackSize { get; set; }
public string UoM { get; set; }
public string CategoryName { get; set; }
public bool IsWeighted { get; set; }
public bool IsDeleted { get; set; }
public int UserId { get; set; }
public string UserName { get; set; }
public int NumberOfUsers { get; set; }
public Date DateCreated { get; set; }
public Date DateEdited { get; set; }
}
}
using System;
namespace PriceBookClubClassLibrary
{
public class Product
{
public int Id { get; set; }
public string ProductName { get; set; }
public string UoM { get; set; }
public bool IsWeighted { get; set; }
public int MeasurementRate { get; set; }
public int CategoryId { get; set; }
public string CategoryName { get; set; }
public bool IsDeleted { get; set; }
public int UserId { get; set; }
public string UserName { get; set; }
public int NumberOfUsers { get; set; }
public Date DateCreated { get; set; }
public Date DateEdited { get; set; }
}
}
This was a long post. Sorry. Until next time.