"it won't affect anything"... on basic development rules: don't make assumptions
When you go to sleep you set the clock's alarm and you assume that it'll work and it'll wake you up in the morning, in some cases you'll setup two alarms assuming that if one doesn't work the other one will (I least I do that when I'm going to be traveling the next morning), when you are driving you drive through a green light assuming that no one is coming from the sides, because they have a red light, etc, etc, etc, at some point we assume something; we live by assumptions!
when we are programming is no different, many times we make assumptions, and quite often those assumptions translate into poorly performant software or users end up using your software in a way you didn't expect it to which translates into a bad experience because you didn't program the software to be used that way (you assumed a different use)
so it's all about assumptions, we assume that a connection will exist, that a file will be there, that a query will run...
do yourself a favor, think about the assumptions you make and try and remove them, this is FAR easier said than done, but just by being aware that you shouldn't make assumptions you will already be ahead of the game, I have been living (not only programming) by this concept for years and I still make assumptions that will *cost me* errors in the software I write, but it is definitely a lot less errors
a very huge assumptions that is made is
"it won't affect anything"
that's a big one, everyone's done it several times, so think back how many times you've said "it won't affect anything" and you ended up breaking the entire system, messing up the database, etc
sure, that's what testing is for, but first of all, if you introduced new bugs you end up wasting a lot more time that it was necessary and second, not everyone has a test team, and if you test your own software since you are pretty sure "it won't affect anything" you don't test your software that well
here's a list of common things that you SHOULD NOT assume
- your app can use all the RAM it needs
- your app can use all the DISK space it needs
- a file will exist
- you will have permissions to do X or Y (specially on web apps, accessing files, etc)
- your app will run under administrator privileges (this is a big one too)
- a connection will be present (TCP, HTTP, SQL, etc)
- a connection will not be dropped in the middle of things
- it won't affect anything
that's a small but pretty good list I think, start avoiding assumptions, I guarantee you will become a better developer that creates more reliable software faster
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment