logoalt Hacker News

abraxastoday at 4:27 PM1 replyview on HN

Was he entirely wrong? Have you tried to dump the stored proc into a frontier model and ask it to refactor? You'd probably have neat 20 stored procs with well laid out logic in minutes.

I wouldn't keep a ball of mud just because LLMs can usually make sense of them but to refactor such code debt is becoming increasingly trivial.


Replies

ilitirittoday at 4:55 PM

> Was he entirely wrong?

Yes. I mean... of course he was?. Firstly, I had already gone through this process with multiple LLMs, from various perspectives, including using Deep Research models to find out if any other businesses faced similar issues, and/or if products existed that could help with this. That lead me down a rabbit hole of data science products related to regulatory reporting of a completely different nature which was effectively useless. tl;dr: Virtually all LLMs - after understanding the context - recommended us doing thing we had already been urging the business to do - hire a Technical BA with experience in this field. And yes, that's what we ended up doing.

Now, give you some ideas about why his idea was obviously absurd:

- He had never seen the SP

- He didn't understand anything about regulatory reporting

- He didn't understand anything about financial derivatives

- He didn't understand the difference between Transact SQL and ANSI SQL

- No consideration given to IP

- etc etc

Those are the basics. Let's jump a little bit into the detail. Here's a rough snippet of what the SP looks like:

   SELECT
    CASE
    WHEN t.FLD4_TXT IN ('CCS', 'CAC', 'DEBT', ..... 'ZBBR') THEN '37772BCA2221'
    WHEN t.FLD4_TXT IN ('STCB') AND ISNULL(s.FLD5_TXT, s.FLD1_TXT) = 'X' THEN 'EUMKRT090011'
    END as [Id When CounterParty Has No Valid LEI in Region]
   -- remember, this is around 5000 lines long ....
Yes, that's a typical column name that has rotted over time, so noone even knows if it's still correct. Yes, those are typical CASE statements (170+ of them at last count, and no, they are not all equal or symmetric).

So... you're not just dealing with incredibly unwieldy and non-standard SQL (omitted), noone really understands the business rules either.

So again... yes he was entirely wrong. There is nothing "trivial" about refactoring things that noone understands.