爪哇岛的一个山洼。

2007-04-25

【2007年4月25日】和一个朋友在Email中讨论AndroMDA的内容

Question 1: In chapter 4, is it better to name CarManager instead of
CarManagerController? Is it clearer "换句话说,CarManager是用来在Struts的Action
中调用。在Struts中之所以将Action和CarManager分离出来,主要是让开发者专注于
业务逻辑的开发,而避开Action配置的Controller技术细节"。Because Controller has
special meaning in Struts' MVC model. It is ease to be confused as a reader.

I thought uses Controller the name quite to be good. The Controller expressed in Struts
MVC in fact is the model Controller, therefore cannot have the confusion.

In the androMDA documents, has the following description to struts:
------------------------------

------------------------------
Struts

In order to adhere to the spirit of Struts web development I am trying to attain
at least the same strict requirements of its MVC implementation. As opposed to
earlier version of this cartridge, you will only need to model the Controller class,
the Views and Models are implied by the dynamic processes.

Model

The model corresponds to the form bean used in the request, this bean encapsulates
all request parameters for the use-case. No more logic should be put in there. Models
are generated by looking at the parameters sent between action states.

View

In a Struts application you will use JSP pages to represent the view components.
In the application's activity graphs views are tagged with the 'FrontEndView''
stereotype.

Controller

A Controller class defines the business operations performed by the actions on the
front-end. Typically it is the user who triggers an event by clicking on a button
or an hyperlink, this event is handled by an action that will defer any business
operation to the controller.
------------------------------------------------------------


Question 2: Assume project size is 50 developers for 18 months.
60% is for back-end business logic, 30 EJB developers.
20% front-end GUI, 10 web developers, and 10% for database system, 5 engineers
as well as 10% for messaging middleware.
How difficult to define Velocity templates for median or above size project?
How difficult to maintain the Velocity templates for the project during it's life cycle?
Velocity template is based on the concept of "macro" which is notorious for
maintenance?
Is the cost of learning AndroMDA such as the complexities of configuration
worthy for over-all project supports?

AndroMDA is auxiliary means, has the very many plug-in unitscomposition (Cartridges),
also may develop own plug-in unit(Cartridges). Chooses the suitable plug-in unit
and the use in the project in theappropriate place, enhances the working efficiency.
At present said, total dependence one code production tool is not realistic.

1. Because uses the Velocity definition the templates is one kind of code
structure plan, is provides in AndroMDA default approves in situation which the
templates does not answer the purpose, own redefine, in the ordinary
circumstances revises the original templates line. In several actual project, I
basically has all used the templates which default approved, has only made the
small change. Therefore defines the Velocity templates not to be certainly difficult.

2. The Velocity templates has nothing to do with with the actual project business
logic, therefore so long as just was starting planned after, during project's life
cycle, It does not have the frequent revision after define good set of Velocity,
but also may entrust with heavy responsibility in many projects. Therefore,
Velocity templates certainly not be major problem.

3. As for the beginner, androMDA disposition quite complex, but basically all has
default approves the establishment, very easy seat of honor. To AndroMDA use more
skilled after, can think the disposition structure is very clear. Studies AndroMDA
the cost to belong to the disposable cost, after is familiar may in many projects
uses, moreover is studying and appraised other similar MDA tool time is easier.
I thought studies AndroMDA is worth very much.

Recently, my manager has recommended a new MDA tool to me, calls Acceleo
( http://www.acceleo.org), based on Eclipse and EMF framework, is easier to study
and the use. I donot have the time to study, if you are interested, you can go
have a look.

2007-04-03

【技术心得】遇到技术难题一筹莫展的时候你该做什么?

一筹莫展??如果你正遇到一个技术问题可以用这四个字来形容的话,给你一个万能的解决方法:

public static void 万能解决方法()
{
  boolean 问题解决 = false;

  // 先仔细搜索互联网或者相关技术支持论坛,查看别人是否遇到过类型问题
  google.search();

  // 耐心查阅帮助文档的相关部分100遍,直到问题解决
  for(int i=0; i<100; i++)
  {
    阅读帮助文档;
    if(发现解决办法)
    {
      问题解决 = true;
      break;
    }
  }

  // 如果问题还没有解决,到技术支持论坛发问
  if(!问题解决)
  {
    try
    {
      askQuestion();
    } finally
    {
      thanks();
    }
  }

  // 如果还没有解决,可能就是因为你的基础知识不够,请拿出耐心仔细学习基础
  if(!问题解决 && You.struggling())
  {
    if(学习到解决问题的知识)
    {
      return;
    }
  } else
  {
    // 退出江湖
    quitRiversAndLakes();
  }
}

【技术转载】选择select的当前选项触发onchange事件

我们用Select的onchange事件时,常会遇到这样一个问题,那就是连续选相同一项时,不触发onchange事件.select的onchange事件就是这样子的.你得有Change(改变),才能触发该事件....

掌握了它的特性后,相应的解决办法也很简单.

<select name=sel onchange="bao(this.options[this.options.selectedIndex].value)">
<option value="">请选择
<option value="1">Item 1
<option value="2">Item 2
<option value="3">Item 3
</select>
<script>
function bao(s)
{
txt.value+=s;
//选择后,让第一项被选中,这样,就有Change啦.
document.all.sel.options[0].selected=true;
}
</script>
<textarea id=txt></textarea>