Welcome to
Thuyen's corner
-
MVVM best practice: Inputs - Outputs
When it comes to iOS architecture, MVVM is one of the most favorable candidates. Not only does it provide higher testability than MVC but also this architecture is lightweight as compared to its counterparts such as VIPER. Despite that, proper approaches should be adopted to take advantage of MVVM. Otherwise, we could end up with an alike version of MVC with an additional component (ViewModel).
-
Định lý cuối cùng của Fermat
Khoảng 5-6 tháng trước mình xem một bộ phim tài liệu có tựa đề “BBC - Horizon - 1996 - Fermat’s Last Theorem”. Đây là một câu chuyện về lịch sử toán học mà mình thấy rất hay nên muốn chia sẻ lại. Fermat là một nhà toán học người Pháp. Ông có nhiều đóng góp quan trọng trong lý thuyết số (number theory). Một trong số đó là định lý Fermat lớn, hay định lý cuối cùng của Fermat (Fermat’s Last Theorem).
-
An example of Survey with privacy
A while ago, I read the book Probabilistic Programming and Bayesian Methods for Hackers written by Cam Davidson-Pilon and was really impressed by an example of carrying out surveys. Although it is not a standard method with wide scope of use, from the perspective of a software engineer who is not from statistics background, I think its idea is pretty beautiful and worth knowing
-
How to stub network in iOS
There are times we wish to fake a network event, for example, a network error. However, integrating a 3rd party stub library just for this purpose is not really worthy. This post aims at demonstrating how to stub network.
-
Quick thoughts on Tail recursion in Swift
I always thought that Tail call optimization (TCO), sometimes called tail recursion optimization, is supported in most languages by default. It turns out to be opposite.
-
Method Swizzling: What, Why and How
Method swizzling is a very powerful technique that takes advantage of dynamism. The core idea of this technique is to replace the real implementation of a method at runtime. With this power, we could be able to do a lot of cool stuffs. Actually, this special feature is offered by the Objective-C runtime, via message dispatch.
-
Method dispatch in Swift
Method dispatch is a term referring to mechanisms by which the program determines which operation should be executed (by operation, I mean a set of instructions). There are times we expect a method behavior to be determined only at runtime. This motivation give rise to different mechanisms of dispatching a method, each of which has its own pros and cons.
-
How a Swift file is compiled
First of all, this is not “how an iOS/MacOS app is built”. An app consists of a bunch of source code files, structured in modules/frameworks, each of which could be purely in swift/objective-c, or mixed and match…
-
What is Simpson's paradox?
If you’re from the world of statistics, you may have heard of it. Two doctors, Dr. Hibbert and Dr. Nick, both perform 2 types of surgeries: heart surgery and band-aid removal…
-
Brain exercising #1
I happened to see this problem on Twitter. It reminded me of my secondary school when I was passionate about solving math problems :)… I am thinking of a little corner of this blog for this sort of exercising. Claim: If $p$ is prime, all the coefficients in $(a+b)^p$ except the first and the last are divisible by $p$. If p is prime, all the coefficients in (a+b)^p except the first and last are divisible by p.