Click here to Skip to main content
15,887,434 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.

 
GeneralRe: String.Format??? [modified] Pin
PIEBALDconsult9-Jul-10 5:15
mvePIEBALDconsult9-Jul-10 5:15 
GeneralRe: String.Format??? Pin
T M Gray9-Jul-10 9:38
T M Gray9-Jul-10 9:38 
GeneralRe: String.Format??? Pin
User 27431629-Jul-10 13:14
User 27431629-Jul-10 13:14 
GeneralRe: String.Format??? Pin
hairy_hats13-Jul-10 0:35
hairy_hats13-Jul-10 0:35 
GeneralRe: String.Format??? Pin
PIEBALDconsult9-Jul-10 9:39
mvePIEBALDconsult9-Jul-10 9:39 
GeneralRe: String.Format??? Pin
_Maxxx_15-Jul-10 18:33
professional_Maxxx_15-Jul-10 18:33 
GeneralRe: String.Format??? Pin
PIEBALDconsult16-Jul-10 5:49
mvePIEBALDconsult16-Jul-10 5:49 
GeneralRe: String.Format??? Pin
_Maxxx_17-Jul-10 0:29
professional_Maxxx_17-Jul-10 0:29 
PIEBALDconsult wrote:
some SPs disappear and bring a system down (granted that was SQL Server 6, but I still don't know the cause).


I can understand your point - but what if a DLL had disapeared without explanation? There's nothing magical about SPs thery are just Database objects.


PIEBALDconsult wrote:
software for sale, where the buyer may demand "it's my database and I want access".


I've found that it depends onthe size and computer-savviness of the customer. small customers, yes, customers with any sort of IT dept really hate having their users have access, but demand full access to the IT staff.

If all access to your data is through SPs, then you can give execute only access to everyone (and even require a password as a parameter if you're paranoid) but restrict changing of SPs to only those few.


PIEBALDconsult wrote:
all code changes to go through change control, testing, and a proper deployment.


sure - in fact most large sites are much more diligent about this in DB than in code. You can put SP scripts in source control, you can set up tests to test them, you can do source compare and versioning etc. etc. You can do all that you can do with any other source code because the source code for an SP is just that - source code.


PIEBALDconsult wrote:
They are too open to a properly-authorized but malicious (or inexperienced) employee.


.. who has open slather to the entire database, in your model, tables data and all! Sure a sufficiently irate tachie could change a SP to regularly do womething - equally they could just change the data, write a tigger etc.
PIEBALDconsult wrote:
when a database is restored from backup? Don't you have to reapply any changes you made since the backup?


No - you usually back up databases as a whole - SPs, views, tables, data, keys, foregin keysm constraints etc.etc.etc. and restore them the same - so no additional work at all.


PIEBALDconsult wrote:
As a bonus, not being able to implement a change instantaneously allows a cooling-off period -- you may be able to convince the customer that the change they want is a bad idea.


it's rare to make a change to a live site without some thought and process - especially if it is a customer who is likely to be paying for it! Think more of the time when you haven't noticed that this particular bit of program is including customers with the 'inactive' flag set.

With SP, you quickly add 'and active = true' test against the current live code base, and deploy to the database.

With SQL in code you find the code (hopefully only in one place and reasonably formatted to amke it easy to change) and add + " and active = true". Them you test - but hang on - you need to apply that change to the last live version not the current dev version - so you probably need to branch first, then test and deploy the executable to all workstations.

as you are a self confessed evangelist, there'll be no convincing you - so try to keep an open mind and look at the pros and cons. I did some years ago and was persuaded to move to the dark side of SPs - and I haven't looked back.
___________________________________________
.\\axxx
(That's an 'M')

GeneralRe: String.Format??? Pin
PIEBALDconsult17-Jul-10 2:54
mvePIEBALDconsult17-Jul-10 2:54 
GeneralRe: String.Format??? Pin
_Maxxx_18-Jul-10 1:09
professional_Maxxx_18-Jul-10 1:09 
GeneralRe: String.Format??? Pin
PIEBALDconsult18-Jul-10 4:01
mvePIEBALDconsult18-Jul-10 4:01 
GeneralRe: String.Format??? Pin
oggenok6417-Jul-10 5:07
oggenok6417-Jul-10 5:07 
GeneralRe: String.Format??? Pin
PIEBALDconsult9-Jul-10 5:02
mvePIEBALDconsult9-Jul-10 5:02 
GeneralRe: String.Format??? Pin
Jason Christian22-Jul-10 9:00
Jason Christian22-Jul-10 9:00 
GeneralRe: String.Format??? Pin
CDP18029-Jul-10 0:44
CDP18029-Jul-10 0:44 
GeneralRe: String.Format??? Pin
sergiogarcianinja9-Jul-10 4:47
sergiogarcianinja9-Jul-10 4:47 
GeneralRe: String.Format??? Pin
Jörgen Andersson9-Jul-10 4:59
professionalJörgen Andersson9-Jul-10 4:59 
GeneralRe: String.Format??? Pin
PIEBALDconsult9-Jul-10 5:06
mvePIEBALDconsult9-Jul-10 5:06 
GeneralRe: String.Format??? Pin
David Skelly9-Jul-10 5:54
David Skelly9-Jul-10 5:54 
GeneralRe: String.Format??? [modified] Pin
PIEBALDconsult9-Jul-10 7:31
mvePIEBALDconsult9-Jul-10 7:31 
GeneralRe: String.Format??? Pin
Jörgen Andersson9-Jul-10 10:23
professionalJörgen Andersson9-Jul-10 10:23 
GeneralRe: String.Format??? Pin
PIEBALDconsult9-Jul-10 10:33
mvePIEBALDconsult9-Jul-10 10:33 
GeneralRe: String.Format??? Pin
oggenok649-Jul-10 8:14
oggenok649-Jul-10 8:14 
GeneralRe: String.Format??? Pin
PIEBALDconsult9-Jul-10 8:59
mvePIEBALDconsult9-Jul-10 8:59 
GeneralRe: String.Format??? Pin
Jörgen Andersson9-Jul-10 10:48
professionalJörgen Andersson9-Jul-10 10:48 

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.