RSS feed [root] /design /weblog




login:

password:

title search:




 


Sat Sep 28 10:12:25 GMT 2024

design



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

Thu Mar 09 15:13:09 GMT 2017 From /weblog/design

visibility


Someone saying that having private method is anti-pattern, here is the discussion - http://www.infoq.com/news/2008/01/private-methods-tdd-design

Discussion of encapsulation - http://niket-this.blogspot.com[..]/encapsulation-does-it-really-exist.html

My view on this is that most of the time there's little value in self-encapsulation. The value of encapsulation is proportional to the scope of the data access. Classes are usually small (at least mine are) so direct access isn't going to be an issue within that scope. Most accessors are simple assignments for the setter and retrieval for the getter, so there's little value in using them internally. - https://martinfowler.com/bliki/SelfEncapsulation.html

(google search) (amazon search)


Tue Feb 21 09:44:20 GMT 2017 From /weblog/design

dsl


A paper show the evolution of a DSL - http://www.mockobjects.com/files/evolving_an_edsl.ooplsa2006.pdf

A stock trading order example of DSL - http://debasishg.blogspot.com[..]05/designing-internal-dsls-in-scala.html

What is the difference between API / DSL if we don't write a parser for our language? From Martin Fowler's blog - http://martinfowler.com/bliki/DslReadings.html , it is mentioned:
Piers Cawley makes the point that a key characteristic of DSLs is their narrow focus on a domain.
I think this is a very good summary, usually if most of the APIs are getXXX() , setXXX(), loadXXX() , createXXX() ........ Then we mostly design APIs that expose low level detail to the API user to work on, which, is work but user probably work nicer if we can come up with language like API that allow users to do their work in more descriptive level.

I think if API design like that usually it will reduce the code duplication, what ever real duplication or conceptual duplication. It probably already apply "Tell, don't ask" style - http://c2.com/cgi/wiki?TellDontAsk

A discussion about applying "Tell, don't ask" which lead to message passing architecture - http://beautifulcode.oreillynet.com[..]07/10/do_messages_want_to_be_asynchr.php

And other discussion about "Tell, don't ask"
http://sriramnarayan.blogspot.com[..]/2008/11/demeters-law-tell-dont-ask.html
http://sriramnarayan.blogspot.com[..]part-two-demeters-law-tell-dont-ask.html
http://sriramnarayan.blogspot.com[..]rt-three-demeters-law-tell-dont-ask.html

One good sample with explaination -
http://hamletdarcy.blogspot.com[..]-it-really-domain-specific-language.html
http://nat.truemesh.com/archives/000727.html

Few links - http://dreamhead.blogbus.com/logs/17667876.html

From CRUD to DDD - http://www.udidahan.com[..]2/15/from-crud-to-domain-driven-fluency/

I like this: "XML abuse reduction (conducting an “XML Intervention”)" - http://www.lostechies.com[..]ps-internal-dsl-draft-outline-notes.aspx

DSL maybe the result of encapsulation - http://dreamhead.blogbus.com/logs/214225975.html

Excellent implementation of extending java yourself - http://www.infoq.com/presentations/JetBrains-MPS-DSL http://www.infoq.com/presentations/JetBrains-MPS-DSL-2

How DSL method named - http://tech.pro[..]he-java-fluent-api-designer-crash-course

https://tomassetti.me/domain-specific-languages/

(google search) (amazon search)


Wed Feb 15 16:03:22 GMT 2017 From /weblog/design/pattern

reactive


https://realm.io[..]ation-hugo-visser-rxjava-for-rest-of-us/

(google search) (amazon search)


Mon Jan 23 10:33:07 GMT 2017 From /weblog/design

thread


Stealing thread - http://badamczewski.blogspot.com.au/2012/05/work-stealing.html

Intel Guide for Developing Multithreaded Applications - http://software.intel.com[..]or-developing-multithreaded-applications

Difference ways to stop a thread - http://www.ddj.com[..]ept_url=/hpc-high-performance-computing/

Interesting, I am not sure if I agree, but chrome ( which use fork ) are really cool in performance:
There’s another problem with Unix programming in Ruby that I’ll just touch on briefly: Java people and Windows people. They’re going to tell you that fork(2) is bad because they don’t have it on their platform, or it sucks on their platform, or whatever, but it’s cool, you know, because they have native threads, and threads are like, way better anyways.

Fuck that.

Don’t ever let anyone tell you that fork(2) is bad. Thirty years from now, there will still be a fork(2) and a pipe(2) and a exec(2) and smart people will still be using them to solve hard problems reliably and predictably, just like they were thirty years ago.

