Profile

Cover photo
Maga D. Zandaqo
685 followers|27,665 views
AboutPosts+1's

Stream

 
At first sight using getters for "lazy" initialization of heavy properties looks interesting:
function Element() {}
// lazy boosted getter
Object.defineProperty(
  // per each instance
  Element.prototype,
  // when children property is accessed
  "children", {
  get: function () {
    // redefine it with the array
    // dropping the inherited getter
    return Object.defineProperty(
      // and setting it as own property
      this, "children", {value: []}
    ).children;
  }
});
// example
var el = new Element;
// later on, when/if necessary
el.children.push(otherElement);

But I think it might break hidden classes, used in V8, and end up being not so good for performance. In a similar situation, when some instances might have a heavy property, I would try to go with a "subclass" for them if possible. What do you think, guys?
While examples used in this post are implemented in JavaScript, concepts discussed here about getters are, in my experience, universally valid. No matter if we are programming client or server, getter...
1
Malte Ubl's profile photo
 
It depends on the heaviness. Say, init takes 10ms, so you can barely do 60 fps when you init one and you have 1000000 objects and only need to access it in rare events – of course, it is worth it.

Joose has 1st class support (but using ugly getters). Can be very useful and pretty https://code.google.com/p/joose-js/wiki/CookbookRecipe3
Add a comment...

Maga D. Zandaqo

Shared publicly  - 
 
Good News, Everyone!
node-mongodb-native is now officially supported by 10gen as MongoDB +node.js driver!
1
16
Bulavitchi Oleg's profile photoMehdi Shojaei's profile photo
Add a comment...

Maga D. Zandaqo

Shared publicly  - 
 
