Coping with weak typing
I'm a fr开发者_如何学运维ont end Flex developer peeking over the wall at html. One of the things I have a hard time with is weak typing in Javascript. I know many developers say they prefer it. How do I stop worrying and learn to love the weak typing? Are there best practices for variable naming that help make var types human readable?
Another thing I have trouble with is getting by without my trusted compiler errors and warnings. I'm getting along with firebug. Is there anything else I should have in my toolkit?
How do I stop worrying and learn to love the weak typing?
it comes naturally when you start to love the language (JavaScript).
Is there anything else I should have in my toolkit?
you should also have the Specifications/References in your bookmarks HTML4, HTML5, XML, JavaScript, DOM, CSS.
if you need tutorials and explanations, they’re easily found through google.
Javascript weak typing is torturous. I would use WebStorm to help with code completion, since it is reasonably good at inferring type. TypeScript would be another way of getting around weak typing.
There is no really way to love it. Some people love it, but in my opinion it just makes the code far more buggy.
I'd recommend trying Aptana (Eclipse-based IDE) if you haven't yet - it integrates well with Firebug and will help keep you from veering too far off the road as you get comfy with the "looseness" of JS.
Toss in the requisite copy of Javascript: The Good Parts (the Google TechTalk video & Douglas Crockford's site too), and you'll be well-prepared for the Javascropalypse in no time.
精彩评论