RSS feed [root] /design /weblog




login:

password:

title search:




 


Sun Sep 10 16:25:08 HKT 2017

design



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

Wed Jan 06 01:47:53 HKT 2010 From /weblog/design

version


A Theory of Compatible Versions, and introduction of how and why difference versions are comptible or not - http://www.xml.com/lpt/a/1684

XStream offers some support for refactorings (aliases can help). But very soon you will run into big troubles and will have to make some decisions. Either avoid refactorings (just a little tweak here and there, will weaken your architecture over time) or start implementing workarounds – e.g. custom converters (much work, bad code). - http://blog.cedarsoft.com[..]ts-wrong-with-xstream-and-similar-tools/

(google search) (amazon search)


Thu Dec 31 00:46:40 HKT 2009 From /weblog/design/interview

Rod Johnson


Lessons Learned From Java EE’s Evolution, discuss about value of standard and opensource - http://www.infoq.com/presentations/Lessons-Learned-from-Java-EE

(google search) (amazon search)


Sat Dec 12 10:43:54 HKT 2009 From /weblog/design

login


Batch login Authentication - http://www.udidahan.com[..]us-high-performance-login-for-web-farms/

(google search) (amazon search)


Thu Dec 10 00:01:54 HKT 2009 From /weblog/design/interview

Ralph Johnson


http://www.infoq.com[..]h-Johnson-Parallel-Programming-Patterns#

(google search) (amazon search)


Fri Nov 27 15:56:17 HKT 2009 From /weblog/design/distribute

eventual-consistency


A short example to show how eventual-consistency work - http://sbtourist.blogspot.com[..]/11/eventual-consistency-by-example.html

(google search) (amazon search)


Thu Nov 12 09:57:25 HKT 2009 From /weblog/design/pattern

repository


http://giorgiosironi.blogspot.com/2009/10/repository-pattern.html

(google search) (amazon search)


Fri Sep 25 19:04:28 HKT 2009 From /weblog/design

mutability


http://en.wikipedia.org/wiki/Const
http://www.c2.com/cgi/wiki?ValueObjectsShouldBeImmutable
http://www.markhneedham.com[..]09/16/coding-watch-out-for-mutable-code/
Discuss issue of mutability from another aspect - http://www.artima.com/articles/hickey_on_time.html

(google search) (amazon search)



Thu Sep 24 12:35:05 HKT 2009 From /weblog/design

failfast


Have read this article long time before: http://www.martinfowler.com/ieeeSoftware/failFast.pdf However, the more I work on programming the more I find that reasonable default (may be with logging) work better in some cases, but really need to beware about the cost of debugging if there is problem....

Another discussion about failfast vs. failsafe - http://www.certpal.com[..]009/09/iterators-fail-fast-vs-fail-safe/

(google search) (amazon search)


Sat Sep 19 01:37:37 HKT 2009 From /weblog/design

concept


http://www.butunclebob.com[..].UncleBob.ArchitectureIsaSecondaryEffect

sunday-school truth: if you don't do well in small think, you will do worse at big thing: http://udidahan.weblogs.us/archives/035032.html

Wait for best solution - http://www.threeriversinstitute.org/blog/?p=374

(google search) (amazon search)


Sun Sep 13 00:05:27 HKT 2009 From /weblog/design

delete


I think there's perfectly reasonable scenarios for both soft and hard deletes, with and without audit trails.

1. Soft delete:
A user signs off of your service, but you need to keep (anonymized) stats data consistent for your customers - here you cannot remove the entire user, you just blank his personal data (name, email, phone, ...) and keep the anonymized statistical data (country, birth year, profession).

2. Soft (or super-soft) delete with audit trail:
Any financial transaction data, even if entered by error, may only be corrected by adding a correction entry, not by deleting the erroneous entry, or the IRS will be all over you. So either you flag it as deleted (soft delete) or you correct it by adding another entry ("super-soft delete").

3. Hard delete with audit trail:
A user unsubscribes from your newsletter. No need to keep the info "he once was subscribed to it" in the live database, but need to keep the info somewhere accessible in case he sues you for spamming and you can prove "but back in August when you got the mail, you were still subscribed".

4. Hard delete with no audit trail:
Personal data as in #1 if your local data protection laws require. (This means *no* more storing, *anywhere*, technically speaking not even in last month's backup, but that's another issue altogether.)

http://ayende.com/Blog/archive/2009/08/30/avoid-soft-deletes.aspx

And Udi think is real life, people usually never really delete something - http://www.udidahan.com/2009/09/01/dont-delete-just-dont/

(google search) (amazon search)


Thu Sep 03 00:28:22 HKT 2009 From /weblog/design

composition over inheritance


Good example of composition over inheritance - http://www.javablogging.com/comparable-vs-comparator/

(google search) (amazon search)


Sun Jan 25 01:43:09 HKT 2009 From /weblog/design

static


I will prefer using static method as less as possible... there is some
side effect you are not expected, like, are you sure it thread safe? static
method easier to have thread problem.

You may take a look at http://debasishg.blogspot.com[..]007/03/making-classes-unit-testable.html , http://www.beust.com/weblog/archives/000173.html and http://discuss.joelonsoftware.com[..]Parent=7972&ixDiscussGroup=3&cReplies=29

Parameter passing vs static accessor: Should I press things around or get from public static instance? - http://groups.yahoo.com/group/refactoring/message/3342

