SLOSW – Life scenarios – Part II

We lived happily since bringing home the bacon until …

Real life situation 1
… there came a grumpy man from OH&S department and complained that the list in his application after being entered isn’t displayed correctly. “Point 3.10 comes before 3.2 and not after 3.9” – he said.

Figure 1

“There is no point in pretending otherwise “ – we said.


Real life situation 2
… there came a nice lady from the Marketing department and said that they are going to conduct a research what do people associate their product with and she needed a list which looks like shown below. The real list is copyright material and we are using this made up one instead.

Smart
Universal
Clever
Kind

Real life situation 3
… there came somebody from the Refunds department asking us to sort the list of countries, so that our country and our neighbors were closer to the top. Our company is well known and the list of countries we supply goods to is large. We added all the ones from here. Now every time we open the list we think – “How great it would be to live in Andorra – it’s so easy to select”.

We decided to solve these problems by adding a new attribute into the list (column to a table) with the name [weight] and the creation of an administrative interface to order the values. The new element is added to the table with the greatest weight. New values aren’t added very often so this is not a problem to add it first and define its order second.

Figure 2

How is this implemented? Our weights are integers and if we need to raise an element one position up, we swap its weight with a weight of element above it.

Further in, already in the application it is up to us and business logic how to display values – by weights or alphabetically. One of the approaches could be: if the weights are equal – output alphabetically, if they aren’t – use weights. After some thought we decided to make life easier for the system administrator* in the situation that the list is long and the user* needs to make it alphabetised, all weights can be equalled with one press of a button. If you ask, is this function needed for real, we’ll say – not yet. But because it was cinch to add, and on the other side it nicely rounded our implementation, we added it up front.

Figure 3

Now, you’ve probably guessed that SLOSW means Simple List on Steroids Weighted.

And everyone lived happily ever after until … and as a result we ended up with SLOSD and later SLOSDW.

* – when we say “system administrator” we mean our clients’ system administrator. When we say “user which needs to change the lists’ appearance or content” we mean, for example, the head of a department on the clients’ side. But the “user” could also be even an ordinary employee on the clients’ side. They all can access the system with different privileges.


/strong

Print this post | Home

Comments are closed.