WebFund 2014W Lecture 3

From Soma-notes
Jump to navigation Jump to search

The audio from the lecture given on January 15, 2014 is available here.


- Node is a JavaScript-based web application whose running times is based on Chrome V8 engine.

- What is JavaScript as an environment?

- How does it compare to a system running C or C++? What’s the key difference?

- Assembler, C, C++ (these need more programming time but less run time)

- Python, Java, Ruby, JavaScript, LISP (these need less programming time but more run time)

- Rule of Thumb: 90% of your run time may be taken by 10% of your code.

- Intel and AMD don’t only produce new processors but they also benchmark them expensively on real world programs.

- Engineers don’t usually know how much time new processors take to run certain programs until they actually test them.

- A CPU optimizes hotspots in programs continuously but not statically.

- JavaScript is a garbage collecting language (like java) but it is not like java in one key respective that JavaScript is a loosely typed language while Java is a strongly typed language.

- JavaScript does not have classes because it does not associate types with symbols (A symbol is just a reference to any kind of data). In JavaScript, even a code is referred to as data.

- The answer of X/Y depends on the type of X & Y.

- All numbers in JavaScript are doubles.

- “Eval” function is a magical function because it takes a string of input and it runs it (or it evaluates it).

- In JavaScript there are global variables, local variables and nested functions.

- When you start using functions, all of your intuition gets messed up.

- In JavaScript lexical scoping encompasses dynamic scoping.

- In JavaScript, functions are data so we can return them from other functions.

- Having functions returning functions is a common design pattern in JavaScript.

- In JavaScript, “undefined” is a specific symbol value.

- In other languages, when we try to access something undefined we get run-time error or compile-time error. In JavaScript, we don’t get an error but we get the value “undefined”. -In JavaScript there are no classes but there objects.

- In JavaScript, the purpose of a class is to tell how an object looks like. JavaScript is an object-oriented language - Objects in JavaScript are thought of as associative arrays.

- Arrays are indexed by values. Associative arrays are indexed by strings. Hashing the strings gives the offset and the value. -JavaScript is LISP like language.

- In JavaScript, inheritance is based on prototypes. The idea of prototypes is when we try to access a property of an object that is not actually defined in the object and we just get back the value of “undefined”. This is not actually how it works. This is what happens when we can’t find any value of it, but it will actually look at a chain of objects. It will specifically look for the property type of the object and it will assume that the prototype refers to another object and that object will be then used to read after that.

- “Require“ takes a file and loads it and evaluates it and then it takes the export object that was in that file and it returns it as its return value.

- Express.static is an apache static file web server.

- Everything in /public should be accessible by the regular web page.

- Two places to look for JavaScript: Server and kernel.