This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-12
Channels
- # aleph (3)
- # announcements (7)
- # babashka (22)
- # beginners (44)
- # calva (19)
- # chlorine-clover (1)
- # cider (20)
- # clj-kondo (55)
- # clojure (100)
- # clojure-austin (9)
- # clojure-europe (19)
- # clojure-italy (19)
- # clojure-nl (13)
- # clojure-portugal (2)
- # clojure-uk (7)
- # clojurescript (38)
- # community-development (3)
- # conjure (2)
- # cryogen (57)
- # cursive (6)
- # datalog (3)
- # datomic (24)
- # emacs (17)
- # exercism (8)
- # fulcro (3)
- # holy-lambda (8)
- # jobs (6)
- # jobs-discuss (9)
- # joker (3)
- # lambdaisland (5)
- # leiningen (5)
- # music (9)
- # nextjournal (1)
- # nrepl (2)
- # off-topic (9)
- # other-languages (4)
- # pathom (6)
- # polylith (23)
- # re-frame (5)
- # reagent (5)
- # remote-jobs (1)
- # reveal (1)
- # shadow-cljs (3)
- # tools-build (1)
- # tools-deps (3)
- # xtdb (2)
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...
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 ?