Tag: code

Home / code
Callbacks & Promises in Javascript
Post

Callbacks & Promises in Javascript

Javascript is a single threaded asynchronous language. What does that mean? It means it cannot multi-task, but can pause execution of one task to do something else and switch back and forth between tasks so as to maximise performance. It makes sense because javascript is a browser language, and browsers need to make network calls...

Python Pro Tip: Start using Python defaultdict and Counter in place of dictionary
Post

Python Pro Tip: Start using Python defaultdict and Counter in place of dictionary

How you could use defaultdict and Counter to make your code short and readable Learning a language is easy. Whenever I start with a new language, I focus on a few things in below order, and it is a breeze to get started with writing code in any language. Operators and Data Types: +,-,int,float,str Conditional statements: if,else,case,switch...

Building Code
Post

Building Code

How were programming languages built? Here’s a brief history. We, humans, have always been on the lookout for somebody to do our heavy and unwanted lifting. First it was simple machines, then steam powered beasts, and at the end a bunch of semiconductors and a quartz. But how do you get a simple stone to do...

Going beyond just a programming language
Post

Going beyond just a programming language

In computer science, it seems that everybody is focusing on the programming language that the teacher or department chooses – be it Java, C#, Ruby or Python. Deciding upon a programming language to teach is only one step, however. The next question is – how do we gain confidence within ourselves to learn this language, in...

5 ways static code analysis can save you
Post

5 ways static code analysis can save you

If you’re not doing static code analysis (aka static analysis), now is the time to start. Delivering code faster has dubious value if the quality degrades as development cycles shrink. On the other hand, if you’re not doing static code analysis, you’re not alone. Despite the mature age of the tool category, not a lot...

My Visual Studio Code Setup
Post

My Visual Studio Code Setup

I love the text editor setup I’ve been using for the past year and a half, so I want to show off my setup! Visual Studio Code has far surpassed my experiences with Atom, Spyder, Sublime Text, Emacs, and Idle (the built-in Python editor) which I used for the years before it. I thought I would do...

Looping through objects in JavaScript
Post

Looping through objects in JavaScript

Once in a while, you may need to loop through Objects in JavaScript. The only way to do so before ES6 is with a for...in loop. The problem with a for...in loop is that it iterates through properties in the Prototype chain. When you loop through an object with the for...inloop, you need to check if the property belongs to...

Another engineer asked me for feedback…
Post

Another engineer asked me for feedback…

Another engineer asked me for feedback on their performance. I wrote a few things down and then re-read it and realized this could apply to almost anyone. What follows is the advice I gave them. Names and technologies have been changed for their own protection… What am I doing wrong? I tend to think positively, which...

How To Review Code You Don’t Understand
Post

How To Review Code You Don’t Understand

I recently read an article by Max Bittker called “How to Review Code You Don’t Understand”, and it got me to thinking about times when I’ve been tasked with doing just that. One of the troubles I have with code review is understanding the context around a change. Given a diff, I can work through it...

React v16.4.0: Pointer Events
Post

React v16.4.0: Pointer Events

The latest minor release adds support for an oft-requested feature: pointer events! It also includes a bugfix for getDerivedStateFromProps. Check out the full changelog below. Pointer Events The following event types are now available in React DOM: onPointerDown onPointerMove onPointerUp onPointerCancel onGotPointerCapture onLostPointerCapture onPointerEnter onPointerLeave onPointerOver onPointerOut Please note that these events will only work in browsers that...

The syntactical Sugar Classes of JavaScript
Post

The syntactical Sugar Classes of JavaScript

In my previous article; Getters And Setters used in JavaScript Objects….How? Ogwuru Johnson #javascript#tutorial#programming we looked at Getters and Setters as they apply to objects in JavaScript and i recall promising to show us how we could use getters in Es6 classes, We would also learn a great deal about classes. First of; i wouldn’t...

Good Practices – Code Review Comments
Post

Good Practices – Code Review Comments

If you do code review, you likely come across the same issues over and over again. People who are contributing to your code base for the first time may not know your team’s internal standards, they may come from a different language and do things slightly differently. A new hire may need to get up...

What the… error handling! (try…catch)
Post

What the… error handling! (try…catch)

Please check your code! Bugs exist… and they always will. No matter how good we are at code, or how focused is our mind while coding… there will be bugs like Coding bugs or Input bugs or whatever. we have a duty … to do our best to control them A very basic way to control our code, is something really smart and easy. Is there an error?...

Functional Programming with JavaScript ES6
Post

Functional Programming with JavaScript ES6

Functional programming is a style that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data. Original post @ http://www.ajinkyaxjs.com/2018/05/02/functional-programming-es6-cheatsheet.html Arrow Functions (Fat Arrows) Arrow functions create a concise expression that encapsulates a small piece of functionality. Additionally, arrows retain the scope of the caller inside the function eliminating the need of...