When you write your code, are you dealing with errors proactively or reactively?

In other words, do you spend time anticipating errors and writing code to get around these potential problems, or do you write the code on your own and then work with any errors on the problem for a reason?

I have been thinking about this a lot lately and I am a very reactive person. I write my code, give it a twist, return the correct error, and repeat until the application works as expected. However, my friend suggested that he spend time thinking about how each line is interpreted, and corrects errors before they occur.

I must indicate that re-active is pure PRE-live. I definitely make sure my application works before it goes live.

+3
source share
7 answers

There must always be a balance.

Too many error checks are slow and result in garbage code. Inadequate error checking causes your program to crash around the edges, which is not so good to detect after sending it.

So, you decide how reliable some part of the code is and check the error checking accordingly. Some test utility may not be very reliable - less error checking. The COM server, intended for use by a third-party search service in a deep background, should be super reliable - much more errors.

+4
source

, , , , , . :

  • , (, , )
  • (, , ML, )

. "", , , .

, . - . , , , , , , .

0

-, ,

  • , , ?
  • , , html ?
  • , , ?

.. , , , , , , .

0

: , . , - (, ) , , . , , , , , , .

0

.

  • ,
  • -
  • , SQL .
  • , , . , , .

, . , , .

0

IMHO, "" ( "" ) , , .

. , . , - . , . , .

, . . , , . .

, , , . , , .

0

? . ( " ?" - , ?)

. , , , - , .

, ... , . "", , "" , , . , , , - . ( , SO, .)

I suppose the only general answer is: “I do what makes sense in terms of saving time in the long run,” and this, after all, is the whole reason to use machines to work for us.

0
source

Source: https://habr.com/ru/post/1763100/


All Articles