Server logging is so important to detect application problems and there are many solutions already out there that help you out to capture, analyze and some also go beyond even offers you to tell the exact commit and who could be the best candidate (git blame, is that you?) who can work and fix it (Sentry-coff-coff). That’s pretty cool, handy or you put the nice adjective.

Photo by Markus Spiske on Unsplash

However, we all have been in that situation where the company we works for doesn’t want to pay for such solutions because of or whatever reason is. I sort of was that guy who…


There is one thing in Javascript (or any functional programming language) I consider any OOP envy how easy is to implement, Javascript can be criticized, they can laugh at being the only language with a monster book describing the whole language but with a tiny one only telling you the “good parts”. but real easy composition they will never have it.

The simplicity of it is kind of pure art. we can take one object and convert it into whatever we want him to do by adding behaviors we want even at runtime with just a few lines; that is…


Nowadays is very common to find you in the state of building authentication and authorization in your application, digging on the web for authorization libraries and techniques is easy always to find solutions that only offer role-base authorization that prevents only to access a page, however almost often occurs that you need something else, entity-state authorization.

For the TL;DR here is the demo and the code used in the demo.

Picture credits

What the heck is entity-state authorization?

Well, I guess there was nothing better in my head to name it while writing this post. However more or less what I am trying to say is related to…


Photo by Irvan Smith on Unsplash

How many times you are in the following position where you have a function that depends on outer dependencies or global objects (like window, fetch, document…)

function doSomething(oneParam, callback) {
oneDependency.doSomethingElse();
fetch('resource/from/somewhere').then(callback)
}

Now, when you are trying to test this piece of code, how do you control the binding of the two dependencies ononeDepenency andfetch ? The answer is dependency injection + factoryMethod Here is how:

The factory

import  { oneDependency } from  './somewhere/somefile';const doSomething = (oneParam, callback) => {
const generatedValue = oneDependency.doSomethingElse(oneParam);
// Let your mind to fly
return fetch('api/' + generatedValue).then(callback);
}
export const doSomethingFactory = (oneDependency…


Photo by Irvan Smith on Unsplash

How many times you are in the following position where you have a function that depends on outer dependencies or global objects (like window, fetch, document…)

function doSomething(oneParam, callback) {
oneDependency.doSomethingElse();
fetch('resource/from/somewhere').then(callback)
}

Now, when you are trying to test this piece of code, how do you control the binding of the two dependencies ononeDepenency andfetch ? The answer is dependency injection + factoryMethod Here is how:

import { oneDependency } from './somewhere/somefile';const doSomething = (oneParam, callback) => {
const generatedValue = oneDependency.doSomethingElse(oneParam);
// Let your mind to fly
return fetch('api/' + generatedValue).then(callback);
}
export const doSomethingFactory = (oneDependency…


Nowadays is very common to find you in the state of building authentication and authorization in your application, digging on the web for authorization libraries and techniques is easy always to find solutions that only offer role-base authorization that prevents only to access a page, however almost often occurs that you need something else, entity-state authorization.

For the TL;DR here is the demo and the code used in the demo.

Picture credits

What the heck is entity-state authorization?

Well, I guess there was nothing better in my head to name it while writing this post. However more or less what I am trying to say is related to…

Elias Martinez

Full-stack software engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store