Mediator 设计模式
摘要: 这个模式一直没有好好的理解。最近作IM 相关的应用,才明白了。
就是两个人之间要沟通,不是直接,而是通过 mediator.
也就是 ,不是
user1.sendMessage(user2,"some message");
而是
user1.getMediator().sendMessage("user2","some message");
有什么好处呢:
职责分离:mediator 完成自己该承担的职责。
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
阅读全文