Rotate - Design Notes
by Demian Katz
Why did you do this?
I always used to love typing in BASIC computer games. I've been learning new Javascript techniques for work. I figured I'd combine the two things and turn some old BASIC computer games into Javascript programs to brush up my skills and have fun in the process.
What's with the crazy indenting?
My current employer uses an older C indentation style that indents curly braces along with their contents. It took some getting used to, but now I'm used to it, so I write code using this style. If it bugs you, feel free to make a copy of the code and change it.
Why MooTools?
Javascript can be a bit of a clunky language, plus there are various cross-browser compatibility issues. Frameworks like MooTools help make the code more concise and readable and smooth out compatibility problems. I like MooTools for its Class structure, $() selector function and easy event handling mechanism. I've already managed to turn 58 lines of BASIC into 348 lines of Javascript, 83 lines of CSS and 41 lines of HTML; without the compactness allowed by MooTools, it would be slightly more ridiculous.
Why this game?
A lot of old BASIC games involve reading large blocks of text and then typing in responses, but this one is very visual -- it really benefits from the conversion, since clicking on the puzzle is a lot more natural than typing in numbers between 1 and 16.
What can I learn from this?
I tried to make the code fairly clear and use good programming practices. There are a couple things worth looking at if you're interested in learning about web programming:
You could have done this better.
There's definitely room for improvement here -- it might be fun to use cookies to make the game history tracking more persistent. The CSS could probably be polished to make things prettier. The pop-up alerts would look better if they were rendered as page elements rather than the ugly browser defaults. Feel free to improve upon the design, and please let me know if you do!
Your design notes are inadequate and/or self-indulgent.
Probably. Feel free to ask questions or yell at me -- my email address is demiankatz@gmail.com.