Wednesday, 10 December 2014

javascript really (really, really) isn't java

This evening I've been playing with the time object I sort of started to create before (and haven't been happy with).  I'm still not sure I'm doing it right, but I'm pretty sure that it's better than it was.

A (very) long time ago when I was first introduced to javascript being told that it really had nothing to do with java.  I went for years not really caring. Every now and then in my career I've been a java or javascript developer and now and then I've run into one of the differences where thinking in one of the languages is really a disadvantage when working with the other. Tonight was one of those nights.
Tonight I was (again) trying to get my head round javascript objects, so simple on the surface MyObj = function(){//functions and variables} and then you add the new keyword and soon your reading about prototypes and trying to figure out what the difference is between a java and a javascript constructor.

These two pages and the best part of a decent Rioja have got me to where I am with this.
http://zeekat.nl/articles/constructors-considered-mildly-confusing.html
http://stackoverflow.com/questions/1646698/what-is-the-new-keyword-in-javascript

I'm still not happy with it but I think it's "time" (and I've renamed that a lot and will no doubt do again) to put it to sleep and move on to the missing functionality.

Still think I'm on target for the functional level of this working by next Wednesday (and I do think that what I've done has helped), but I have been reminded of events that are occurring over the next few days.  Tonight was an example of playing with code in a way that I wouldn't be able to do at work, it's possible that there's a good reason for that.

Here's the link to the github commit from this evening:
https://github.com/benjimouse/lunch/commit/55770bdfe8400a0d8203ae51581660cd58bbe275

No comments:

Post a Comment

Sorry getting a lot of spam coming through at the moment. So I'm having to moderate comments.

Note: only a member of this blog may post a comment.