RSS feed [root] /design /weblog



title search:


Sun Oct 01 16:19:43 HKT 2017


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

Mon Dec 22 12:04:04 HKT 2014 From /weblog/design/distribute


Basically, cache as much as you can, limit the bandwidth as much as you can -[..]2009/08/skinny-straw-in-cloud-shake.html[..]ry/cassandra_compression_is_like_getting

Compression usually very useful -[..]observations-on-big-data-for-retail.html

Discussion of design of Aeron, a new messaging system -[..]eally-need-another-messaging-system.html

How BBG use Hadoop, and tune it -[..]2/17/the-big-problem-is-medium-data.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)

Mon Jul 07 18:32:35 HKT 2014 From /weblog/design/examples


ZeroMQ: The Design of Messaging Middleware -[..]&siteSectionName=architecture-and-design

When NOT to use a message queue -

(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)

Fri Dec 20 12:17:18 HKT 2013 From /weblog/design/distribute


Solution #1: Have More Resources than You'll Ever Need
Solution #2: Disable Features During High Loads
Solution #3: Auto Scaling
Solution #4: Use Message Queues[..]spikability-applications-ability-to.html[..]izing-and-capacity-planning-assumin.html

(google search) (amazon search)

Wed Dec 11 09:16:42 HKT 2013 From /weblog/design


Batch processing best practices -[..]013/10/30/scheduled-jobs-best-practices/

Batch can improve latency, if it reduce number of request -[..]ng-requests-actually-reduce-latency.html

(google search) (amazon search)

Wed Nov 06 12:37:46 HKT 2013 From /weblog/design



Discussion of page object -

Difference API document tools -

(google search) (amazon search)

Fri Nov 01 14:28:59 HKT 2013 From /weblog/design/examples


Key points

1) No stored procedures are used. There are some very simple triggers.
2) Move cpu-intensive work moved out of the database layer to applications applications layer: referential integrity, joins, sorting done in the application layer! Reasoning: app servers are cheap, databases are the bottleneck.
3) No client-side transactions. no distributed transactions
4) J2EE: use servlets, JDBC, connection pools (with rewrite). Not much else.
5) No state information in application tier. Transient state maintained in cookie or scratch database.

How ebay use Cassandra -[..]-practice-of-cassandra-data-model-design[..]ctices-cassandra-data-model-design-part2[..]dra-data-modeling-best-practices-part-1/[..]dra-data-modeling-best-practices-part-2/

(google search) (amazon search)

Tue Oct 29 17:54:03 HKT 2013 From /weblog/design/distribute


(google search) (amazon search)

Thu Oct 24 17:01:36 HKT 2013 From /weblog/design/examples


(google search) (amazon search)