Saturday, September 17, 2016

React on Node Learning Plan

I have put together a learning plan template to help me focus. In tech I believe that how effective I am at learning and then quickly implementing that knowledge is what I am being paid to do. Below is the first plan I have together to begin testing if a learning plan is worth while.

QuestionAnswer
What specific skills do you want to work on?I want to learn React on Node
Why do you really want to learn a new skill?I think React is a better framework than Angular
Assess current skill levelNovice
Research the skill and related topics.JP said to read the react book
Set a clear goal about what you’re planning to learn.
Specific:I want to be proficient at building React web sites on Node.js
Measurable:I can build one website based on a tutorial using React/Redux/Express/Node
Achievable:One React website based on Pluralsight tutorial
Relevant:Because it is a framework that I believe is a long standing good framework
Timely:In one week
What mini goals/milestones do you want to set for yourself?30 min a day of the course
How do you want to learn?Pluralsight
Set specific concrete tasks for yourself to accomplish every day.30 min a day of the course
What is smallest action you can take to start learningStart the course
What is the 20% you can study that results in 80% of skill gainThe Pluralsight course will give me a broad view of React on Node
What is the foundational concept that all other concepts rely onunknown. JS
Who is your learning accountability partner or online study group.I will ask Crouch and JP to keep me accountable
How will explain the concepts you learnedI will post it on my blog and in the JS slack
Where will this go in your portfolio.GitHub
Imagine the opposite of what you want.I spend all this time on the course, but I don't learn react
What are the expectations practitioners have set.JP said to read book
Make and test predictions.unknown  

JavaScript Garbage Collection

When I was reading about closures in JavaScript I became curious about how garbage collection worked. Why do closures have variables that stick around. At first I thought it might be by reference, but I did some research and learned that garbage collection occurs when an object is unreachable which is not the same as an object is not referenced. In the previous algorithm, reference counting, cycles were a problem. Circular references would lead to memory leaks.

function f(){
    var o = {};
    var o2 = {};
    o.a = o2; // o references
    o2 o2.a = o; // o2 references o
    return "azerty";
}
 f();

The mark and sweep algorithm solves this issue. Quote “In the first above example, after the function call returns, the 2 objects are not referenced anymore by something reachable from the global object.” At that point they are garbage collected.

Reference: Memory Management

Sunday, September 11, 2016

JavaScript Safer 'this' in depth look

I am currently reading Kyle Simpson's series You Don't Know JavaScript (YDKJS) and I am learning a lot about JavaScript. I have been writing his code examples and other JavaScript blog code examples in my plunker. I decided to code out his warning for using a safer this.


Kyle mentioned that null could mutate or reference the global object in a function that makes a 'this' reference in either your own code or in a third party library.

The empty object literal {} still has __proto__ since it inherited from 'Object'.

If you use a third party library or you have code that checks for properties on 'this' then you could have a difficult bug.

Object.create(null) truly is more empty than {}. It has no properties which makes it the safer 'this' option.