I hereby claim:
- I am alee on github.
- I am allenlee (https://keybase.io/allenlee) on keybase.
- I have a public key ASBsFRhfbUPQhoj9qrwqZfyYLYyHsq8Ytoj6Zdhljaualwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
In my experience, a disproportionate amount of bugs in NetLogo models are caused by the mismanagement of global variables.
Here are a few reasons why I think that is the case, in (roughly) decreasing order of importance:
Code is not just a way of getting the computer to do what you want it to do—it is a way of conveying meaning to the reader of your code. When you declare a global variable, the meaning you convey is: “Hey! This thing is important throughout the whole program. You should always be paying attention to it.”
Sometimes it’s justified , but very often, it is not. An unjustified global is not only failing to convey the right message: it’s actively misleading.
When I approach a model’s code for the first time, the first thing I do is look at the declarations on top: what breeds do we have, what agent variables do we have, and what global variables do we have? That gives me the “big picture” and tells me what I should be paying attention to when trying to understand what the code is do
| import base64 | |
| import hmac | |
| import hashlib | |
| from urllib import parse | |
| from django.contrib.auth.decorators import login_required | |
| from django.http import HttpResponseBadRequest, HttpResponseRedirect | |
| from django.conf import settings | |
| @login_required |