Skip to main content

Posts

Showing posts from November, 2008

Choosing an Assignment Operator

If you were to write your own programming language (as I still intend to do someday even if only for the learning experience it provides me), what symbol (or symbols) would you use to represent the assignment operator? Even though it would looks like BNF or old-school Pascal, I would lean towards using := as the assignment operator. That would leave me free to use = for equality and there wouldn't be the issue of = vs. == tripping up new programmers. Besides, performing assignments is more common than making comparisons, so perhaps assignment should have the more distinct operator. Going one step further, if the language I wrote was not strongly typed, I would use == as the identity operator (as like PHP's === ). := and = to == seems a more logical progression to me than = and == to === . I suspect I wouldn't use = as both assignment and comparison as Basic does because of the ambiguity it causes. For example: x = y = 0 Does this mean "assign 0 to

JavaScript Frameworks Suck

There's been an interesting discussion off and on around the office this past couple of weeks about JavaScript frameworks, specifically which framework is the best so we can standardize on one. Of course I have to be difficult... my answer is none of them. As a general rule of thumb, "frameworks are evil." There are exceptions, but frameworks seem to cause a lot of unnecessary bloat, make tasks difficult to accomplish if they fall outside the intended scope of the framework, create obstacles to efficient debugging, and adversely affect page load times causing the application to appear slow and sluggish. The real question ought not be what framework is best, but rather be what exactly are you trying to accomplish with client-side scripting in the first place. Creating a rich user experience with standard JavaScript is not difficult. Many of the niceties the frameworks provide aren't magic... for example, $() is just function(x) document.getElementById(x);} . And A