MRI Ruby people need to accept, like Python (you have seen multiprocessing, yes?), that Unix processes are one of two techniques for achieving reliable concurrency and parallelism in server applications. Threads are out. You can use processes, or async/events, or both processes and async/events, but definitely not threads. Threads are out.
http://tomayko.com/writings/unicorn-is-unix

1x1 win M*N - http://binkley.blogspot.com/2012/01/1-1-beats-n-m.html

Best number of threads:
N = number of CPUs
U = target CPU utilization (0 <= U <= 1)
W/C = ration of wait time to cpu time (measured through profiling)

threads = N * U * (1 + W/C) - http://www.ibm.com/developerworks/library/j-jtp0730.html http://stackoverflow.com[..]ratio-of-java-threads-to-cpus-on-solaris

Another post about tuning thread pool - http://www.javaadvent.com[..]ortance-of-tuning-your-thread-pools.html

Threads Basics - http://www.hpl.hp.com/techreports/2009/HPL-2009-259html.html http://www.hpl.hp.com/personal/Hans_Boehm/c++mm/threadsintro.html

The Dos and Don'ts of Multithreading - http://www.infoq.com/presentations/multithreading

https://www.infoq.com/articles/engstrand-microservice-threading

http://cbloomrants.blogspot.hk[..]-26-09-low-level-threading-table-of.html

(google search) (amazon search)


Tue Jan 17 15:09:08 GMT 2017 From /weblog/design

gc


https://blog.plan99.net[..]rbage-collection-911ef4f8bd8e#.wr03zaasu

(google search) (amazon search)


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

work with legacy


Simple ways to improve legacy code - http://www.onjava.com/lpt/a/4805

One approach to work with legacy code, instead of phrase by phrase or part by part, identify and improve the domain part first - http://gojko.net[..]-efforts-to-replace-legacy-systems-fail/

http://arne-mertz.de[..]egacy-applications-tests-modularization/

Note of common point for refactoring with legacy application - http://marxsoftware.blogspot.hk[..]/2016/10/unintentionally-obfuscated.html

(google search) (amazon search)


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

Amazon


"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."

http://highscalability.com/amazon-architecture

Shel Kaphan - http://www.infoq.com/cn/articles/talk-with-amazon-shel-kaphan

(google search) (amazon search)


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

value object


Discussion of DTO - http://mrpmorris.blogspot.com/2009/01/data-transfer-objects.html

Discussion of value object - http://blog.joda.org/2014/03/valjos-value-java-objects.html http://martinfowler.com/bliki/ValueObject.html http://martinfowler.com/bliki/AliasingBug.html

(google search) (amazon search)


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

retry


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

(google search) (amazon search)


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

lock


10-ways-to-reduce-lock-contention-in-threaded-programs - http://www.thinkingparallel.com[..]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. - http://www.dcmanges.com[..]-optimistic-locking-isnt-a-silver-bullet

futexes - http://en.wikipedia.org/wiki/Futex http://groups.google.com[..]ds/browse_thread/thread/3c3608a779dc6731

Spinning - http://www.1024cores.net[..]ome/lock-free-algorithms/tricks/spinning

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

Try to use non-blocking approach if possible - http://mechanical-sympathy.blogspot.com[..]1/locks-condition-variables-latency.html

Concurrency without lock, and even without correctness? - http://splashcon.org/2011/program/dls/245-invited-talk-2

Single write principle - http://mechanical-sympathy.blogspot.com.au[..].au/2011/09/single-writer-principle.html

Comparing difference kind of locks again - http://concurrencyfreaks.blogspot.com.au[..]11/stampedlocktryoptimisticread-and.html

10-ways-to-reduce-lock-contention-in-threaded-programs - http://www.thinkingparallel.com[..]ce-lock-contention-in-threaded-programs/

(google search) (amazon search)


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

yahoo


How yahoo use Hadoop for machine learning - https://www.infoq.com/articles/peter-cnudde-yahoo-big-data

(google search) (amazon search)


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

latency


http://highscalability.com[..]here-and-it-costs-you-sales-how-crush-it

*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.

http://highscalability.com[..]ughput-by-32x-and-reduce-latency-by.html

http://bravenewgeek.com[..]rything-you-know-about-latency-is-wrong/

How to monitor - https://plumbr.eu[..]siness-value-from-performance-monitoring

How to measure latency - https://vanilla-java.github.io[..]/07/20/Latency-for-a-set-Throughput.html

Various cause of latency, and the solution - https://www.informatica.com[..]Topics-in-High-Performance-Messaging.htm

