Fork me on GitHub
#off-topic
<
2021-10-12
>
Stuart15:10:37

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...

p-himik15:10:30

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

Stuart15:10:18

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

javahippie15:10:50

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

isak17:10:13

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.

bherrmann18:10:26

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

Apple16:10:33

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

Apple16:10:34

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

Apple16:10:34

ok got it. just follow the WS connection.

👍 1