Fork me on GitHub

I asked our sql developer to help me with some stored procs on my current project... Simple task for a sql developer I thought.... I wanted: A stored proc to insert a Foo A stored proc to update an existing Foo A stored proc that takes some arguments and searches all the Foos and returns results. He put it all in one stored proc... The stored proc is called MaintainFoo It takes a string to specify if you are adding, updating or searching. Then takes a further two strings just to specify the type of search. It has a load of if statements inside it to decide what action to do... Why do people do this? He's made it so complicated, its now about 400 lines of code. ANd even the name... If you were looking for the name of the proc that does searching you would NEVER think to call the Maintain sproc...


Perhaps he himself should see this feedback. :) A good opportunity to learn.


he's on holiday, but I've emailed him. The thing is he's probably, age wise, has almost 20 years experience on me


Not to defend anybody, just to keep it in mind: Historically, it is much harder to organize code in a database than in a “usual” program structure. Abilities to group functions are limited, so what you describe could be a pattern to deal with these constraints


Yea I agree with @U0N9SJHCH. He might have overengineered it in this particular case, but there are actually some cases where'd you want to do stuff like that to share error handling, permission checks, selection expressions, etc. Though the less that is shared, the harder it would be to defend taking that approach.


without constraints, any solution will do. And naming is hard and/or contextual... perhaps they name lot of things MaintainXXX ?


In Chrome/Edge DevTools how to monitor network traffic when Network tab shows no activity when there's definitely traffic going on?


Does WS mean the initial handshake only and not any subsequent traffic?


ok got it. just follow the WS connection.

👍 1