This is a good question that can be answered at several levels:
- Language Characteristics
- Testing
- CASE Tools
1. Characteristics of the language As you noted, the characteristics of the PHP language are very different from more strongly typed languages such as Java. This causes a serious problem when programmers coming out of more strongly typed languages such as Java and C # may not be aware of the consequences of the behavior of PHP (for example, those described by you). This introduces the possibility of errors on the part of the programmer (for example, a programmer who may have been less careful using Java, because he knows that the compiler will catch the wrong parameters, may not correspond to the corresponding caution when developing in PHP). Therefore, to solve this problem, it is necessary to improve the education / control of programmers (for example, standards of internal coding of the company, pair programming, code review). It also (as you pointed out) raises the question of whether to increase test coverage in order to check for errors that would be caught by the compiler.
2. Coverage testing The argument for testing coverage is very specific to the project. In the real world, the level of test coverage is primarily dictated by the admission of a client error (which is dictated by the consequences of an error that occurs in your system). If you are developing software that should work in a real-time control system, then obviously you will test more. In your question, you define PHP as the language of choice; this may equally apply to the ever-increasing number of web interfaces for critical system infrastructure. On the other side of the coin, if you are developing a simple website for a model railway club and just developing a newsletter application, your client may not worry about the possibility of an error in the constructor.
3. CASE Tools Ultimately, it would be desirable for a CASE tool to be available that can detect these errors, such as missing parameters. If there are no suitable tools, why not create your own. Creating a CASE tool is not available to most programmers, especially if you can connect to the open source parsing engine for your language. If you are open source, this might be a good project to launch, or perhaps your company might sell such a solution.
Conclusion In your case, is it worth testing the designers, basically it comes down to the question: what will be the consequences of a failure in my system? If you have the point to spend additional resources testing your designers to avoid such crashes, you should do this. Otherwise, it may be possible to pass with less testing, such as pair programming or code reviews.
ose
source share