bitwix

Tangential comments about Software Development

Wednesday, February 27, 2013

TypeScript brings C# values to JavaScript

I ported my jQuery mobile web app to TypeScript www.typescriptlang.org which took an afternoon to get my head around, then a morning to do.

You quickly get used to refence path= at the top, so that you get Intellisense.

I tried renaming all files as .ts and compiling. That created too many errors. So I brought in code files one at a time, with judicious commenting-out. That worked.

It's nice to be able to choose when to give a variable a type, when to use any and when not to set the type. I found myself tightening (typening?) the code a little as I went on, but have stopped well short of 100% typed.

Compile errors as a spell check: so useful, so familiar! Intellisense as a shortcut to avoiding spelling errors in the first place: brilliant!

Then compile errors during aggressive refactoring, as I move functionality between modules. I like the reassurance that I've changed all references.

It's the certainty of the compile step that I value. By giving that back to me, TypeScript is a significant improvement on JavaScript.

Saturday, February 02, 2013

My Perfect Day

I've blogged before about working with a perfectionist. This week, I had an unplanned free day, and my perfectionist streak came out. Here's what I worried about in the project in hand:

  • a user interface that made sense
  • the back button
  • consistent idioms in the code
  • removing unused code
  • reducing the web traffic required

To put it another way, I didn't worry about functionality or efficiency. These days, I view functionality as an exploration, trying out ideas to see which my users actually want and use. And efficiency at the line-of-code level follows from data, not as an abstract goal.