-1

I've been asked how to re-design a legacy system by a relative for a company that builds custom chairs. On their website you can customize your chair in about 30 permutations : chair type, material, if wood what kind, color, height, leg type, etc..

They have been working for years with a system that creates a ~40 character encoded string that represents the chair and use that string as the product code (like a long SKU). It will look like M01MA24C04L02... For Model #01, Material #24 Color #04, leg type #02, etc...

This string is used also in client's application and a bit everywhere to represent a chair. You can enter the string on their web app and it will re-create you the chair configuration.

The problem now is that they want to refactor this because they are about to add more options and more will come in the future. We are talking about 40-50 permutations and obviously the encoded string will just get bigger and inconsistent in length with old data. Personnel and stores type this "product code" when they want to see what the what the client ordered with all the configurations and it's getting too long for them to type.

I've been asked how I would go about a problem like that but I'm still recently graduated in computer engineering and don't have much architecture experience yet. I was looking at EAV model but I'm uncertain.

For now I just suggested that they stop using that string as a SKU because it breaks every stores whenever they do a migration of what that code represents, and I suggested that instead of giving the encoded string to the client when they make the order to give them a confirmation number that maps to this code. But they would still like to have a "product code" that represents the product and that is likely to change in the future.

I googled around but I have no experience with stuff like that. I'm not looking for a full solution just an idea of where to look for problems like that mainly for my self interest.

1

This problem is quite common. In the apparel industry for example, everybody uses products with a variety of at least color, size and style. In make-to-order industries, the usual term is a configurable product.

The product modelling is a vast subject, much too broad for a simple answer here. Nevertheless, here some thoughts to guide you.

First you need to consider these concepts separately:

  • You may need two kind of products: the generic product (e.g. chairs) which indicate what features can vary and how, and the specific products, for which all the choices of variations are fixed (e.g. chair M01MA24C04L02).
  • You need to decide about the product ID (i.e. a reference that you put on a label, or that is used for stock management): do you want to have a sequential number (because the attributes can be found, printed, displayed whenever needed) or do you want a meaningful name M01MA24C04L02.
  • The attributes and variants for each attribute that might define the product: for generic products, you just need to know the attribute (with potential variants), for specific products, you need the attributes and the chosen variant.

About the product ID, you need to be aware that it's not only about what is happening in your software, but it's also about the real life business processes that happen in the delivery truck, in the warehouse, in the shops. Changing from a meaningfulname to an anonymous sequential might have consequences on the process (e.g. no more "Jerry, can you find the box with M01MA24C04L02 ? Oh sorry sir, you said the color was blue ?")

About the inner structure, the Entity-Attribute-Value model is indeed a candidate, especially if different generic products (e.g. chairs, tables) use different attributes and the attributes might evolve over time.

If on the other hand you'd have only a couple of products, with a fixed number of attributes, it could be more practical to keep the attributes as properties on the specific product. Different family of products could use different attributes if using the class table inheritance pattern.

0

So if you want to the string idea: If you have a string M01MA24C04L02 instead of the letters M, MA, C, just parse the string based on the position, e.g. the first 2 characters are the model, the second two are the materials, etc

But a better idea!:

When someone designs a chair, they get a unique code to represent their chair design. You create a web api that can be hit that given the unique code, you get back the chair details.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.