Mediator 設(shè)計模式
摘要: 這個模式一直沒有好好的理解。最近作IM 相關(guān)的應(yīng)用,才明白了。
就是兩個人之間要溝通,不是直接,而是通過 mediator.
也就是 ,不是
user1.sendMessage(user2,"some message");
而是
user1.getMediator().sendMessage("user2","some message");
有什么好處呢:
職責(zé)分離:mediator 完成自己該承擔(dān)的職責(zé)。
mediator 也可以搞這搞那。
插一段實際代碼:
閱讀全文
推薦一篇 StAX and WoodStox 的介紹文章,英文
摘要:
StAX the odds with Woodstox
剛讀了,感覺不錯。
Over a decade into XML evolution, however, these parsing technologies are slowly showing their age, requiring bypasses and optimizations to overcome their well-known limitations. StAX, or Streaming API for XML, is the new-age XML parser that offers the best features of the existing models, and at the same time provides high performance and efficient access to the underlyi
閱讀全文