Error’s meanings in software projects

0 Binary System Binary Software Digital

Software projects involve many people from different domains. Software developers, testers, domain experts, technical and sales managers working together and contribute to the project and influence on the software shape. Do they all agree what does it mean “errors” in software? The answer is yes, but not exactly.

Different contexts of errors

All the people in software projects understand error as an issue, a problem which needs to be handled. It may depend on context if a software behaviour is considered as an error or not.

An error in a context of a software developer

Being a software developer I consider error as a problem which may occur as a result of code statement execution. Error is an object like exception, number, special data structure or an event like function invocation. Errors are described in specifications of API. Generally, when You are a software developer You are being familiar with error raising and errors handling methods supported by programming languages and frameworks. In my opinion, the best definition of error occurrence in code is this from Alexandrescu and Sutter book “C++ Coding Standards”

An error is any failure that prevents a function from succeeding

Alexandrescu, Sutter ++ Coding Standards

According to the definition program codes include plenty of situations when errors occurred, and lots of codes were written to handle errors reported by invoked functions. Let’s see a one of common example (pseudocode):

Number getFileSize( _fileName ) {
     if file named by _fileName does not exist
     then report an error by returning -1
     else return size of the file in bytes
}

The function above must return the size of the file passed to it as a parameter. Of course, it cannot succeed in a case when the passed file does not exist on filesystem, so it returns a special value ‘-1’ which means an error. The client of the function may write something like this:

if getFileSize( myFile ) returns -1
then try to create myFile ...

The code above handles an error reported by getFileSize function. Both programmers (this who write the function and this who invoke it) understand an error as a situation in the code which needs to be reported and handled. There is something interesting, the function may return an error, but the function caller does not have to consider the error as a problem, he can ignore it and continue processing (for example it may be expected by the caller that file does not exist). We need to accept the fact , that for developers errors are objects or events in the code, they are not good or bad, but always requires to consider a method of theirs reporting and handling ( ignoring an error is also a handling method ).

An error in a context of a software tester

Testers understand an error as a software behaviour which does not comply with the specification (or their intuition if the spec does not exist). For testers, errors are not objects in the code. The difference of understanding errors between developers and testers are so big, that we have another word: ‘the bug’ which both parties understand as a problem with the software which must be fixed.

An error in a context of a software user

Assuming that the software works according to specification ( doesn’t have bugs ), the user can be only informed by programs about errors, in situations when his own action prevents the software for executing its task. For example, the user tries to open a file without permissions or tries to connect to a server with a wrong IP address. For the users, the errors are their own mistakes during working with the software.

user error message box
I made an error when I tried to open a text file with a program to pictures edition without permission

When software needs to report errors ?

Software can inform about errors in a few ways – it can report them to log file, print on console, send by network, show message box etc. All this actions must be programmed by software developers. Because different software stakeholders understand errors differently, the software designer needs to understand who will read the medium with reported errors.

Log files are a good place to report an error. because of debugging purpose software, developers want to put their information about any errors which occurred during the software execution. But what happens if tester or user will look at the log file? They may discover a lot of errors which do not affect their work because were handled safety by the code (just like in the example with getFileSize). Only developers will understand the real meanings of the reported errors. The same situation is with any other reporting medium.

The software architect should prepare a possibility of report errors in developers, testers and users contexts with a possibility to distinguish between them. For example for all errors in code it may be reserved different log severity like DEV_ERROR for any error in developer’s context, ERROR for tester’s context (occurrence of this error means ‘bug’ and needs to be fixed) and USER_ERROR which must be reported to the user.

References

  • Andrei Alexandrescu, Herb Sutter (2004) C++ Coding Standards: 101 Rules, Guidelines, and Best Practices. Addison-Wesley Professional, .

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *