Summary
Keywords
Full Transcript
In this second lesson about assertions and Design by Contract (DBC), you'll see how to practically apply them in embedded systems. Contents with Timestamps: ------------------------- 0:45 Agenda for the previous Part-1 and today's Part-2 1:00 Embedding assertions (the qassert.h header file) 1:45 qassert.h code review (using Doxygen documentation) 2:35 Q_ASSERT_ID() macro implementation 3:53 Q_ASSERT_ID() macro use 4:34 Q_DEFINE_THIS_MODULE() macro 4:52 no-return semantics of the Q_onAssert() handler 5:37 DBC elements: Preconditions, Postconditions, Invariants 6:57 Errors and the use of Q_ERROR_ID() macro 7:05 The Q_onAssert() assertion handler 8:12 Resetting the target in the assertion handler 8:37 Use of fault-injection for testing assertion failures 8:59 Assertions & Throwing Exceptions 9:48 Hardware assertions 10:28 Avoiding "denial of service" 11:06 Impact of Assertions 11:32 NASA JPL guidelines about assertion density 11:48 Microsoft Research study of assertions and code quality 12:25 Transformative impact of assertions on development 13:15 Demoralizing effects of "defensive programming" 13:32 Disabling assertions in the final product 14:45 Disabling assertions in the assertions-as-fuzes analogy 14:52 Disabling assertions in the assertions-as-guardrails analogy 15:08 Disabling assertions in the assertions-as-insurance analogy End Notes: ---------- Companion web page to this video course https://www.state-machine.com/video-course/ Project download for this lesson: https://www.state-machine.com/course/lesson-48.zip GitHub repository for projects for this video course: https://github.com/QuantumLeaps/modern-embedded-programming-course Transcript of this lesson: https://www.state-machine.com/course/lesson-48.txt References resources: --------------------- Key Concepts: Design by Contract https://www.state-machine.com/dbc Bertrand Meyer, “Applying Design by Contract”, IEEE Computer, 1992 https://www.state-machine.com/doc/Mayer92.pdf Miro Samek, “An Exception or a Bug?”, C/C++ Users Journal, June 2003 https://www.state-machine.com/doc/Samek0308.pdf Quantum Leaps, Design By Contract (DBC) for Embedded C and C++, GitHub https://github.com/QuantumLeaps/DBC-for-embedded-C Music credits: -------------- The background music comes from: https://www.bensound.com/royalty-free-music/track/straight
