Adapter design translates one interface to another

In this post, we are going to learn the adapter design pattern and the usage of this design pattern.

Adapter design pattern
Adapter design pattern
Adapter Design Pattern

The adapter design pattern is a structural design pattern.

Structural design patterns are concerned with how classes and objects can be composed, to form larger structures.

Based on GoF The Adapter pattern is used to translate the interface of one class into another interface. This means that we can make classes work together that couldn’t otherwise because of incompatible interfaces.
In simple words when we have few classes(or functions in Javascript) and those classes are incompatible but should be used to meet…

HTTP Parameter Pollution or HPP in short is a vulnerability that occurs due to passing of multiple parameters having the same name.

Parameter Pollution

HTTP Parameter Pollution or HPP in short is a vulnerability that occurs due to passing of multiple parameters having same name. There is no RFC standard on what should be done when passed multiple parameters.(Wikipedia)

There are various ways of passing parameters in order to cause a problem and we can see the list of some possible ways in this table:

In this post, we are going to learn the observer pattern and the usage of this design pattern.

Observer Design Pattern
Observer Design Pattern
Observer Design Pattern

According to the GoF definition, observer pattern defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. It is also referred to as the publish-subscribe pattern.

In simple words when you want to be aware of changes in another object probably you can use Observer Design Pattern.

The observer design pattern is a behavioral pattern and it means it is a pattern of communication between objects.

Other names of this design…

This is a summary of a few articles that you can find in the reference part.

0. Build and Test — Before Code Review

Use CI tools to check If tests are passing and the app can be built before starting the review process.

1. Use A Code Review Tool

Using these tools can save a lot of time. These tools can highlight changes and also you are able to interact with the developer or reviewer using these tools.

  1. Review Board
  2. Crucible
  3. GitHub
  4. Phabricator
  5. Collaborator
  6. CodeScene
  7. Visual Expert
  8. Gerrit
  9. Rhodecode
  10. Veracode
  11. Reviewable
  12. Peer Review for Trac

2. Set Early Expectations

The developer should annotate their source code before the review process. By having the authors carefully read through…

Authenticate Users with LinkedIn — NodeJS — Express
Authenticate Users with LinkedIn — NodeJS — Express
Step by step Guide to Authenticate Users with LinkedIn in your Express App

A few days ago I wanted to test the authentication using LinkedIn and there was no straight forward article to help me. So I decided to note down the steps in this article and I hope it would be helpful.

LinkedIn can be one of the Identity Providers of your application. We have seen this in lots of websites that let us login with our Google Account, Facebook account, or Github and LinkedIn. We want to do the same and let the user sign in with his/her LinkedIn account.

  • Create a LinkedIn app
  • Create an application that can authenticate users…

Load test using k6

What is load testing?

A load test is a type of software testing which is conducted to understand the behavior of the application under a specific expected load. Load testing is performed to determine a system’s behavior under both normal and at peak conditions(reference).

If you are not familiar with this type of test you should know that we always want to know the capability of our software and the number of online users that we can handle. …

Decorators in Typescript
Decorators in Typescript

It is a structural design pattern that lets you attach new behaviors to objects by placing these objects inside special wrapper objects that contain the behaviors (reference).

When we are using Typescript Method Decorators, they are higher-order functions that help us change method behavior or do something with the arguments.

Typescript method decorator definition: method decorator can be used to observe, modify, or replace a method definition (reference)

Now, let’s see how we can define a simple method decorator.

In order to run the Typescript code, we need to compile them using the Typescript compiler.

We need a tsconfig.json

First time using Deno

A secure runtime for JavaScript and TypeScript.
Based on their website:
Deno is a simple, modern, and secure runtime for JavaScript and TypeScript that uses V8 and is built in Rust.

  1. Secure by default. No file, network, or environment access, unless explicitly enabled.
  2. Supports TypeScript out of the box.
  3. Ships only a single executable file.
  4. Has built-in utilities like a dependency inspector (deno info) and a code formatter (deno fmt).
  5. Has a set of reviewed (audited) standard modules that are guaranteed to work with Deno:

These were from Deno's official document.

Deno is created by Ryan Dahl and he…

Testing NodeJS Express App
Testing NodeJS Express App
NodeJS Express Integration Test

“ Integration tests determine if independently developed units of software work correctly when they are connected to each other. The term has become blurred even by the diffuse standards of the software industry, so I’ve been wary of using it in my writing. In particular, many people assume integration tests are necessarily broad in scope, while they can be more effectively done with a narrower scope. “ Martin Fowler.

So as to see how we can test an Express app we need to create a simple Express application. I used MongoDB and its native driver(We usually use Mongoose as an…

and one practical real-world example

JavaScript Closures in Plain Language
JavaScript Closures in Plain Language

It is a JavaScript feature that allows a function to access its outer function scope. Sounds complicated?

We can use this feature when we have nested functions like this:

Poorshad Shaddel

Full Stack Developer at Telewebion.

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