[go: up one dir, main page]

Showing posts with label JavaScript. Show all posts
Showing posts with label JavaScript. Show all posts

Friday, September 22, 2023

TypeScript Origins: The Documentary

I watched yesterday’s 80 minute TypeScript documentary, TypeScript Origins: The DocumentaryTypeScript is a superset of JavaScript that transpiles, with static typing, into JavaScript so it can run inside a web browser.

The enlightening part of this documentary is that it starts with Microsoft employees talking about what a paradigm shift it was for Microsoft to embrace open source software development. It highlights the differences in leadership between Gates/Ballmer and Satya Nadella who took over as CEO in 2014. Nadella saw the importance and power of goodwill with open source while transitioning the company to providing cloud services. That’s a huge culture shift for a behemoth company like Microsoft which is one of the largest companies in the world. 

It’s interesting to see how a company, like Google, has shifted away from, “Don't be evil,” while Microsoft has become more open and supportive of the developer community. 

Monday, September 4, 2023

Everything They Wanted to Be

  1. Java became what Ada wanted to be. Write once, run everywhere. 

  2. Javascript became what Java applets wanted to be. Mobile code in a web browser.

  3. REST became what SOAP wanted to be. Remote procedure calls with data over the Web.

  4. JSON became what XML wanted to be. Human readable, machine to machine data exchange.

Saturday, December 29, 2018

Java and JavaScript Objects

Dave Winer posted a lesson-learned tip about JavaScript. Although Java and JavaScript are unrelated languages, they have many similarities.

var d1 = new Date ("March 12, 1994");
var d2 = new Date ("March 12, 1994");
alert (d1 == d2); // false

It seems that JavaScript, like Java, is actually comparing the two Date objects, d1 and d2, to see if they're the same object in memory, not the same value. Since these instance variables are not referencing the same object the alert line of code returns false.

Although, at first blush, this seems unintuitive, it actually allows greater flexibility when making comparisons. If you don't want to compare the two objects, but rather the value of the two objects, then you can simply send the Date object the getTime() message which returns true.

var d1 = new Date ("March 12, 1994");
var d2 = new Date ("March 12, 1994");
alert (d1.getTime() == d2.getTime()); // true

And, finally, to prove my theory to myself...
var d1 = new Date ("March 12, 1994");
var d2 = d1;
alert (d1 == d2);  // true