[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (TFT) Animated TFT Battles

On Thu, Nov 19, 2015 at 4:26 PM, David Bofinger <bofinger.david@gmail.com>

> Converting to Javascript should be easy shouldn't it?

Hah! I didn't think so with my Melee simulator, but perhaps it's because I
was being too much of a purist with respect to modularity. The biggest
problem is that there are no obvious modules or encapsulation in
JavaScript. Things get global real fast, which we know is messy. You have
to resort to the so-called module pattern and/or AMD/RequireJS. Using
third-party libraries (jquery, d3.js, etc.) is always weird if they don't
support the modular trick you're using (there are shims in RequireJS for
that). Doing it in Node.js or AngularJS might be cleaner, but I'm not there
yet. All of these are hacks (the Javascript language doesn't have modules
yet, but maybe soon?).

Javascript not being strongly typed means you can shoot yourself in the
foot a lot and find out you did it many operations later. You'll spend a
lot of time trying to figure out why something is undefined (kind of like
null pointers). Get familiar with Chrome's developer tools (you can debug
inside it, and even change a live web page or CSS that's loaded). The
Network tab will show you if/when modules (e.g. RequireJS) are loaded.
StackOverflow is your friend.

Rathern than increase the risk of sounding like a text generator I will
stop here. Feel free to email me off list if you want to discuss. Cheers!

Post to the entire list by writing to tft@brainiac.com.
Unsubscribe by mailing to majordomo@brainiac.com with the message body
"unsubscribe tft"