Platform/GFX/design patterns: Difference between revisions

(Created page with "This page contains notes about design pattern discussions around certain recurrent problems. The proposed patterns are not unanimously approved solutions, these are just notes...")
 
Line 11: Line 11:
Nical: Issues (1) and (2) can be generalized to any sort of invalid state (not just null pointers), but they happen so often at this level, that it is worth having a specific solution to them. If we come up with a solution for the more general case that efficiently covers the null pointer cases it is even better!
Nical: Issues (1) and (2) can be generalized to any sort of invalid state (not just null pointers), but they happen so often at this level, that it is worth having a specific solution to them. If we come up with a solution for the more general case that efficiently covers the null pointer cases it is even better!


Note that dereferencing a null pointer (1) is very often not the bug in itself, but the manifestation of other issues. Making it hard to run into null pointer dereferences may as well not reduce the amount of bugs, but it would be a good improvement if those bugs manifest themselves in ways that more explicitly show the issues (for instance "crash when assigning a null pointer to Foo" is easier to investigate than "crash dereferencing Foo" since the stack trace is closer to where the real problem happens).
Note that dereferencing a null pointer (1) is very often not the bug in itself, but the manifestation of other issues. Making it hard to run into null pointer dereferences may as well not reduce the amount of bugs, but it would be a good improvement if those bugs manifest themselves in ways that more explicitly show the issues (for instance "crash when assigning a null pointer to Foo" is in many cases easier to investigate than "crash dereferencing Foo" since the stack trace is closer to where the real problem happens).


== Why do we have these problems so often ==
== Why do we have these problems so often ==
Confirmed users
137

edits