Discussion Forum: Thread 357825 |
|
|
| | Author: | Akir | Posted: | May 16, 2024 02:53 | Subject: | I was wondering... | Viewed: | 145 times | Topic: | General | |
|
| ...how is it possible that this site apparently has (at least?) two different
sorting algorithms in place? When I sort my wish list inventory by item name
I get "Brick 1x12" before "Brick 1x8", in my store inventory
(and in orders and set inventories) it recognizes the numbers correctly and sorts
1x8 before 1x12. Is there method in this madness?
|
|
| | | | | |
| | | | Author: | SylvainLS | Posted: | May 16, 2024 03:16 | Subject: | Re: I was wondering... | Viewed: | 46 times | Topic: | General | |
|
| In General, Akir writes:
| ...how is it possible that this site apparently has (at least?) two different
sorting algorithms in place? When I sort my wish list inventory by item name
I get "Brick 1x12" before "Brick 1x8", in my store inventory
(and in orders and set inventories) it recognizes the numbers correctly and sorts
1x8 before 1x12. Is there method in this madness?
|
That’s a symptom of spaghetti code (or, more accurately, big ball of mud): you
need the same function but, either it needs to be slightly different or you’re
just not very good at recognizing duplicates, and you copy (or rewrite) the code.
So when one copy changes, the other doesn’t.
Reconciling the different bits (refactoring) is not so easy and you risk breaking
one copy which actually did something slightly differently and that can’t be
simply replaced by a call to the other.
Hence the “we are not touching that (at the moment)” attitude.
|
|
|
| | | | | | | | | |
| | | | | | Author: | Akir | Posted: | May 16, 2024 06:56 | Subject: | Re: I was wondering... | Viewed: | 32 times | Topic: | General | |
|
| In General, SylvainLS writes:
| In General, Akir writes:
| ...how is it possible that this site apparently has (at least?) two different
sorting algorithms in place? When I sort my wish list inventory by item name
I get "Brick 1x12" before "Brick 1x8", in my store inventory
(and in orders and set inventories) it recognizes the numbers correctly and sorts
1x8 before 1x12. Is there method in this madness?
|
That’s a symptom of spaghetti code (or, more accurately, big ball of mud): you
need the same function but, either it needs to be slightly different or you’re
just not very good at recognizing duplicates, and you copy (or rewrite) the code.
So when one copy changes, the other doesn’t.
Reconciling the different bits (refactoring) is not so easy and you risk breaking
one copy which actually did something slightly differently and that can’t be
simply replaced by a call to the other.
Hence the “we are not touching that (at the moment)” attitude.
|
Guessed as much, thanks for the confirmation! I suppose it's a wise choice,
there's lots of more urgent matters...
|
|
|
|
|
|
|