代码改变世界

用Groovy的方式Mock接口

2012-03-01 13:30 by 康杜, 2392 阅读, 0 推荐, 收藏, 编辑
摘要:在以往的程序开发中,我们如果要Mock一个接口,我们往往想到的是Mockito这样的Mock框架。但是如果我们采用Groovy作为测试用例语言的话,那么我们可以用Groovy的Map和Closure来实现对接口的Mock。 这是要测试的类,其中UserService是一个接口,通过Spring注入到UserNameExistValidator public class UserNameExis... 阅读全文

OSGi for beginners

2012-02-22 19:57 by 康杜, 167 阅读, 0 推荐, 收藏, 编辑
摘要:This is a very useful text for java developers who are willing to develop dynamic module for java applications. The Open Services Gateway Initiative (OSGi), also known as Dynamic Module System for Ja... 阅读全文

Testing tools

2012-02-14 10:59 by 康杜, 134 阅读, 0 推荐, 收藏, 编辑
摘要:http://www.softwareqatest.com/qatweb1.html 阅读全文

POJO

2012-02-08 11:11 by 康杜, 181 阅读, 0 推荐, 收藏, 编辑
摘要:无意间看到Spring Source中各名家Rod Johnson, Eric Evens的留言 http://forum.springsource.org/showthread.php?18155-Session-Facade-Business-Facade 下次有人要跟我辩论说模型只能有getter/setter时,我就拿Rod的原话说“POJOs, like all objects, a... 阅读全文

设计得不好

2012-01-20 14:28 by 康杜, 144 阅读, 0 推荐, 收藏, 编辑
摘要:设计得不好,那是因为设计者对问题领域没有深入的理解。 阅读全文

Integration rules

2012-01-18 15:43 by 康杜, 329 阅读, 0 推荐, 收藏, 编辑
摘要:Degisted from http://static.springsource.org/spring-integration/docs/2.0.0.RC1/reference/html/overview.html It states “Spring Integration is guided by the following principles: 1. Components sh... 阅读全文

Emacs

2012-01-18 09:50 by 康杜, 275 阅读, 0 推荐, 收藏, 编辑
摘要:My Emacs setting for Groovy (put 'dired-find-alternate-file 'disabled nil);;; turn on syntax highlighting(global-font-lock-mode 1);;; use groovy-mode when file ends in .groovy or has #!/bin/groovy at... 阅读全文

依赖于自己做计算

2012-01-17 11:01 by 康杜, 188 阅读, 0 推荐, 收藏, 编辑
摘要:面向对象设计范式(Object Oriented Design Paradigm)让我们更容易地抽象现实世界的对象,更容易地分析业务。但是,计算机对象不仅仅是现实世界中对象的简单映射。比如针对司机开车(Drivers drive cars)这个场景,在现实世界中开车(drive)是司机的行为,但是在计算机对象世界中, 为了高内聚(High Cohesion),如果Car拥有drive这样行为的所有... 阅读全文

软件架构(读书笔记2)

2012-01-16 09:11 by 康杜, 184 阅读, 0 推荐, 收藏, 编辑
摘要:架构关键要素 (Architectual Properties fo Key Interest ) 一个软件的架构不可能全部满足以下的架构性质,比如可移植的软件架构可能不必单一平台上架构的软件系统性能更好,但是我们可以通过列举系统的架构性质能够评估我们系统架构的属性(Properties)。 通常,我们可以做一个矩阵,对每项特质根据实际情况,用符号+、-,+/-表示系统的架构属性。如下图... 阅读全文

软件架构(读书笔记1)

2012-01-13 16:37 by 康杜, 233 阅读, 0 推荐, 收藏, 编辑
摘要:Roy Thomas Fielding在他的那篇著名的博士论文<Architectual Styles and the Design of Network-based Software Architectures>中写道’In spite of the interest in software architecture as a field of research, there is little agreement among researchers as to what exactly should be included in the definition of archit 阅读全文