learning javascript

Am beginning to learn node.js from here(http://www.nodebeginner.org/). And can’t help but observe the ability to pass a function as an argument to another function*, is a what python would call as first class functions, and is also the reason some consider javascript a good tool to learn functional programming.
May be that’s the most crucial part of functional programming, and haskell has just designed/added other features too based on their purity principle, while python has followed the “Practicality beats purity**” principle.

And am beginning to see, nay grok the meaning of asynchronous call back/event-driven design. Still convinced, it’s over-hyped, but am barely beginning to imagine why it has created excitement among programmers. Kinda like monads(i.e isolating I/O)***, this design enables the programmer to focus on a single sequence of events, while letting the side-effects happen, whenever they do. What i don’t like though is the uncertainty involved.

And the functions are referentially transparent.(atleast AFAIK).And variable scoping is different from that of python. i.e. variable declared outside a function are not automatically available inside it. or for that variables from a caller in a callee(Well, neither does so in python).
But the http module objects response and request are available to the callback functions to a http module function.

Looking through the node.js, http module indicates that they have a exports special keyword and assign the objects they want exported as exports. = object. Interesting…….

The most annoying parts of javascript programming(to me) is the nature of the code,debug,fix,run loop. i.e. I have to absolutely use the mouse for some parts of loading in the browser and debugging. sure there are shortcuts and the fact that i don’t know a lot plays a role…but i can’t help wondering if the problem is aggravated by browsers/websites, rarely designed from a keyboard centric UI standpoint.

*-Essentially like any other variable in the language.
**- Mentioned in import this.
*** – looks like i need to learn monad concepts better. I can see the analogy is either incomplete/wrong.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s