Click here to Skip to main content
15,888,461 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
Generalimplementing interface method, same signature, from two interfaces Pin
raddevus25-Apr-24 9:55
mvaraddevus25-Apr-24 9:55 
GeneralRe: implementing interface method, same signature, from two interfaces Pin
Jon McKee25-Apr-24 12:27
professionalJon McKee25-Apr-24 12:27 
RantGiven enough eyeballs - a Sunday rant... Pin
Mircea Neacsu21-Apr-24 7:32
Mircea Neacsu21-Apr-24 7:32 
GeneralRe: Given enough eyeballs - a Sunday rant... Pin
Greg Utas21-Apr-24 8:10
professionalGreg Utas21-Apr-24 8:10 
GeneralRe: Given enough eyeballs - a Sunday rant... Pin
Mircea Neacsu21-Apr-24 8:18
Mircea Neacsu21-Apr-24 8:18 
GeneralRe: Given enough eyeballs - a Sunday rant... Pin
Greg Utas21-Apr-24 10:11
professionalGreg Utas21-Apr-24 10:11 
GeneralCountry code Pin
PIEBALDconsult16-Apr-24 17:07
mvePIEBALDconsult16-Apr-24 17:07 
GeneralRe: Country code Pin
Peter_in_278016-Apr-24 17:50
professionalPeter_in_278016-Apr-24 17:50 
GeneralRe: Country code Pin
Jörgen Andersson16-Apr-24 20:15
professionalJörgen Andersson16-Apr-24 20:15 
GeneralRe: Country code Pin
snorkie17-Apr-24 2:40
professionalsnorkie17-Apr-24 2:40 
GeneralRe: Country code Pin
trønderen17-Apr-24 4:26
trønderen17-Apr-24 4:26 
GeneralSQL (Transact-SQL) needs a proper FOR loop! Pin
PIEBALDconsult1-Apr-24 17:30
mvePIEBALDconsult1-Apr-24 17:30 
GeneralRe: SQL (Transact-SQL) needs a proper FOR loop! Pin
#realJSOP2-Apr-24 9:07
mve#realJSOP2-Apr-24 9:07 
GeneralRe: SQL (Transact-SQL) needs a proper FOR loop! PinPopular
snorkie4-Apr-24 8:08
professionalsnorkie4-Apr-24 8:08 
GeneralRe: SQL (Transact-SQL) needs a proper FOR loop! Pin
PIEBALDconsult4-Apr-24 8:16
mvePIEBALDconsult4-Apr-24 8:16 
GeneralRe: SQL (Transact-SQL) needs a proper FOR loop! Pin
Sander Rossel8-Apr-24 1:11
professionalSander Rossel8-Apr-24 1:11 
I worked at a company who preferred to do as much as possible in SQL Server.
A stored procedure, as they claimed, is easy to change in production and you can write business logic in the one place where every user action ultimately ends up in: the database.
The client applications were all WinForms.

Of course, all of this is a fallacy.
Yes, it's easy to change a view or stored procedure in production (we could make the change and hit F5), but the question is why wouldn't software be easy to update?
This was about 10 to 14 years ago, but this company did not have DevOps practices and every deployment was manual work, which also required users to restart the software (which was of course pretty common at the time).
That last part is a nuisance which really can't be helped at this point (unless you use stored procedures), but having a difficult and manual deployment process can be helped and should be helped.
Which would remove a part of the need for stored procedures and logic in your database.

The second reason, having everything in one place, can of course be solved by using services in a server-client, service-oriented and/or microservices architecture.
And when you have services doing all the logic, you don't have to restart client applications either.
Now, instead of using stored procedures and views you can use a service instead.
A service is easy to debug, easy to put in source control and easy to automatically deploy, unlike SQL code.
And you never have the risk of updating the wrong thing either (which happened from time to time) because you're simply not messing around in production environment "on the fly".

So, I've made a choice to let a database do what it does best, store data, and keep it as "dumb" as possible.
Everything else is handled by applications and services Smile | :)

GeneralRe: SQL (Transact-SQL) needs a proper FOR loop! Pin
PIEBALDconsult8-Apr-24 3:27
mvePIEBALDconsult8-Apr-24 3:27 
GeneralRe: SQL (Transact-SQL) needs a proper FOR loop! Pin
Sander Rossel10-Apr-24 4:29
professionalSander Rossel10-Apr-24 4:29 
GeneralRe: SQL (Transact-SQL) needs a proper FOR loop! Pin
GuyThiebaut8-Apr-24 23:53
professionalGuyThiebaut8-Apr-24 23:53 
GeneralRe: SQL (Transact-SQL) needs a proper FOR loop! Pin
Sander Rossel9-Apr-24 0:15
professionalSander Rossel9-Apr-24 0:15 
GeneralRe: SQL (Transact-SQL) needs a proper FOR loop! Pin
ChandraRam12-Apr-24 1:16
ChandraRam12-Apr-24 1:16 
GeneralRe: SQL (Transact-SQL) needs a proper FOR loop! Pin
honey the codewitch9-Apr-24 21:58
mvahoney the codewitch9-Apr-24 21:58 
GeneralRe: SQL (Transact-SQL) needs a proper FOR loop! Pin
jsc4210-Apr-24 0:24
professionaljsc4210-Apr-24 0:24 
General.bash_history makes me happy, how about you? Pin
raddevus9-Mar-24 13:34
mvaraddevus9-Mar-24 13:34 
GeneralRe: .bash_history makes me happy, how about you? Pin
k50549-Mar-24 15:59
mvek50549-Mar-24 15:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.