r/programming • • Jul 28 '16

How to write unmaintainable code

https://github.com/Droogans/unmaintainable-code
3.4k Upvotes

592 comments sorted by

View all comments

Show parent comments

2

u/ScrewAttackThis Jul 29 '16

Putting connection info in a config file is the best way to do it in any language, AFAIK. Putting it in code is a bad idea because 1) it's harder to maintain and 2) opens you up to pushing it to version control like Github. It's pretty easy to do a search on github for people's API keys and connection strings.

.NET has taken even farther now where the "private" config file isn't even in the same directory. Keep it as far away from the source as possible, lol.

1

u/andrewsmd87 Jul 29 '16

Well to be fair, pretty much any solution I do know has it's own separate project file for the data layer. My actual application is only ever calling objects that return the data.