Modern hardware force us to design softwares with multi-threaded and concurrent aware code.
But Gang of four design principal didn’t show me how to design scalable software by avoiding racing condition and thread locking because Gang of four design pattern encourage us to hide details and abstract operations but this make more problems on dealing with concurrent processing. In order to make a correct software, I had to introduce the locking code to avoid the race condition. This code degraded the performance of application by wasting time to finish the task in different thread or serializing the concurrent operations.
Fortunately, I have found a way to solve this problem after understanding the functional programming and concepts such as Monoid, Functor, Applicative Functor and Monads.
Functional programming don’t hide details so that I can reason about all logic in code very quickly. Above all, immutable data structure and Monoid make me maximize the utilization of multiple cores without worrying about race condition and locking. Now I can see how to design a highly scalable software in a correct way.