王一生 的个人资料王一生日志列表留言簿 工具 帮助

日志


2008/12/10

实战总结

            实战总结
                 作者:王一生   日期:2008-12-9

一、 忌讳投鼠忌器(物品)
二、 防偷袭(务必提防小人行径,致命一击)。
三、 以衣物防护手部。
2007/3/2

Some books on Use Case(一些用例分析的书)

               Some books on Use Case(一些用例分析的书)

I had read Patterns for Effective Use Cases, but now when I review the book, I have nearly forgotten all the context of this book.
Some patterns(because they are only relating to naming convention) I can still recall are:
VerbPhaseName
ActorIntentAccomplished

I have to reread the whole book ,BTW, as the specialists have suggested ,the book “Writing Effective Use Cases” is the best book on Use Case topic(Author: Alistair Cockburn).

Wanna be more professional on Use Case analysis? The above two books are recommended.

2007/2/27

领域驱动设计入门(Domain-Driven Design Quickly)

               领域驱动设计入门(Domain-Driven Design Quickly)

I got the “Domain-Driven Design Quickly” document from infoq.com, after browsing the document, I regard it deserves our attention.

Step 1:
As the document has said, we need a common language between domain experts and software specialist (designer, analyst, developer, etc.), here we say it Ubiquitous Language.
Ubiquitous Language should base on conception acknowledgement accepted by both sides, UML and document can provide auxiliary support to this.

Step 2:
Then next is to apply Model-driven Design to the DDD.
Model-driven Design contains below conception:
1.    Entity Object
2.    Value Object
3.    Service
       3.1  The operation performed by the Service refers to a domain concept which does
      not naturally belong to an Entity or Value  Object.
      3.2  The operation performed refers to other objects in the domain.
      3.3  The operation is stateless.
4.    Aggregate
5.    Factory
6.    Repository

Here, I need to point out; maybe we are short of the Repository when reviewing the last project (Spring+Hibernate).
See document on what’s the aim of repository:
“Therefore, use a repository, the purpose of which is to encapsulate all the logic needed to obtain object references.”

Step 4:
Then ,the document talks about the refactoring functionality applied to the DDD development, some items such as Specification Object should be noticed.

Step 5:
Preserving Model Integrity, as the document saying,”everybody knows his own backyard, but other areas are not known in enough detail”.
Some guideline principles are listed as below:
1.    Bounded Context
2.    Continuous Integration
       Applies to bounded context ,not neighboring..
3.    Context Map
4.    Shared Kernel
5.    Customer-Supplier
6.    Conformist
7.    Anticorruption Layer
       Anticorruption Layer talks to the external model using the external language not the client one.
8.    Open Host Service
9.    Distillation

Here, need a dividing between Core Domain and Generic Subdomain.
And ,on how to implement Generic Subdomain ,we can use off-the-shelf solution, outsourcing ,in-house solution ,etc.

Future, maybe we can pay some attention to DSL(Domain Specific Language).

Some web addresses can be used as the references on DDD learning and implementation.

http://domaindrivendesign.org/
http://www.domainlanguage.com/


2007/2/24

项目经理的经验问题

                项目经理的经验问题

1、    较差的评估和计划
2、    缺乏质量标准和度量
3、    缺乏作出组织决策的指南
4、    缺乏使进展可见的技术
5、    角色定义较差
6、    不正确的成功准则

面向对象设计(Object-Oriented Design)

                面向对象设计(Object-Oriented Design)

        对于软件设计,无过于功能分解+责任委托处理。
对于面向对象的理解,不妨从三个视角审视,一是概念视角、二是规约视角、三是实现视角。我想这大致能凸显一个立体的视图。
        应该坚持的设计规则是:
1、 对象
1.1     对象应该自己负责自己,而且应该清楚的定义责任。
1.2     封装包含数据、实现细节、派生类、设计细节、实例化规则的隐藏。
1.3     规则只在一个地方实现。

2、 设计时的原则
2.1    针对接口编程。
2.2    高内聚,低耦合。优先实现对象聚集,而不是类继承。
2.3    模块、方法和类应该对扩展开发,对修改封闭(开闭原则)、依赖倒置原则(DIP)、Listkov替换原则。