(google search) (amazon search)


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

patching


How QQ deliver hotfix at Android - http://www.infoq.com/cn/articles/Android-hot-fix

(google search) (amazon search)


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

linkedin


How linkedin handle logs - https://engineering.linkedin.com[..]ould-know-about-real-time-datas-unifying

(google search) (amazon search)



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

availability


https://www.pgrs.net/2013/02/21/high-availability-at-braintree/

https://medium.com[..]y-available-code-7eaf3d7aae00#.cbae171gy

(google search) (amazon search)


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

UncleBob


http://www.infoq.com/news/2015/11/uncle-bob-oath-programmer

(google search) (amazon search)


Thu Nov 12 16:07:00 GMT 2015 From /weblog/design

memory


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

Discussion of if there are way to recover OOME - http://dobbscodetalk.com[..]-a-Non-Recoverable-Error-.html&Itemid=29

http://blog.maxindelicato.com[..]ghly-available-inmemory-shard-index.html

Discussion about using memory as store - http://martinfowler.com/bliki/MemoryImage.html

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 - http://vanillajava.blogspot.com.au[..]n-using-direct-memory-can-be-faster.html

http://www.memorymanagement.org/index.html

(google search) (amazon search)


Wed Sep 30 07:29:04 GMT 2015 From /weblog/design/pattern

tutorial


Collection of patterns from objectmentor - http://bradapp.blogspot.com[..]07/agile-scm-principles-from-ood-to.html

Robert Martin tutorial - http://www.java.net/pub/au/90

Links and abstract of few principle - http://www.surfscranton.com/Architecture/JavaPages.htm

Tutorial about common anti-pattern - http://giorgiosironi.blogspot.com/2009/11/anti-patterns.html

Development of Further Patterns of Enterprise Application Architecture - http://martinfowler.com/eaaDev/

Expanation and C++/Java samples - http://www.vincehuston.org/dp/

Java tutorial - http://www.javacodegeeks.com/2015/09/java-design-patterns.html


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

http://www.artima.com/scalazine/articles/goals_of_scala.html

(google search) (amazon search)


Sat Aug 15 15:06:06 GMT 2015 From /weblog/design

game


Introduction to AI of game - http://aigamedev.com/theory/online-adaptation-game-opponent

How to create angry bird - http://www.wildbunny.co.uk[..]11/06/07/how-to-make-angry-birds-part-2/

How to program breast in game - http://www.inside.com.tw[..]15/07/30/how-video-game-breasts-are-made

http://www.inside.com.tw[..]eveloper-nintendo-president-satoru-iwata

(google search) (amazon search)


Wed Dec 31 11:11:17 GMT 2014 From /weblog/design

issues


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

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

(google search) (amazon search)


Thu Dec 11 10:21:23 GMT 2014 From /weblog/design/pattern

notification


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

(google search) (amazon search)


Thu Sep 25 09:42:08 GMT 2014 From /weblog/design

datetime


Look like Java standard library already handle the 400 years leap day. However, there are still a lot to take care. - http://discuss.joelonsoftware.com/default.asp?design.4.326089

P.S.: an article about java timezone handling - http://www.javaworld.com/javaworld/jw-10-2003/jw-1003-time_p.html

Basic about computer time - http://blogs.windwardreports.com[..]ry-developer-should-know-about-time.html

Difference of time function provided by IPP - http://software.intel.com[..]g-function-for-measuring-ipp-api-timing/

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

How to model thing that change with time - http://www.martinfowler.com/ap2/timeNarrative.html

Timezone handling issues of most application - http://martinfowler.com/bliki/TimeZoneUncertainty.html


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

http://www.computer.org/software/homepage/2003/s1const.htm
http://www.pragmaticprogrammer.com/ppllc/papers/1998_05.html

Other than that, there is also security risk if you show too much to other - http://www.indicthreads.com[..]_or_objects_java_security_problem_1.html

An example of why passing Map around is wrong and show solution of that example - http://antagonisticpleiotropy.blogspot.com[..]spot.com/2008/01/hashmap-temptation.html

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.”

http://tech.groups.yahoo.com[..]om/group/domaindrivendesign/message/5701

East: Clean and DRY, an example of why tell don't ask help - http://jamesladdcode.com/?p=294

But personally, I don't use tell-dont-ask. I do look to co-locate data and behavior, which often leads to similar results. - http://martinfowler.com/bliki/TellDontAsk.html

Another discussion about getter and setter - http://www.yegor256.com[..]/09/16/getters-and-setters-are-evil.html

(google search) (amazon search)