20,741
edits
Line 73: | Line 73: | ||
However, Nasal scripts may need to work with all of these components, regardless of the concrete implementation - this is where we commonly see spaghetti code using lots of nested if/elseif constructs to deal with the differences among these implementations. | However, Nasal scripts may need to work with all of these components, regardless of the concrete implementation - this is where we commonly see spaghetti code using lots of nested if/elseif constructs to deal with the differences among these implementations. | ||
But this is exactly where it pays off to simply encapsulate implementation specific details into a hash with callbacks that can be easily switched. | |||
== Example == | == Example == |