Message from JavaScript discussions

February 2018

— I sometimes take this to an extreme and literally pretend I am reading some prepared speech, except it's my code I just wrote. At times I will get to a certain line and get long winded, run out of breath, and realize I crammed too much on one line

Message permanent page

— 

That or I will get to a certain function, and while reading it back find my speech is bouncing all over the place, and then I know I have involved too many concerns in that function

— Obviously we can make these determinations without doing all that... but it definitely helps make the code more smooth to understand and maintain sometimes

Message permanent page

— My CTO talks to his code all the time, sometimes loud and I have to wonder if he's talking to me or the code

Message permanent page

— Hahaha, oh gosh what does he say?

— I have to know

— Sometimes he reads it out, or explains calmly what it should do, and sometimes he just asks "why are you even working?"

Message permanent page

— That last one, too funny haha

— There is one style practice that helps me, and also meshes well with the whole speech thing... in a hoisted lang like JS you can do function declaration out of order of dependency, but if you always position them so that nothing above that line is dependent on it, your code structure becomes intuitive and you are always reading downwards. Never scrolling back up

Message permanent page

— 

function ayy() {
lmao();
}
function lmao() {
console.log("ayy lmao");
}

💀

— 

function lmao() {
console.log("ayy lmao");
}
function ayy() {
lmao();
}

👌

— Uhm I do it the other way. We declare requires at the top of the page and our code below so, I write in increasing order of abstraction. Reading should be bottom up

Message permanent page