-2

I think that in programming error checking is extremely important, not a secondary topic, what if your programme crashes without an error, just silently aborting? What if you must discover a SintaxError at line 1293 by manually checking all the lines? Would any programme longer than 5-10 lines be possible if error checking was never invented?

By no error checking I mean absolutely zero feedback if something goes wrong: not a line number, not a hint, nothing.

closed as unclear what you're asking by gnat, Doc Brown, Dan Pichelman, user53019, Mason Wheeler Jan 10 '15 at 19:53

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    The idea of error checking never being invented strikes me as very odd, perhaps even metaphysically absurd. Certainly the program (say, the compiler compiling your program) would go wrong at some definite place. Regardless of whether it then crashes or gives wrong results, people would debug it and pinpoint the cause (surely you don't want to question the ability to debug too?). Going from that to inserting a test for the cause of the error requires nothing except the same affinity for automation and generalization that drives programming in the first place. – user7043 Jan 10 '15 at 14:22
  • Your question is pretty unclear. What does that actually mean - no error checking? For example, assume you have a compiler which processes your source code one line after another and prints the next line which it processes. When it reaches line 1293, it silently aborts. Now you can still see where the problem occured, though your compiler does no explicit error checking - does that count as "no error checking" in your mental model? – Doc Brown Jan 10 '15 at 16:44
  • I recall working in the mini-assembler on the Apple ][+ in days of old for programs that were reasonable size (not huge) academic exercises. There was no error checking there at all. It either worked or it didn't. Having A9 42 when you meant A4 42 wasn't an error - it just didn't work the way you expected it to. – user40980 Jan 10 '15 at 18:44
  • 1
    As a kid with a C64, I would write down machine instructions on paper, translate it to byte values by hand using some booklet I had, load that into memory and run it. No mechanism for error messages. Programming the first computers would have been like that too (and WAY longer than 5-10 lines), so clearly programming existed before error messages. – RemcoGerlich Jan 10 '15 at 20:24
  • And old programs were stacks of punch cards, e.g. - commons.wikimedia.org/wiki/… . You might get an error message from that after running it, but then you'd have to type make them anew. – RemcoGerlich Jan 10 '15 at 20:29
3

I'm not sure why anyone has been downvoting; I think this is a valid question, even if it seems absurd or the answer is obvious to everyone else.

If there is a language with a compiler that has no error/syntax reporting, the programmer can implement their own error reporting with basic tests and their program has to meet those expectations when they run they run the test program; when all the expectations in the test are met, the program has no known errors. If a part of the test doesn't receive the expected value from the program, then the programmer can know where something went wrong. There might not be error reporting per se, but this would definitely allow for large applications to be written with a stupid compiler or interpreter. This, of course, is under the assumption that we are dealing with languages that have construct which would allow interaction with specific components(functions/methods/classes/modules/libraries/etc.). Even without that, one could write a test routine that would go to a specific line of code and test whatever value gets returned.

Today, what I described is Behavior Driven Development(aka BDD).

Even without such tests, people have written applications with huge code bases without much useful feedback. Depending on what form of assembly language one writes in, you may get no feedback except unexpected behavior. Many C compilers don't have much useful feedback; not like that of modern interpreted languages. Chris Sawyer wrote the original Roller Coaster Tycoon in mostly assembly and some C, which was definitely larger than 10 lines and I'm willing to bet that much of his development was based upon seeing whether or not he was getting the expected behavior from his code.

EDIT: Better yet, it just so happens that I had an experience about 5 days ago where I wrote 126 lines of Python code and it worked the first time I ran it. That doesn't happen too often, but it shows that even a mediocre programmer such as myself can write more than 10 lines of useful code without error checking. It just takes a lot of thought and planning.

Let's also not forget that before QWERTY keyboards and modern file systems, people wrote programs and even simple games by punching holes in cards and the programs were stored on big stacks of punched cards that were inserted into a giant computer; the program either worked or it didn't, and it was simply not practical to rely on feedback from the computer. Using a computer was also a privilege for most, as not everyone had ownership or access to one on a regular basis. The equivalent of 10+ lines of working code was written this way.

2

Programming is often done without any error checking, even now. It's just considered sloppy, and should only be done for quick prototypes (or code golfs) that you're likely to throw away or rewrite later. Scripting languages tend to be good for this in part because they handle errors reasonably well whether or not you write any error handling code yourself.

If you mean "could we have gotten where we are without any piece of software ever doing error checks?", then the answer is no, unless someone invented a computer with infinite memory and no hardware faults, along with a network with 100% uptime for everyone forever, and so on.

If you're thinking of a specific convention such as checking the error codes returned by a function call, throwing and catching exceptions, or passing in success and failure callbacks, then yes we could have used different techniques.

There's also the philosophical problem (as pointed out by delnan) that you can't always draw a fine line between "error checking code" and "real code". If I'm writing a sqrt() function, checking that the input is positive is definitely an error check. But if I'm writing an HTML form with a bit of Javascript that automatically hyphenates phone numbers regardless of how the user entered them, is that considered "error handling" or "presentation logic"?

  • +1, especially for the last paragraph - to discuss if programming makes sense without error checking, one must first clearly define what error checking means in contrast to "no error checking". – Doc Brown Jan 10 '15 at 17:25
1

Of course.

The only way you have syntax errors is if you have syntax. To have syntax, you need to have a language. To use a language, you need a compiler. At the very least then, the first compiler was a program written where there was no nice pleasant error messages when things went south.

  • 1
    What was the "first compiler", and what makes you believe it contained no error checking? – Doc Brown Jan 10 '15 at 16:51
  • I don't mean the first compiler had no error checking, the machine code used to write the first compiler had no error checking, since CPUs don't really report errors... They just do something weird/wrong. – Telastyn Jan 10 '15 at 16:54
  • I am not sure I really understand what you mean, but obviously any machine code program can have or not have error checking (in fact, I don't think in the context of this question it makes a difference if a "machine code" program was written by hand or created by a compiler). – Doc Brown Jan 10 '15 at 17:19
  • @DocBrown - imagine you're a programmer writing machine code for the first compiler. If you put in invalid machine code, do you get an error message? If you input code that accesses something uninitialized, or similar issue modern compilers check for... You get nothing. So yes, programming has happened (slowly, painfully) without the immediate feedback of some program validator. – Telastyn Jan 10 '15 at 17:39
  • Isn't machine code also a language? – Pieter B Nov 1 '16 at 15:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.