This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
5tarKaster's profile picture

Would It Be Fair To Assume Everyone Here Isn't Complete Idiots?

Started by 5tarKaster, 03 October 2013 - 01:58 AM
5tarKaster #1
Posted 03 October 2013 - 03:58 AM
simply because I really don't want to implement tedious and possibly unnecessary error handling in my code. I mean if you design something to work a particular way and give a very clear explanation as to how to use it then surely strict error handling is well unnecessary… basically a little example would be if your turtle is attempting to drop a full inventory in an already packed chest, you wouldn't reeeaalllyy need to handle that. I mean you'd obviously be able to tell the chest is full because the turtle didn't drop its items in there…

You know what I mean? Everyone here should at least have some sense of logic, even if it's minimal to be able to enjoy using ComputerCraft, why else would they have it?
svdragster #2
Posted 03 October 2013 - 04:42 AM
Everyone loves looking for bugs and break the program with it.
5tarKaster #3
Posted 03 October 2013 - 05:13 AM
sure fair enough but I mean it's kind of your own fault if you purposely break the program, they can look and they will find but if they use the program the way it was meant to be used then there is no problems, and no real need to handle the issues
jay5476 #4
Posted 03 October 2013 - 05:39 AM
specifying it needs a chest with x amount of slots available should be enough but, some people would like to see this as an auto thing its personal choice as if you were to make it auto and stop until the chest has enough slots. or put an instruction someone has to read like 'make sure chest is empty' wait for confirmation(user input/can be lying)
immibis #5
Posted 03 October 2013 - 08:54 PM
Someone will have a chest that is automatically emptied by AE, and then they will run out of power so the chest doesn't get emptied.
If your program spews items all over the ground when this happens, or goes the wrong way and digs through the wall of their house, your program is clearly of lower quality than a program that quietly waits for the chest to be emptied.
AgentE382 #6
Posted 03 October 2013 - 10:21 PM
Handle plausible errors.

You don't need to handle someone using your code the wrong way (as long as you specify the right way in your documentation), but you do need to handle conditions where legitimate use of your code may cause an error.

Take my RC4 encryption function as an example. In the documentation, I specify that you must pass a single argument, either a string or a table of character codes. I don't handle any improper use of the function. If you pass a boolean, lua will error out. However, I've spent a great deal of time testing, revising, and optimizing my code so that it never breaks when used according to the documentation. Some other lua RC4 implementations I've seen break after a few lines of text. I've used mine to encrypt several megabytes at once.

In the real world, let's say you wrote an interface to a database system. If another developer uses your code the right way, your code should handle any errors the database may spit out. It's your job, as the author of the interface, to deal with any abnormal circumstances. That way, the other developer doesn't have to worry about how the database works. All he has to know is your API.

The same applies to your turtle program. If you say in your documentation that your code will transfer the turtle's inventory to a chest, then it had better do that every single time, even if it is disrupted. If your documentation says that it will fail if the chest is full, then whoever uses your program will know that they need to check for room in the chest before calling your code.

It's all about the contract you make with whoever uses your code (docs / function signatures / APIs). You need to make sure that if they stick to what you told them to do, they get what they bargained for.
Xenthera #7
Posted 03 October 2013 - 11:29 PM
Don't take this the wrong way, but if you are ever going to survive being a programmer, you MUST assume the end user is an idiot (regardless if this is true or not). Letting plausible errors slide through tells the end user you don't want, or care, to put in enough time to make a good program. I apologize, but your mindset is just a very, very bad one to have.
5tarKaster #8
Posted 04 October 2013 - 05:15 AM
haha yeah I am a programmer for reals, i just often have little time and or patients to create absolutely bug free code for people who should at least have a bit of programming experience in the first place. I mean I test and squash bugs in my job, so when I'm programming for fun, I tend to be a bit lazier with the error handling… particular when it's designed to be used by people who, again, should at least have some sense of logic because they are using ComputerCraft. In the real world, yes, assume they are monkeys… but this is not the real world, it's computercraft. That's why I also said in the title "would it be fair to assume everyone _Here_ isn't complete idiots" Here meaning computercraft users
theoriginalbit #9
Posted 04 October 2013 - 05:56 AM
Ok so time to put in my two cents. Assume everyone is an idiot, full stop. Always attempt to have all bases covered, because if your program is good enough it'll go beyond just people here, it will go out to others who may know nothing about ComputerCraft or programming other than they can run programs and get it to do things. Also on these forums there is a large amount of new users daily (and quite a lot of existing users) who know nothing about programming or common sense either, I've seen quite a few in the time I've been here, and I've experienced a lot of "dumb" users with my programs, and "stupid" developers with my APIs.

Don't take this the wrong way, but if you are ever going to survive being a programmer, you MUST assume the end user is an idiot (regardless if this is true or not).
That doesn't just apply for programming. Why do you think they have to put the message "do not iron clothes while on body" on clothes irons?!