About TCP Server Port Numbers - Two Sockets Can Have the Same Port Number

All sockets connected to the client have the same port number as the server socket! Misconception What I am going to talk about today was quite shocking to me. I used to think that sockets are determined by port numbers. For example, if you have port number 80, there is only one socket for that port. So, when a TCP server establishes a connection with a client, a new client socket is created for each client. I thought that the port numbers of those client sockets would all be different. And theoretically, if resources are sufficient, since 4 bytes are allocated for the socket number, you can create up to 2^16 sockets. ...

May 30, 2021

Lambda Calculus - Boolean Operation

Source https://www.youtube.com/watch?v=3VQ382QG-y4 Lambda Calculus, Expressed as Boolean! In this post, let’s see how lambda calculus can be converted into boolean operations. The explanation is based on the referenced video, as the content on Wikipedia alone was not sufficient for understanding. Structure of the Post This post is written in two parts. In the first part, I will introduce functions by replacing the terms used in lambda calculus with bird names. This helps reduce preconceptions and confusion. ...

March 21, 2021

About Abstraction Structure

Overview I was pondering about architecture and realized that my understanding of abstraction was somewhat vague. I couldn’t picture it clearly in my mind. Then, one day, I had to answer why service interfaces exist in Spring’s controller-service-model structure. Why should we use service interfaces in Spring? Or, why shouldn’t we? Hmm… Of course, you can write interfaces to give polymorphism so that the controller doesn’t depend on a specific service, but usually, this leads to a giant service class, and abstraction becomes meaningless for services with too many responsibilities. That left me feeling uneasy. ...

March 7, 2021

Lambda Calculus - Formal Summary (Reduction)

Source https://en.wikipedia.org/wiki/Lambda_calculus Reduction The dictionary definition of reduction is as follows: the action or fact of making a specified thing smaller or less in amount, degree, or size. In other words, it is the act or fact of reducing the amount, dimension, or size of something. Meaning Wikipedia introduces reduction as follows: The meaning of lambda expression is defined by how expressions can be reduced So, the meaning of lambda calculus depends on how expressions are reduced. The referenced title is: ...

February 7, 2021

Lambda Calculus - Formal Summary

Reference https://en.wikipedia.org/wiki/Lambda_calculus#:~:text=Lambda%20calculus%20(also%20written%20as,to%20simulate%20any%20Turing%20machine Overview In the previous post, I explained lambda calculus informally. This time, let’s take a look at a more mathematical (formal) definition. If you want to deeply understand lambda calculus, you need to get used to the formal definition. Most resources are written formally… Formal definition Components of a lambda expression variables v1, v2… the abstraction symbols λ (lambda) and . (dot) parentheses () The set of lambda expressions (Λ) is defined inductively: If x is a variable, then x ∈ Λ. If x is a variable and M ∈ Λ, then (λx.M) ∈ Λ. If M, N ∈ Λ, then (M N) ∈ Λ. In summary: “If you apply lambda operations to lambda components, the result is still a lambda expression!” ...

January 24, 2021

Lambda Calculus - Informal Summary

Source https://en.wikipedia.org/wiki/Lambda_calculus Prerequisite Materials https://jurogrammer.tistory.com/131 Lambda Calculus Intro https://jurogrammer.tistory.com/132 Formal System Overview In this post, I will explain lambda calculus informally. Right, if you start with a formal explanation, it’s hard to understand and hard to grasp the context. So, we’ll look at formal definitions, arithmetic, booleans, and simulation next time. To explain lambda calculus again: It’s a formal system, a mathematical logic for expressing computation. What kind of computation? ...

January 10, 2021

Formal System

Overview In this post, I will talk about the Formal System. Haha; I said I would talk about lambda calculus in detail, but as I studied, I realized I couldn’t just gloss over this concept. After going through lambda calculus, I thought, “What did I just learn?” You define symbols, define rules, derive theorems… How is this related to lambda calculus? I was curious. Haha; to conclude, lambda calculus is a Formal System, so learning about lambda calculus is learning about its Formal System. ...

December 20, 2020

Functional Programming Prelude

Sources https://en.wikipedia.org/wiki/Functional_programming https://www.geeksforgeeks.org/introduction-of-programming-paradigms/ Prelude to Functional Programming Why I Want to Learn About Functional Programming In March of this year, when I first learned JavaScript, the language felt strange. Sometimes it felt like C, sometimes like Java, and sometimes it had syntax I had never seen before. There were three things in JavaScript’s syntax that surprised me: Map, Closure, and Functions. I used Map a lot in Python, so seeing it in JavaScript made me think, “Ah, this must be a commonly used function that people like, so it’s included here too.” ...

November 22, 2020

Observer Pattern

Observer Pattern References https://refactoring.guru/design-patterns/observer https://ko.wikipedia.org/wiki/%EC%98%B5%EC%84%9C%EB%B2%84_%ED%8C%A8%ED%84%B4 Intent Classification Behavioral design pattern A pattern about how objects communicate within a group. Definition (guru) A pattern that defines a subscription mechanism to notify multiple objects about events that happen to the object they are observing. (wiki) A design pattern in which observers, who are interested in changes to an object’s state, register themselves with the object, and the object notifies each observer directly via methods whenever its state changes. Problem Situation - Notifying Events There are two types of objects: Customer and Store. Customers are interested in the latest iPhone model that will soon be sold at the Store. Problem How can customers buy the product as soon as the latest iPhone is available in the store? Bad Approaches [Method 1] Customer visits every day Customers visit the store every day to check if the latest iPhone has been released. Drawbacks Customers may visit the store even if the product hasn’t been released, resulting in unnecessary effort. [Method 2] Store notifies all customers The store sends emails to all customers whenever a new product is released. This avoids unnecessary visits by customers. Drawbacks Customers who are not interested in the new product still receive notifications, which can be annoying. The store wastes resources. From a programming perspective, the problems can be summarized as: ...

October 18, 2020

State Pattern

State Pattern Three-line summary A behavioral design pattern A pattern that encapsulates the behavior of an object and delegates requests to the object A pattern that changes the behavior as the object’s state changes References https://refactoring.guru/design-patterns/state https://en.wikipedia.org/wiki/State_pattern Intent Classification Behavioral design pattern A pattern that encapsulates the behavior of an object and delegates requests to the object. Definition A design pattern that changes the behavior as the object’s state changes. Because of this, it may appear as if the object’s class has changed. Problem Situation - Finite State Machine The State Pattern is closely related to the concept of a finite state machine. ...

October 18, 2020