RSS feed [root] /design /weblog



title search:


Thu May 23 22:45:24 HKT 2019


(google search) (amazon search)
download zip of files only

Wed Dec 09 11:20:40 HKT 2015 From /weblog/design


(google search) (amazon search)

Thu Dec 03 10:33:50 HKT 2015 From /weblog/design/interview


(google search) (amazon search)

Fri Nov 13 00:07:00 HKT 2015 From /weblog/design


It won't happened at java, but for non-GC language like C++, crash at constructor will cause memory leak:[..]oders-have-it-easy-crashing-constructors

Discussion of if there are way to recover OOME -[..]-a-Non-Recoverable-Error-.html&Itemid=29[..]ghly-available-inmemory-shard-index.html

Discussion about using memory as store -

When using direct memory can be faster, when you have a large amounts of data and/or you have to perform some IO with that data. Tick data is a good example -[..]n-using-direct-memory-can-be-faster.html

(google search) (amazon search)

Wed Sep 30 15:29:04 HKT 2015 From /weblog/design/pattern


Collection of patterns from objectmentor -[..]07/agile-scm-principles-from-ood-to.html

Robert Martin tutorial -

Links and abstract of few principle -

Tutorial about common anti-pattern -

Development of Further Patterns of Enterprise Application Architecture -

Expanation and C++/Java samples -

Java tutorial -

(google search) (amazon search)

Thu Sep 10 14:18:31 HKT 2015 From /weblog/design/interview

Martin Odersky

One of the challenges we were facing is we wanted to be both functional and object-oriented. We had very early on the notion that immutable objects would become very, very important. Nowadays everybody talks about immutable objects, because people think they are a key part of the solution to the concurrency problems caused by multi-core computers. Everybody says, no matter what you do, you need to try to have as much of your code using immutable objects as possible. In Scala, we did that very early on. Five or six years ago, we started to think very hard about immutable objects. It actually turns out that a lot of the object-oriented field up to then identified objects with mutability. For them, mutable state and objects were one and the same: mutable state was an essential ingredient of objects. We had to, in essence, ween objects off of that notion, and there were some things we had to do to make that happen.

(google search) (amazon search)

Sat Aug 15 23:06:06 HKT 2015 From /weblog/design


Introduction to AI of game -

How to create angry bird -[..]11/06/07/how-to-make-angry-birds-part-2/

How to program breast in game -[..]15/07/30/how-video-game-breasts-are-made[..]eveloper-nintendo-president-satoru-iwata

(google search) (amazon search)

Wed May 27 10:17:34 HKT 2015 From /weblog/design


When XP says "go for the simplest possible design", what does that mean?
1. Simplest possible design to IMPLEMENT?
1. Simplest possible design to UNDERSTAND LATER?

An thread discuss how far should we go. Seen most people agree what should be done is "Simplest possible design to TEST and IMPLEMENT"

It apply on feature, not on quality -

(google search) (amazon search)

Wed Dec 31 19:11:17 HKT 2014 From /weblog/design/concurrency


Case study of a parallel slowdown, and the analysis of how to find it out -[..]2/avoiding-parallel-slowdown-in-jetty-9/

Discuss about the racing condition when multiple accessing java.util.HashMap -[..]au/2009/06/beautiful-race-condition.html

(google search) (amazon search)

Thu Dec 11 18:21:23 HKT 2014 From /weblog/design/pattern


Sometime it is better to notify user about failing to validate input than throw -[..]ticles/replaceThrowWithNotification.html

(google search) (amazon search)

Thu Sep 25 17:42:08 HKT 2014 From /weblog/design


Look like Java standard library already handle the 400 years leap day. However, there are still a lot to take care. -

P.S.: an article about java timezone handling -

Basic about computer time -[..]ry-developer-should-know-about-time.html

Difference of time function provided by IPP -[..]g-function-for-measuring-ipp-api-timing/

Detail explanation of nano second and millisecond in java at windows platform -[..]olmes/entry/inside_the_hotspot_vm_clocks

How to model thing that change with time -

Timezone handling issues of most application -

(google search) (amazon search)

Thu Sep 18 14:47:54 HKT 2014 From /weblog/design

write shy code

Writing shy code is just a small start at preventing the introduction of bugs, but it really helps. Just as in the real world, good fences make good neighbor - as long as you don't peek through them.

Other than that, there is also security risk if you show too much to other -[..]_or_objects_java_security_problem_1.html

An example of why passing Map around is wrong and show solution of that example -[..]

Quoting from Getting Method in Beck’s 1997 Smalltalk Best Practice Patterns (emphasis his): “Here’s the real secret of writing good Getting Methods - make them private at first. I cannot stress this enough. … There are cases where you will publish the existence of Getting Methods for use in the outside world. You should make a conscious decision to do this after considering all the alternatives. It is preferable to give an object more responsibility, rather than have it act like a data structure.”
Quoting from Setting Method: “Everything I said once about Getting Methods, I’d like to say twice about Setting Methods. Setting Methods should be even more private. It is one thing for another object to tear out your state, it is quite another for it to bash in a new state.”[..]om/group/domaindrivendesign/message/5701

East: Clean and DRY, an example of why tell don't ask help -

But personally, I don't use tell-dont-ask. I do look to co-locate data and behavior, which often leads to similar results. -

Another discussion about getter and setter -[..]/09/16/getters-and-setters-are-evil.html

(google search) (amazon search)

Tue Aug 12 15:13:25 HKT 2014 From /weblog/design

prevent code debt