3、 其它需要坚持的是
3.1     类的设计可以从相同行为、责任的角度考虑。
3.2     考虑变化的设计关注对变化的概念进行封装。
3.3     对于系统中的任意两个实体A或B,应该将它们之间的关系限定为A使用B,或者A创建/管理B,但两种关系不能同时存在。

        思考分析的过程可以从共性与可变性分析、责任分解问题域、从背景设计这三种角度着手。其中可变矩阵可作为一种工具使用。

        以上乃本人阅读《Design Patterns Explained: A New Perspective Object-Oriented Design》的概要笔记。

2006/12/4

重读《人月神话》

                                      重读《人月神话》

       近日重读《人月神话》,现将思路整理如下:    
       项目实施最理想的结果莫过于在规定的时间和预算里,交付让用户满意的软件产品。

       而在按人月计划的项目评估中,我们要充分考虑到任务的复杂度和子任务之间相互沟通和交流做要付出
的代价,所以在用人月来衡量一项工作的规模时,要充分考虑到这一部分工作量。

       项目实施的原则,其中重要的一点是保持概念的完整性,其中为了完整性,可能会舍弃一些优秀的思想,
当然,前提是基础设计要做的足够的好。

       二是要注意合理的进度安排,以免进度滞后,缺乏合理的时间进度是造成项目滞后的主要因素。由此在
项目实施从开始就应该注意文档和交流的重要性。
       在进度安排上,
       1、尽量避免为了客户期望的日期而造成不合理的进度安排,因为这种情况在软件领域比其它的任何工
程领域要普遍的多。
       2、预防进度滞后,过程之一是采取阶段性的目标值控制即里程碑验收体系。
       3、对于进度落后,一种方式是向项目增加人手,但这可能不是一种理想的方式。另外可考虑的措施是
重新安排进度或者消减任务或功能。

       三是组织结构是树状的甚至是矩阵的,但成员的交流却是网状的。
       四是迭代开发的实施。

       五是需求变更的控制。
       要有关心用户体验的概念,即开发人员交付的是用户满意程度,所以需求变更是经常发生的。对一般的
编程人员来说很少能控制工作环境和工作目标。而这时,项目经理需要有能力充当大型调速轮的角色,需要
项目经理的惯性来降低来自市场和管理人员对项目组造成的冲击或者起伏波动。


2006/11/16

AJAX + JSON 实际应用

                AJAX + JSON 实际应用

        原有系统是以Struts做为框架,所以添加AJAX功能也是在已有Action基础上进行。
因为新的需求涉及到用异步技术处理方面并不是太多,所以并没有使用prototype,jQuery或dojo,DWR等AJAX框架。

步骤一、
        针对JSP页面部分,应用到的Javascript函数主要有
function sendToServer(method ,url,params,callback ,obj),该方法包装了AJAX的通信部分例如:
… …
var req = new XMLHttpRequest();
req.open(method,completed_url,async_flag );
… …
其中method是GET或POST
     url 是发送的URL,这里是某个Action,例如/app/xxx.do.
     params是Array类型的请求参数,
     callback 是回调方法,
     obj是事件触发者,比如radio或checkbox,
     async_flag 是是否异步的boolean值
其中params是通过buildQuery()函数返回的请求参数,该函数如下:
function buildQuery(params){
    var query = "";
    for (var i = 0; i < params.length; i++) {
        query += (i > 0 ? "&" : "")
            + escape(params[i].name) + "="
            + escape(params[i].value);
    }
    return query;
}
其中buildQuery(params)里的params是Array类型。
针对数据传输,我采用JSON格式,例如针对buildQuery(params)的params,则如下定义:
var params = new Array();
var para1 = document.Form1.element1?document. Form1. element1.value:null;
var para2= document.Form1.element2?document. Form1. element2.value:null;
    params [0] = { name: " para1 " ,value: para1 };
    params [1] = { name: " para2" ,value: para2};