[ #javascript ]

Fellow brogrammers, do/did you read JavaScript books? If so, vote for your favorite ones here: http://goo.gl/x73V7; otherwise, this list can be a good start: http://goo.gl/UL9yR
1
1
Jose Luis Garcia's profile photo
Add a comment...

Maga D. Zandaqo

Shared publicly  - 
 
“They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety.” — Benjamin Franklin
1
Add a comment...

Maga D. Zandaqo

Shared publicly  - 
 
So, the next big thing is halal vodka I suppose.
1
Add a comment...

Maga D. Zandaqo

Shared publicly  - 
 
There can be only one.
#nodejs vs #RoR
1
Add a comment...

Maga D. Zandaqo

Shared publicly  - 
 
Ryan DL originally shared:
 
1
Add a comment...
Have him in circles
685 people
Steve Mason's profile photo
Nathanael Anderson's profile photo
Chito Manansala's profile photo
Dennie Riechelman's profile photo
dima farer's profile photo
Sindre Sorhus's profile photo
Βασίλης Καρακασίδης's profile photo
Mauricio Sánchez's profile photo
iSONI Computer's profile photo

Maga D. Zandaqo

Shared publicly  - 
 
Speaking on type checking in +JavaScript. There's much hype about TypeScript and, as with Dart, one of its selling points is optional typing and type checking which is said to be much needed in JavaScript. But hey, "we've been having it!". If you need type checking in JavaScript use Google Closure Compiler and its JSDoc annotations. I for one am enjoying real time type checking right now in WebStorm 5.0: http://goo.gl/w1FkM
Providing comments and annotations to your JavaScript code is a way to make it more definite and easier to read by other developers. It is especially important in large projects. Some static code anal...
1
Add a comment...

Maga D. Zandaqo

Shared publicly  - 
 
One of the reasons why I left Django for +node.js almost two years ago with no regrets so far.
The Sun is Setting on Rails-style MVC Frameworks. Lately I've been thinking a lot about the impact of the move to a thick client architecture for web applications, and I'm becoming more and mo...
1
Add a comment...

Maga D. Zandaqo

Shared publicly  - 
 
Let me paraphrase a Bill Bryson's quote: “It's a charitable irony that a language that succeeded almost by stealth, treated for decades as inadequate and second rate tongue of html-coders, should one day become the most important and successful language in the world.”
1
Add a comment...

Maga D. Zandaqo

Shared publicly  - 
 
Martin Dransfield originally shared:
 
I always suspected this might happen
1
Add a comment...

Maga D. Zandaqo

Shared publicly  - 
 
“. . . anyone can do any amount of work, provided it isn't the work he is supposed to be doing at that moment.” -- Robert Benchley, 1949
1
Add a comment...
People
Have him in circles
685 people
Steve Mason's profile photo
Nathanael Anderson's profile photo
Chito Manansala's profile photo
Dennie Riechelman's profile photo
dima farer's profile photo
Sindre Sorhus's profile photo
Βασίλης Καρακασίδης's profile photo
Mauricio Sánchez's profile photo
iSONI Computer's profile photo
Links
Basic Information
Gender
Male
Maga D. Zandaqo's +1's are the things they like, agree with, or want to recommend.
Destructuring and parameter handling in ECMAScript 6
www.2ality.com

ECMAScript 6 (ES6) supports destructuring, a convenient way to extract values from data stored in (possibly nested) objects and arrays. This

A W3C Custom Elements Alternative
webreflection.blogspot.com

This W3C specification is awesome, and if you follow Alex Russell you know this has been probably his biggest obsession for years now: custo

ECMAScript 6 modules: the final syntax
www.2ality.com

ECMAScript 6 modules: the final syntax. Labels: dev, esnext, javascript, jsmodules. At the end of July 2014, TC39 [1] had another meeting, d

An Important Kindle request
www.readersunited.com

A Message from the Amazon Books Team. Dear Readers,. Just ahead of World War II, there was a radical invention that shook the foundations of

tc39/agendas
github.com

TC39 meeting agendas

We should all just decide on JavaScript and solve the interesting proble...
peterevjan.com

Our endless bickering over the merits of different languages and paradigms isn't all that productive, nor is it very interesting. You're not

Staring at the Sun: Dalvik vs. ASM.js vs. Native
blog.mozilla.org

As many of you are probably already aware, Mozilla has recently gotten into the mobile OS space with Firefox OS. Firefox OS is built using .

nginx news
nginx.org

2011-07-18. I have got news for you about nginx. Recently it became very clear for me that because of increasing popularity of nginx and the

HTML5 Rocks - How Browsers Work: Behind the Scenes of Modern Web Browsers
www.html5rocks.com

A resource for developers looking to put HTML5 to use today, including information on specific features and when to use them in your apps.

Linux
plus.google.com

Linux - doing it right

Mozilla is Unlocking the Power of the Web as a Platform for Gaming
blog.mozilla.org

Mozilla, a non-profit organization dedicated to promoting openness, innovation and opportunity on the Web, is advancing the Web as the platf

The evolution of the web
evolutionofweb.appspot.com

Interactive infographic about the evolution of browsers and the web. This infographic features major web browsers since 1993 such as Mosaic,

Booki.shWelcome to Booki.sh
booki.sh

Booki.sh is your own ebook library in the cloud, accessible from anywhere and almost anything.

Occupy Flash
www.occupyflash.org

The movement to rid the world of the Flash Player plugin

Brain Games - Lumosity
www.lumosity.com

Improve your brain with scientific brain games. Play games.

Joshua Foer: Feats of memory anyone can do | Video on TED.com
www.ted.com

TED Talks There are people who can quickly memorize lists of thousands of numbers, the order of all the cards in a deck (or ten!), and much

Scale of the Universe 2012 - OneMoreLevel.com
www.onemorelevel.com

Home · All · Action · Classics · Defense · Funny · Launch · Music · Physics · Puzzle · point and click P & C · RPG · Sports · Strategy ·

Re: @brixen’s "Is Node Better"
blog.izs.me

As usual, this year’s JSConf did not fail to deliver. The parties, the location, the talks, the food, it was incredible. Chris Williams (and

CastingCode.tv - Live coding events & on-demand screencasts for all ...
www.castingcode.tv

Do you like watching other people code? Do you prefer live coding presentations over slide-filled talks with canned code snippets?  Are scre