A nice article and nice term about prevent coding problem at first[..]bjectId=9860&tth=DYN&tt=siteemail&iDyn=2

In contrast, someone like to manage it -[..]ardMeeting/Voluntary-Technical-Debt.html[..]archive/2007/11/01/technical-debt-2.aspx

Martin fowler's comment -

A blog about duplication is BAD -[..]/articles/2007/04/16/code-is-a-liability

Don't use feature-toggles -[..]ture-toggles-are-one-of-worst-kinds.html

(google search) (amazon search)

Thu Jun 05 17:50:25 HKT 2014 From /weblog/design/concurrency


Fast synchronization between a single producer and single consumer -[..]eenASingleProducerAndSingleConsumer.aspx

Lock free queue idea. -[..]read/thread/82066179448783da?hl=en&pli=1

Use of Disruptor -

Use of Queue -[..]ble-presents-queue-er-message-queue.html

Discuss about the "Railway approach" of producer consumer queue -[..]ormance-Java-Inter-Thread-Communications[..]alternative-multi-producer-approach.html

Probably worth to consider replacing queue by actor -[..]implifying-trading-system-with-akka.html

(google search) (amazon search)

Wed May 21 17:43:40 HKT 2014 From /weblog/design/examples


Discussion of some decision made for improvement of Java Interface at Java8 -[..]java-8-friday-language-design-is-subtle/

(google search) (amazon search)

Mon May 19 15:37:30 HKT 2014 From /weblog/design/examples


Show how TDD can help OpenSSL to prevent heartbleed if they do it at the first place -

(google search) (amazon search)

Fri Apr 25 10:38:41 HKT 2014 From /weblog/design/pattern


Using generic to prevent downcast for Strategy Pattern, every time we try to cast something, may be worth to consider generic first? -[..]te-and-strategy-design-pattern-java.html

(google search) (amazon search)

Mon Apr 14 11:43:47 HKT 2014 From /weblog/design/distribute


MapReduce patterns

Basic MapReduce Patterns
Counting and Summing
Filtering (“Grepping”), Parsing, and Validation
Distributed Task Execution
Not-So-Basic MapReduce Patterns
Iterative Message Passing (Graph Processing)
Distinct Values (Unique Items Counting)
Relational MapReduce Patterns
GroupBy and Aggregation


Showing that map reduce can support real time transaction processing -[..]09/12/relevance-meets-real-time-web.html

Using map-reduce in cloud -

Papers of using mapreduce -[..]thms-in-academic-papers-may-2010-update/

mapreduce experiment -

Pattern and anti-pattern -[..]/2010/08/apache_hadoop_best_practices_a/[..]bout-the-performance-of-map-reduce-jobs/

(google search) (amazon search)

Fri Apr 11 16:26:11 HKT 2014 From /weblog/design/distribute


1. Use Cloud for Scaling
2. Use Cloud for Multi-tenancy
3. Use Cloud for Batch processing
4. Use Cloud for Storage
5. Use Cloud for Communication

Database in cloud -[..]int?articleId=218900502&siteSectionName=

An overview of the Hadoop/MapReduce/HBase framework and its current applications in bioinformatics -

The architecture that survived when amazon outage -

Introduction of few tools for cloud development -[..]/01/best-development-tools-in-the-cloud/[..]/07/developing-and-testing-in-cloud.html

Google Finds: Centralized Control, Distributed Data Architectures Work Better than Fully Decentralized Architectures -[..]control-distributed-data-architectu.html

(google search) (amazon search)

Wed Mar 19 10:56:41 HKT 2014 From /weblog/design


Really? I would rather say every line of code need to maintain -[..]s-copy-and-paste-programming-really.html

Data, Type, Algorithm -[..]012/05/types-of-duplication-in-code.html

Using closure to prevent code duplication -[..]

"Duplicated code is the root of all evil in software design. When a system is littered with many snippets of identical, or nearly identical code, it is indicative of sloppiness, carelessness, and sheer unprofessionalism. It is the guilt-edged responsibility of all software developers to root out and eliminate duplication whenever they find it." -

(google search) (amazon search)

Thu Mar 13 16:22:34 HKT 2014 From /weblog/design


Discussion of style of writing code, like always have valuable for return value, and use return for parameter check -

We should really delete the code if we need to...

And more about programming style -[..]for-keeping-your-programming-code-clean/

About using Of() as factory name -[..]-subtle-best-practices-when-coding-java/[..]uk/2014/03/10/are-comments-always-wrong/

(google search) (amazon search)

Wed Mar 12 13:37:40 HKT 2014 From /weblog/design/pattern

builder[..]-reasons-why-i-like-the-builder-pattern/ <- and it is not Silver Bullet

(google search) (amazon search)

Wed Mar 05 16:42:02 HKT 2014 From /weblog/design/distribute


(google search) (amazon search)

Thu Jan 09 10:40:28 HKT 2014 From /weblog/design/interview

Maurice Herlihy[..]012/05/interview-of-maurice-herlihy.html

(google search) (amazon search)

Mon Dec 23 18:06:30 HKT 2013 From /weblog/design/distribute


Sample chater of REST book , which contain a nice discussion of why Idempotence is important -[..]dson-ruby-restful-ws/en/resources/04.pdf

New Acid:
* A – Associative
* C – Commutative
* I – Idempotent
* D - Distributed

Idempotency patterns -[..]

Detailed discussion about how to design Idempotence -

Discuss about clock in distributed environment -[..]e-bad-or-welcome-to-distributed-systems/

(google search) (amazon search)