……
当触发事件时,调用sendToServer(method ,url,params,callback ,obj),params是上面提到的JSON格式的Array,经过buildQuery编码,和url参数组成完整的请求URL,即completed_url,然后调用req.open(method,completed_url,async_flag )方法发起异步请求。

步骤二、
        服务端主要在Struts的Action里处理,
例如
String feedback =””;
… …
feedback = Util.addMTask();
response.setContentType("text/xml");
PrintWriter out = response.getWriter();
out.println(feedback);
out.flush();
return null;
其中feedback是JSON格式的字符串.
其中Util.addMTask调用自写的JSONObject类来生成JSON格式的String.

步骤三、
        JSP里的Javascript回调方法如下:
function updateMAction(req,obj){
    var content = "";
    content = eval( '( ' + req.responseText + ' )');
    var action = content.action;
    var status = content.status;
    if(action =="addmtask" && status == "addmtask_ok" ){
       
        obj.parentElement.parentElement.parentElement.removeNode(true)
        alert("Assigning task operation is successful.");
        if(!document.Form1.assignMTask)
            window.history.go(-1);
    }else{
        alert("error occurred when creating tasks");
    }
}

如此就完成了一个AJAX+JSON的应用。
2006/4/25

XFire

Codehaus XFire is a next-generation java SOAP framework. Codehaus XFire makes service oriented development approachable through its easy to use API and support for standards. It is also highly performant since it is built on a low memory StAX based model.

Above introduction comes from http://xfire.codehaus.org/,and at the same time I searched the keyword XFire with the Google search engine,I found few Chinese information about XFire(related to SOAP ).

From my first experience of the XFire,I think it's good and convenient for Web Service construction and development though I'm not familiar with Apache's Axis,and there are comparison data showing the completeness support and powerful functionalities of XFire.

It seems some people in China are devoting themselves to the applying of XFire,the http://www.kuaff.com address is good for XFire learners,it provides some materials on XFire.Certainly,the best way is to learn from http://xfire.codehaus.org/.

If time allowed ,I'll provide some information or experience on the using of XFire later.


2006/4/20

Integrated Process Improvement Principles

1. Maintain executive support.Strong consistent support is crucial.

2. Pick your targets carefully.Don't underestimate the effort needed,because process improvement is hard work.

3. Leverage best practices.Use what is available and "steal with pride."

4. Align process improvement with your business objectives.Leverage existing objectives or create new ones to support process improvement.
2006/4/11

