Discussion Forum: Thread 357825

 Author: Akir View Messages Posted By Akir
 Posted: May 16, 2024 02:53
 Subject: I was wondering...
 Viewed: 142 times
 Topic: General
Cancel Message
Cancel
Reply to Message
Reply
BrickLink
ID Card

Akir (123)

Location:  Austria, Steiermark
Member Since Contact Type Status
Dec 28, 2020 Contact Member Seller
Buying Privileges - OKSelling Privileges - OK
Store: Some Old Bricks
...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 View Messages Posted By SylvainLS
 Posted: May 16, 2024 03:16
 Subject: Re: I was wondering...
 Viewed: 45 times
 Topic: General
Cancel Message
Cancel
Reply to Message
Reply
BrickLink
ID Card

SylvainLS (46)

Location:  France, Nouvelle-Aquitaine
Member Since Contact Type Status
Apr 25, 2014 Contact Member Seller
Buying Privileges - OKSelling Privileges - OK
Store Closed Store: BuyerOnly
BrickLink Discussions Moderator (?)
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 View Messages Posted By Akir
 Posted: May 16, 2024 06:56
 Subject: Re: I was wondering...
 Viewed: 30 times
 Topic: General
Cancel Message
Cancel
Reply to Message
Reply
BrickLink
ID Card

Akir (123)

Location:  Austria, Steiermark
Member Since Contact Type Status
Dec 28, 2020 Contact Member Seller
Buying Privileges - OKSelling Privileges - OK
Store: Some Old Bricks
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...