English subtitles

← Probing the Unknown Solution - Programming Languages

Get Embed Code
2 Languages

Showing Revision 5 created 05/25/2016 by Udacity Robot.

  1. In this problem we've been tasked with finding a bug. Sounds
  2. pretty straightforward, and we've done this before, but this time we're
  3. mixing it up a bit, and not giving you access to
  4. the source code. We didn't really give you too much guidance
  5. on how to do this, but, believe it or not, this
  6. is actually a pretty common thing you're going to have to do
  7. in the real world. Having access to the source code, or
  8. the implementation itself, is often more rare than it is common.
  9. Plus, sometimes even with the source code, it can be so
  10. unfamiliar or poorly documented that it's, might as well not be having
  11. it all. With that said, let's look at the problem. So
  12. here we have the code to test the problem and below we
  13. have the give and test case. Now e told you somewhere
  14. in here lies the bug. One way to narrow it down, was
  15. to look at each of these hypotheses and then test them
  16. one by one. I'm going to show you a quick test case that
  17. gets right to the bug. Here, I've inserted the
  18. code from homework six, debugging environments and when I
  19. run that code, I see the same bug that
  20. we saw in homework six. This implies, and you
  21. can further verify on your own, the problem is
  22. right here, where we're not passing in the right
  23. function environment when we're executing a function. So, bug
  24. equals seven is the answer and just in case you're
  25. curious, here's the source code for the expression evaluation, and
  26. if we look at call, we'll see that the environment that
  27. we call the function on is the same environment from
  28. which its called and not from which the function was defined.