something about Web Service|一些关于Web服务的信息/新闻

    On the day of 4 April 2006,  W3C(http://www.w3c.org/) announces the opening of the W3C China Office (http://www.chinaw3c.org/). The chinaw3c's announcement says it marks that China has more voice on the international standards in the web industry though the W3C Office in Hong Kong(http://www.w3c.org.hk/index.html) was inaugurated on 13 November 1998.The opening ceremonies will be held on 27-28 April 2006.

    After entering the 2006 ,some specifications have come to the publication,such as:

1. 2006-03-27: The Web Services Description Working Group published updated drafts of the Web Services Description Language (WSDL) Version 2.0 specifications: Part 0: Primer(http://www.w3.org/TR/2006/CR-wsdl20-primer-20060327/), Part 1: Core Language and Part 2: Adjuncts have been republished with minor modifications as W3C Candidate Recommendations.


2. Members Approve WS-Security v1.1 as OASIS Standard(http://www.oasis-open.org/news/oasis-news-06-02-15.php),and the specification can be downloaded from the http://www.oasis-open.org/committees/download.php/16790/wss-v1.1-spec-os-SOAPMessageSecurity.pdf address.

 


 

2006/4/5

XML命名空间

    XML命名空间声明中所用的URI必须和XML模式声明中的目标命名空间相匹配.

例如,XML模式声明的目标命名空间
<?xml version='1.0' encoding='UTF-8' ?>
<schema xmlns="
http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.malcolm.com/Address" >
 <complexType name="AddressType" >
  <sequence>
   <element name="street" type="string" />
    ...
  </sequence>
 </complexType>
</schema>

例如,XML命名空间
<?xml version='1.0' encoding='UTF-8' ?>
 <res:reservation xmlns:res="
http://www.malcolm.com/Reservation" >
  ...
   <addr:address xmlns:addr="
http://www.malcolm.com/Address" >
    <addr:street>...</addr:street>
    ...
   </addr:address>
  ...
</res:reservation>
    默认命名空间是一个没有前缀的XML命名空间声明(xmlns="URI" ),其作用域仅应用于声明此默认命名空间的元素,以及在该元素之下嵌套的无前缀元素.默认命名空间不作用于属性.默认命名空间不应用于属性,唯一例外的是XML语言本身所定义的属性,例如xmlns属性.
    如果希望指出与一个XML命名空间相关联的XML模式的位置,从而使解析器可以将其上载,并用于验证中,可以通过schemaLocation属性完成.元素以命名空间-位置值对出现.第一个值是XML命名空间的URI;第二个值是XML模式的物理位置.例如如下:

<?xml version='1.0' encoding='UTF-8' ?>
 <reservation xmlns="
http://www.malcolm.com/Reservation"
    xmlns:xsi="
http://www.w3c.org/2001/XMLSchema-Instance"
    xsi:schemaLocation="
http://www.malcolm.com/Reservation
                        http://www.malcolm.com/schemas/reservation.xsd"  >

    XML模式也使用XML命名空间,例如如下:

<?xml version='1.0' encoding='UTF-8' ?>
 <schema
   xmlns="
http://www.malcolm.com/Reservation"
   targetNamespace="
http://www.malcolm.com/Address"
   xmlns:addr="
http://www.malcolm.com/Address" >
...

   第一个命名空间指出默认命名空间,第二个指出XML模式的目标命名空间是Address标记的命名空间,第三个对目标命名空间指定了前缀.

 

 

2006/4/3

Use Case: generalization

In the book of "The Unified Modeling Language User Guide" (8th
Printing April 2001 ,ADDISON-WESLEY),there's one paragraph(Page 226)
like this: "Generalization among use cases is just like
generalizations among classes.Here it means that the child use case
inherits the behavior and meaning of the parent use case;the child
may add to or override the behavior of its parent;and the child
may be substituted any place the parent appears(both the parent and
the child may have concrete instances)."

I'm confused about the meaning of '... the child may be substituted
any place the parent appears ...'.It seems that the child use case
can be replaced by something else.But from the context of the
paragraph,it seems that the child use case can replace the parent
use case any place where the parent use case appears.So,here's
the problem ,who replaces who ?Child use case replaces parent
,or parent replaces child ?

I have to refer to the dictionary (Oxford Advanced Learner's
Dictionary of Current English,seventh Edition,2005,OXFORD
UNIVERSITY PRESS).On page 1476,the dictionary provides some
information on the word substitute for me .

The word substitute can be used as phrases as below:
substitute A (for B) | substitute B (with/by A) | substitute for sb/sth
It means that we use A as a replacement of B.But I can not find any
similar phrase structure in the above paragraph. Luckily,the
dictionary gives us the HELP hint:

"HELP:when for,with or by are not used,as in the last
example,it can be difficult to tell whether the person or thing
mentioned is being used,or has been replaced by something or
something else.The context will usually make this clear."

The last example is this sentence:
Beckham was substituted in
the second half after a knee injury(= somebody else played
instead of Beckham in the second half).

So,here comes the clear view of the meaning of the '... the
child may be substituted any place the parent appears ...'.Because
of no prepositions as for ,with or by used,we can only make a
judgement from the detailed context of the paragraph.In the
paragraph,we see that the child use case inherits the behavior
and meaning of the parent use case and can add to or override
the behavior of its parent,so the child use case can be a
replacement of parent use case.

To dismiss the misapprehension ,I think the best way is to modify
the sentence like this ,'... the child may replace the parent any
place the parent appears ...'.


2006/3/15

屏幕阵列

    据说:画面是用二十四个屏幕拼起来的雷神之鎚,作者用了十二台Linux服务器,每台控制两个屏幕,应用分布式运算, 画面同步,形成如此壮观的画面.