Though Programmer

Adapter, Decorator, Proxy, Information Expert, Composite, Bridge, Low Coupling, Flyweight, Protected Variations and Facade

Image for post
Image for post
Structural patterns of design classes and objects

Structural design patterns are concerned with how classes and objects can be composed, to form larger structures. They enable you to create systems without rewriting or customizing the code because these patterns provide the system with enhanced reusability and robust functionality.

Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice. —Christopher Alexander

There are following 10 types of structural design patterns.

  • Adapter…

Data Privacy

Dissolving the myth of easy-to-fake face recognition

Image for post
Image for post
Image by Author

Thanks to the quick advance in technology, especially in computer science and electronics. Nowadays, facial recognition is becoming the second most largely deployed biometric authentication method at the world level in terms of market quota right after fingerprints. Each day more and more manufacturers are including face recognition in their products, such as Apple with its Face-ID technology, the banks with the implementation of eKYC solutions for the onboarding process.

Contrary to the main aim of research in face recognition has been given to the improvement of the performance at the verification and identification tasks, the security vulnerabilities of face recognition systems have been much less studied in the past, and only over the recent few years, some attention has been given to detecting different types of attacks consists of detecting whether a biometric trait comes from a living person or it is a fake. …

Fingerprints, facial recognition, hand geometry, iris recognition, retinal identification, voice recognition, keystroke dynamics, and handwritten signature

Image for post
Image for post
Image by Author

Biometric has been for long the target of future authentication that expected that biometric authentication will largely displace other means of our current authentication and access control. Biometric systems can be used in two distinct modes as follows.

  • Verification (1–1): determining whether a person is who he claims to be. In the verification mode, the system validates the person’s identity by comparing the captured biometric data with the template stored in the database.
  • Identification (1-n): determining who the person is. …

Thought Programmer

How do we beat the CAP theorem?

Image for post
Image for post
the CAP theorem

There is one theorem in computer science called the CAP theorem states that it is impossible for a distributed data store to simultaneously provide more than two out of the following three guarantees.

  • Consistency: every read receives the most recent write or an error.
  • Availability: every request receives a (non-error) response, without the guarantee that it contains the most recent write.
  • Partition tolerance: the system continues to operate despite an arbitrary number of messages being dropped (or delayed) by the network between nodes.

A Brief of History

In 2011, Nathan Marz proposed an important approach to tackling the limitations of the CAP theorem in his blog¹, it called the Lambda architecture. …

Thought Programmer

Explaining common different architecture patterns

Image for post
Image for post
Photo by Alexander Andrews on Unsplash

An architectural pattern is a general, reusable solution to a commonly occurring problem in software architecture within a given context.

A pattern is a solution to a problem in a context.

Many programmers are nowadays still confused about the difference between architecture patterns or don’t even know much about it.

Let me explain to you…!

  • Layered Architecture
  • Pipe and Filter
  • Client Server
  • Model View Controller
  • Event Driven Architecture
  • Microservices Architecture

Layered Architecture

The most common architecture pattern is the layered architecture or known as the n-tier architecture. It is widely known by most software architects, designers, developers. Although, there are no specific restrictions in terms of the number and type of layers that must exist, most layered architecture consists of four tiers: presentation, business, persistence and database as follows. …

What is in the picture?

Image for post
Image for post
Photo by Karsten Winegeart on Unsplash

How to predict an image’s type?

There are the following six steps to determine what object does the image contains?

  • Load an image.
  • Resize it to a predefined size such as 224 x 224 pixels.
  • Scale the value of the pixels to the range [0, 255].
  • Select a pre-trained model.
  • Run the pre-trained model.
  • Display the results.
Image for post
Image for post
How to predict an image’s type

Implementing the solution with Keras


Install TensorFlow and Keras.

pip install tensorflow

Setup your environment

First of all, we set up the environment.

# TensorFlow and tf.kerasimport tensorflow as tf
from tensorflow.keras.applications.resnet50 import preprocess_input, decode_predictions
from tensorflow.keras.preprocessing import image
# Helper libraries
import numpy as np
import matplotlib.pyplot as pl

Load an image

Then, we load and try to display the image that we want to predict. …

Thought Programmer

What’s different between them?

Image for post
Image for post
Photo by Edwin Andrade on Unsplash

Nowadays we have many options when it comes to architecture design patterns. After developing many apps using Model-View- ViewModel (MVVM), Model-View-Presenter (MVP), and Model-View-Controller (MVC), I finally feel qualified to talk about the differences between them. For easier to understand, we can use a simple example like developing a screen to search books in the BookSearch App.

Let’s begin now…!

MV(X) essentials

First of all, we need to understand briefly MVC, MVP, and MVVM architecture before dive into them.

Why Model-View-(C or P or VM)?

The aim of these architectures is to separate the responsibilities of visualizing, processing, and data management for UI applications.

Image for post
Image for post
separate the responsibilities of visualizing, processing, and data management

Their goals are to increase. …

Thought Programmer

Loops may achieve a performance gain for your program but recursion may achieve a performance gain for your programmer

Image for post
Image for post
Photo by Jen Theodore on Unsplash

Recursion is a problem-solving technique, where the solution of a larger problem is defined in terms of smaller instances of itself. You can try to imagine an example in the real world when you’re digging through your home and come across a mysteriously locked suitcase, the key for the suitcase is probably in this other box. This box contains more boxes, with more boxes inside those boxes. The key is in a box somewhere.

How to search for the key?

There are two popular approaches for us to solve this problem.

The first approach

In this solution, we use a while-loop algorithm: “while the pile isn’t empty, grab a box, and look through it.” …

Deep JavaScript

Building, checking, testing and so on

Image for post
Image for post
Photo by Maxim Selyuk on Unsplash

Choosing a development tool based on its popularity isn’t a bad idea. Popular tools are usually more stable, and they often have more resources and community support than less popular tools. Today, I’ll introduce categories of tools and lots of names of specific tools.

Let’s start now…!

Build Tools

We build the JavaScript source codes we write to what we deploy using build tools.


A transpiler is a tool that compiles source code to source code. There are two transpilers that are popular in the community as follows.

  • Babel is a compiler that helps you write code in the latest version of JavaScript. When your supported environments don’t support certain features natively, Babel will help you compile those features down to a supported version. …

Use advanced techniques to find any webpage, emails, info, or secrets and so on

Image for post
Image for post
Photo by Andrew Neel on Unsplash

In recent years, all over the world people always publish their documents and information on the Internet. As a result, there is an existing large amount of information on the Web including both useful and unuseful. So how we found these things quickly?

Let’s follow my guides…!

Understanding about Google search operators

Google search operators are special characters and commands that extend the capabilities of regular text searches.

“phrase”            => results must include “phrase”
-phraseexclude => results with phrase
phrase1 AND phrase2 => phrase1 and phrase2 must both be included phrase1 OR phrase2 => one of phrase1 and phrase2 must be included => results must be on domain …


Trung Anh Dang

I write about things that I like and things that I don’t, mainly in the business, art and tech sphere. Sign up for my newsletter

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