Рекомендации NASA по написанию безопасных программ.

????? ??????? ????????????? ???????? «NASA Software Safety Guidebook». ???????? ???????? ???????????? ?? ????????? ?????????? ????????. ??? ?????, ??????? ? ?????? ??????. ???? ????? ??? ??? ?? ????, ??? ??? ???????? ????????? ? ??? ???????? ?????.

???? ???? ? ??????????? ???????, ???????. ????????, ???? ???? ? ?????????????????????? (N-Version Programming). ???? ? ?? ?? ???????????????? ??????????? ??????? ?????????. ???? ?????? ?????? ?????????? ?????????? ?????????, ?? ??? ? ???????. ???? ?????????? ?? ?????????, ?? ???????????? ???????????, ????? ?????????? ????? ????????? ???????? ???????????. ??? ?????? ?? ?????? ???? ????? ???????? ??? ?????? ??????????; ?? ???? – ????.

?????? ??????????:

One major problem with N-Version programming is that it increases complexity, which has a direct relationship with the number of errors. In one NASA study of an experimental aircraft, all of the software problems found during testing were the result of the errors in the redundancy management system. The control software operated flawlessly!

???? ?? ??????? ??????? ?????????????????????? ??????? ? ????????? ?????????, ??? ???????? ?????? ?? ?????????? ??????. ???? ?? ???????????? ?????????????????? ???????? ??????????? NASA ????????, ??? ??? ??????????? ??????, ????????? ?? ????? ????????????, ???? ??????????? ?????? ? ??????? ??????????????. ??????????? ??????????? ??????????? ???????? ??????????!

? ???:

Another difficulty with N-Version programming is that achieving true independence is very difficult. Even if separate teams develop the software, studies have shown that the software is still often not truly independent.

?????? ????????? ?????????????????????? ??????? ? ????????? ?????????? ????????? ????????????? (??????). ???? ???? ??????????? ??????????? ??????????????? ??????? ????????? , ???????????? ??????????, ??? ?????? ?????? ??? ????? ?? ???????? ??-?????????? ???????????? .

?????? ??? ????? ???? ???????. ??????? ???? ???? ? «?????????? ????????????» ??????. ?? ???? ??????????? ??? ????-??????? ?????????????, ???????, ??????? ? ?????? ????????? ???????? ???????????. ????? ??????????? ?????? ?????. ??? Ada – ?? ?????????. ???? ?????????? ?????????? ??? ???????? ??????????. ????????? ??????????? ?? ??????????? ???. ??? ?? ???????? ??? ??????????:

In many ways, C is a higher level assembly language. This gives it great flexibility, and opens a Pandora’s box of possible errors.

?? ??????, ?? – ??? ????????? ???????? ??????. ??? ???? ???????????? ???????? ? ????????? ???? ??????? ? ?????????? ????????.

?? ??. ??? ????, ?? ????.

Restricting the C language to certain constructs would not be feasible because the resulting language would not have the necessary functionality.

??????????? ????? ?? ?? ????????????? ?????? ??????????? ??????????? ?? ?????????????? ?????????, ??? ??? ???????????? ???? ?? ??????? ?? ?????? ?????????????????.

??????????? ??? ??????????? ????? ?????????, ????? ???????????, ? ????? ??????, ?????????? ???? ????.

?++:

A standard "safe subset" of C++ does not presently exist.

??????????? «?????????? ????????????» C++ ?? ?????? ?????? ?? ??????????.

… ? ???? ?? ????????.

Don’t use the RTTI (Run-Time Type Information). It was added to support object oriented data bases. If you think it’s necessary in your program, look again at your design.

?? ??????????? RTTI. ??? ???????????????? ???? ????????? ??? ????????? ????????-??????????????? ??? ??????. ???? ?? ??????? RTTI ?????????? ????? ?????????, ???????????? ???? ??????.

+1. ?? ?????? ??? ?? ???? ?????? ?????????.

??? C# ????????, ??? ??? ???????????????? ????. ??? NGEN ??? ?? ? ?????. ? ?????? ???????, ?? ????? ?? ??????? ?????? ?? ?????????? ????????

Forth:

Forth has no “safety” features.

? ????? ??? «??????????» ???????????.

?????? ? ???????. ?? ? ??? ?????. ??? ???? Visual Basic ????.

? ?????????? ???? ???????????? ??? ??????? ?????. ?????????? ?????????:

Use comments to describe WHAT the procedure or section is meant to do. It is not always clear from the assembly code.

??????????? ??????????? ??? ???????? ???? ??? ????????? ??? ?????? ?????? ??????. ??? ?? ?????? ??????? ?? ????????????? ????.

????, ? ?-?? ?????!

?????????? ?????, ? ?????.

Cross-posted from blog.not-a-kernel-guy.com.