Let's Talk About Web Server

Apache, Tomcat, Jetty, Spring, SparkJava. When a beginner starts a backend application, frameworks take care everything, we don’t need to care about how it works just focus on the API programming which is good and bad. I want to talk about them from my understanding, my learning path.

Read More

Dynamic Programming

Backtracing

Fibonacci sequence, this is a classic math calculation.

1
2
3
F(1)=1
F(2)=1
F(n)=F(n-1) + F(n-2)

Read More

Network IO Models

My recent work involved a lot of network IO stuff, like raw TCP/Multicast using Netty and websocket/UDP using Boost.asio. So I went through the NIO models to get a better idea of how it works. I will use TCP server as an example (server need to handle multiple connections). There are lots of charts illustrate these 5 IO models, but I think it is better to understand why we need these models.

Read More

The Rule of Three

Once I saw a comment about C++, said that if you want to check whether the programmer is experienced or not, check if he properly handled or disabled copy constructor or assign operator if he has a destructor or delete resource. I never notice this before. The essential idea of this comment is the rule of three.

Read More

C++ Polymorphism

When I first time using C++ in my work, I was wondering why is the parent class desctructor need to be virtual. It is something related to polymorphism. About polymorphism, we know there are three principles:

Read More

TLS and Boost websocket

TLS Process

My current project is dealing with boost websocket and tls protocol. Currently, our company use boost websocket(ws) to build connection between client and server. Client will send frame registration/request to server and server will send result/frame back. When I took it over, the websocket library I our company does not implement tls verification for ws and I need to finish this feature.

Read More

Java Dynamic Proxy and AOP

AOP and IOC are the two important concepts in Spring developement. AOP is Aspect Oriented Programming. I will start with proxy design pattern.

When we play online game, we can pay for someone else to help us to play to get experience or money. This someone else is a proxy-like role. Or more likely, vendors do not want to sell clothes or shoes directly with customers, they will ask a proxy, more like a store, to communicate with customers. Do something like, deal with invoice or a return. Proxy is like a middle man stuff. There are two good points for proxy pattern.

Read More

Java Annotation

Recently, I am learning Spring framework. Spring framework is based on annotation-driven development. I used to use annotation not often, just like override. For better understanding spring framework, I think I need to understand annotation development first.

Read More

HashTable And SPH

Data Structure of Hash Table

HashTable is used for storing key-value pairs. In Java, when not considering synchronized(thread safety) , we usually use HashMap like

1
2
HashMap<Integer,String> hm=new HashMap<Integer,String>();
hm.put(100,"LIU");

Read More

Dependence Inversion Principle (DIP, DI, IoC)

For the software design, there are five principles called S.O.L.I.D, which stands for

  1. Single Responsibility Principle
  2. Open-closed Principle

Read More