What’s a generator? How it can be helpful? Are there concrete and practical use cases for generators?

computer code on a widescreen desktop monitor
computer code on a widescreen desktop monitor
Photo by Caspar Camille Rubin on Unsplash

Types of Functions in JavaScript

Let’s look at this function:

Once invoked, this function will run until the last line: an unstoppable or run-to-completion function. Execution context will be released after completion.

Run-to-completion functions are about the present: We need the result right away.

What if operation1's execution takes a long time? Since JavaScript is a single thread, all further processing will be blocked until operation1 finishes its computation.

Can we do better? Yes, let’s look.

Consider the below function:

Let’s understand what happened:

  • async/await returns a Promise.
  • doOperations is an asynchronous function.
  • We don’t wait for its results for now but for…

What is a closure, why is it an important concept, and how is it helpful?

A curry
A curry
Photo by Caroline Attwood on Unsplash

A Quick Reminder About JavaScript Scopes

Scope gives the ability to limit access to a variable or function and prevent meddles. What does that mean?

Take a look at the example below:

JS Function Scope

The visibility of two , count and run2 is limited to function border. They are accessible inside the function scope, but inaccessible outside:

Know when software complexity arises and how to handle it

ruins of a stone building overlooking a bay
ruins of a stone building overlooking a bay
Photo by Flo P on Unsplash

Why Is Code Complexity an Important and Serious Topic?

“The central enemy of reliability is complexity. Complex systems tend to not be entirely understood by anyone. If no one can understand more than a fraction of a complex system, then no one can predict all the ways that system could be compromised by an attacker.” — Practical Internet Security by John R. Vacca

If it’s complex, it’s incomprehensible. If it’s incomprehensible, it’s unexplainable. If we can’t understand and explain the code, we can’t extend or change it. …

A visual introduction to functional programming

Building photographed from a sideways angle
Building photographed from a sideways angle
Photo by Jackson Jost on Unsplash.

What’s Functional Programming?

Functional programming is a pipeline of pure functions.

What does that mean?

To understand this definition, we will use a real-life example. Let’s assume that we have a shipping warehouse and a large store containing a variety of products (books, clothes, certain canned food products, household appliances, etc.).

How do things work inside our warehouse?

What is modularity, and what metrics are available to measure modularity?

Diagram showing dependence on outside or external coupling.
Diagram showing dependence on outside or external coupling.
Dependence on outside or external coupling. Image by the author.


In this article, I’ll talk about modularity: What is modularity? Why is it important? And how can we measure modularity?

Modularity consists of dividing a system into separate and independent parts called groups or modules.

Design and code for the future


Developers diaries. Image by the author.

What we will do ?

We will try to make an Online Bookstore.

  • get all books
  • get a book details
  • get all categories
  • get all authors
  • get books by category
  • get books by author
  • search a book by its name or author
  • add a review : comment and rating
  • update a review : comment and rating
  • user can order one or many books
  • a book can have only one author
  • a book can be associated only one category
  • a book can have zero to many reviews
  • an order can contains the same book only once time but with quantity from one to max
  • user can…

In this story, we will see together the different aspects of Elixir Pattern Matching: tuples, list, map and multiclause function.

Image taken from : http://ravindranaik.com/pattern-matching-in-c-8/


Let’s assume that we have a function that return the gps coordinates (latitude, longitude) for a given country : get_gps_coordinates.

defmodule ElixirPatternMatching.Examples do
def get_gps_coordinates(country) do
France: {46.71109, 1.7191036},
Spain: {40.2085, -3.713},
Italy: {41.29246, 12.5736108}

This function return a Tuple : { latitude, longitude }.

Let’s call this function to get the gps coordinates for ‘France’ :

defmodule ElixirPatternMatching do
import ElixirPatternMatching.Examples,
only: [get_gps_coordinates: 1]

{latitude, longitude} = get_gps_coordinates(:France)

IO.inspect("latitude : #{latitude}")
IO.inspect("longitude : #{longitude}")

WASM (WebAssembly) or not in frontend projects ?

What I want to do ?

I’m trying to find approach to enhance the performance of my frontend projects.

My frontend projects are mostly websites for many and different purposes.

I have always complex logic to do like filtering and transforming big backend response in frontend side. Sometimes I must use the generic Rest response and I can’t use graphql nor adding a BFF.

I add these complexities :

  • complex UI/UX rules.
  • supporting multiple browsers.
  • 3G, 4G, …
  • responsiveness and good user experience.

How can my frontend handle these complexities and keep running !

Some technics that I…

What we will do ?

In this story, we will see together how to make a Rust Rest API using :

  • actix as http server.
  • mongo db driver to dialog with mongo database.
  • postman to test our endpoints.
Technical staff

Project configuration

cargo new rust-rest-api
cd rust-rest-api
cargo init

Héla Ben Khalfallah

I love coding whatever the language and trying new programming tendencies. I have a special love to JS (ES6+), functional programming, clean code & tech-books.

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