RSS feed [root] /weblog /design



title search:


Thu Apr 06 06:32:51 GMT 2023


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

Wed Dec 07 10:48:22 GMT 2016 From /weblog/design

work with legacy

Simple ways to improve legacy code -

One approach to work with legacy code, instead of phrase by phrase or part by part, identify and improve the domain part first -[..]-efforts-to-replace-legacy-systems-fail/[..]egacy-applications-tests-modularization/

Note of common point for refactoring with legacy application -[..]/2016/10/unintentionally-obfuscated.html

(google search) (amazon search)

Mon Nov 28 16:12:57 GMT 2016 From /weblog/design/interview


"They build their own infrastructure for performance, reliability, and cost control reasons. By building it themselves they never have to say Amazon went down because it was company X's fault. Their software may not be more reliable than others, but they can fix, debug, and deployment much quicker than when working with a 3rd party."

Shel Kaphan -

(google search) (amazon search)

Tue Nov 15 02:53:50 GMT 2016 From /weblog/design

value object

Discussion of DTO -

Discussion of value object -

(google search) (amazon search)

Wed Nov 02 08:14:20 GMT 2016 From /weblog/design/pattern


understanding-retry-pattern-with-exponential-back-off-and-circuit-breaker-pattern -[..]al-back-off-and-circuit-breaker-pattern/

(google search) (amazon search)

Wed Nov 02 08:13:31 GMT 2016 From /weblog/design


10-ways-to-reduce-lock-contention-in-threaded-programs -[..]ce-lock-contention-in-threaded-programs/

Discussion about lock the form and prevent 2 user edit it in the same time and currupt the object, what is the possible drawback. -[..]-optimistic-locking-isnt-a-silver-bullet

futexes -[..]ds/browse_thread/thread/3c3608a779dc6731

Spinning -[..]ome/lock-free-algorithms/tricks/spinning

Locks for rarely changed data, sound like good suggestion -[..]pic/comp.programming.threads/dyrbRKsj4gw

Try to use non-blocking approach if possible -[..]1/locks-condition-variables-latency.html

Concurrency without lock, and even without correctness? -

Single write principle -[..].au/2011/09/single-writer-principle.html

Comparing difference kind of locks again -[..]11/stampedlocktryoptimisticread-and.html

10-ways-to-reduce-lock-contention-in-threaded-programs -[..]ce-lock-contention-in-threaded-programs/

(google search) (amazon search)

Sat Oct 15 17:52:15 GMT 2016 From /weblog/design/interview


How yahoo use Hadoop for machine learning -

(google search) (amazon search)

Mon Sep 12 16:10:46 GMT 2016 From /weblog/design


*Do not use locks in the main transaction flow because they cause context switches, and therefore latency and unpredictable jitter.
*Never have more threads that need to run than you have cores available.
*Set affinity of threads to cores, or at least sockets, to avoid cache pollution by avoiding migration. This is particularly important when on a server class machine having multiple sockets because of the NUMA effect.
*Ensure uncontested access to any resource respecting the Single Writer Principle so that the likes of biased locking can be your friend.
*Keep call stacks reasonably small. Still more work to do here. If you are crazy enough to use Spring, then check out your call stacks to see what I mean! The garbage collector has to walk them finding reachable objects.
*Do not use finalizers.
*Keep garbage generation to modest levels. This applies to most JVMs but is likely not an issue for Zing.
*Ensure no disk IO on the main flow.
*Do a proper warm-up before beginning to measure.
*Do all the appropriate OS tunings for low-latency systems that are way beyond this blog. For example turn off C-States power management in the BIOS and watch out for RHEL 6 as it turns it back on without telling you!
*Macro-benchmarking is much more valuable than micro-benchmarking.
*Amazing results are achieved by truly agile companies, staffed by talented individuals, who are empowered to make things happen. Make sh*t happen is more important than following a process.[..]ughput-by-32x-and-reduce-latency-by.html[..]rything-you-know-about-latency-is-wrong/

How to monitor -[..]siness-value-from-performance-monitoring

How to measure latency -[..]/07/20/Latency-for-a-set-Throughput.html

Various cause of latency, and the solution -[..]Topics-in-High-Performance-Messaging.htm

(google search) (amazon search)

Fri Sep 09 08:00:46 GMT 2016 From /weblog/design/examples


How QQ deliver hotfix at Android -

(google search) (amazon search)

Tue Aug 16 16:06:59 GMT 2016 From /weblog/design/examples


How linkedin handle logs -[..]ould-know-about-real-time-datas-unifying

(google search) (amazon search)

Wed Dec 09 03:20:40 GMT 2015 From /weblog/design


(google search) (amazon search)

Thu Dec 03 02:33:50 GMT 2015 From /weblog/design/interview


(google search) (amazon search)

Thu Nov 12 16:07:00 GMT 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 07:29:04 GMT 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 06:18:31 GMT 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 15:06:06 GMT 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 Dec 31 11:11:17 GMT 2014 From /weblog/design


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 10:21:23 GMT 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 09:42:08 GMT 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 06:47:54 GMT 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 07:13:25 GMT 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)

Wed May 21 09:43:40 GMT 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 07:37:30 GMT 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 02:38:41 GMT 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)