Reason of static method is not overrided - http://groups.google.com[..]thread/ec8b924d60dd4734/99b488aa1f8106c9

Another example of thread problem with static member - http://jroller.com[..]=calendar_dateformat_and_multi_threading

How to mock static method code for testing - http://blog.xebia.com/2007/06/21/mocking-static-calls/

http://googletesting.blogspot.com[..]ic-methods-are-death-to-testability.html

(google search) (amazon search)


Mon Jan 12 23:05:43 HKT 2009 From /weblog/design

messaging


Why should you combine Reliable Messaging with Distributed Caching - http://www.theserverside.com[..]MessagingDistributedCaching/article.html

Read from cache, write the message system - http://radio.weblogs.com/0112098/2003/01/15.html#a319

(google search) (amazon search)


Wed Jun 25 09:59:02 HKT 2008 From /weblog/design/exception

problem of using exception for control flow


Other than harder to read, this approach is easier to have side effect, consider the following case:

// Code which fail
public String service() {
try {
// a lot of other code....
return getRecord();
} catch (SQLException re) {
return "defaultRecord";
}
}

private String getRecord() throws SQLException {
PreparedStatement ps = getConnection().prepareStatement("select something from sometable");
try {
final ResultSet rs = ps.executeQuery();
try {
if (rs.next())
return rs.getString(1);
else
throw new NotFoundException();
} finally {
rs.close();
}
} finally {
ps.close();
}

// definition of NotFoundException, analog to IOException and FileNotFoundException
public final class NotFoundException extends SQLException {....}


The idea is, for any database problem, just return default value. However, if someone change the interface of NotFoundException to

public final class NotFoundException extends RuntimeException {....}

Then it break service() silencely :-/ Some to it is better to have


// Code which fail
public String service() {
try {
// a lot of other code....
return getRecord() == null ? "defaultRecord" : getRecord();
} catch (SQLException re) {
// proper exception handling
}
}

private String getRecord() throws SQLException {
PreparedStatement ps = getConnection().prepareStatement("select something from sometable");
try {
final ResultSet rs = ps.executeQuery();
try {
if (rs.next())
return rs.getString(1);
else
return null;
} finally {
rs.close();
}
} finally {
ps.close();
}



(google search) (amazon search)


Tue May 06 14:25:04 HKT 2008 From /weblog/design/interview

Donald Knuth


Donald Knuth on Multi-Core, Unit Testing, Literate Programming, and XP:

I also must confess to a strong bias against the fashion for reusable code. To me, "re-editable code" is much, much better than an untouchable black box or toolkit. I could go on and on about this. If you’re totally convinced that reusable code is wonderful, I probably won’t be able to sway you anyway, but you’ll never convince me that reusable code isn’t mostly a menace...


http://www.artima.com/forums/flat.jsp?forum=276&thread=229705

(google search) (amazon search)


Tue Apr 29 01:46:55 HKT 2008 From /weblog/design/interview

Bjarne Stroustrup


Nice message cover DSL, IDE, multiple dispatch, message passing, and more

http://msdn2.microsoft.com/en-us/magazine/cc500572.aspx

(google search) (amazon search)



Tue Mar 18 01:25:24 HKT 2008 From /weblog/design/exception

Handle exception at event


To prevent no one notice there is problem

What the code is trying to do is make sure is that any exception thrown is brought to the attention of the user. I’ve been looking at a few approaches to help catch and handle these exceptions without the developer having to explicitly catch them at the UI level.
You can create your own EventQueue, and have it catch uncaught exceptions when dispatching methods

http://www.magpiebrain.com[..]2004/07/21/catching-uncaught-exceptions/

(google search) (amazon search)


Fri Dec 14 12:03:17 HKT 2007 From /weblog/design

sorting


Show a design of how to write a map that store data at disk and do sorting - http://mattfleming.com/node/53

User friendly sort , "100" should be sort after "10" - http://www.codinghorror.com/blog/archives/001018.html

(google search) (amazon search)


Wed Dec 12 18:38:08 HKT 2007 From /weblog/design

qconsf


2007 summary, include discussion about distributed, dsl, arhitecture, XP, ... and many others - http://www.infoq.com/articles/qconsf-2007-summary

(google search) (amazon search)


Tue Dec 11 17:50:05 HKT 2007 From /weblog/design

string


Discussion about search and replace for a lot of files - http://discuss.joelonsoftware.com/default.asp?design.4.570350

(google search) (amazon search)


Thu Dec 06 16:34:42 HKT 2007 From /weblog/design

report


TDD reporting system

Only introduce framework when it is needed - http://xprogramming.com/xpmag/dbcCallingTheShot.htm
Process of improving - http://xprogramming.com/xpmag/dbcLjuticMonoGun.htm
Introduce reflection - http://xprogramming.com/xpmag/dbcLjuticRefactoring.htm

(google search) (amazon search)


Sat Dec 01 16:18:17 HKT 2007 From /weblog/design

convention over configuration


Make it is easier for user to working with your API / framework - http://www.google.com[..]uration&sourceid=opera&ie=utf-8&oe=utf-8

(google search) (amazon search)


Wed Nov 21 14:20:13 HKT 2007 From /weblog/design

boolean


Try not to have boolean at the interface - http://www.jroller.com[..]Ruiz/entry/boolean_arguments_can_be_evil

(google search) (amazon search)