• look to the master,
    follow the master,
    walk with the master,
    see through the master,
    become the master.
  • The following are two general principles of organization:
    People must understand the organizational structure in which they are supposed to work.
    There has to be someone who can make final decisions. This is especially important if the project or company is in a crisis. If the ship goes down, the captain does not call for a meeting. Everyone must obey orders, know exactly where to go and what to do, and do it without argument.
  • 昨天冒着大雨和redwood跑去华储买回了cc2e。买的时候还是有些犹豫--这本书真是太重了。我们刚买完书出来,dreamhead打电话过来他在华储正在买这本书。:)感谢redwood帮我把这本书背回了家。
    拿到这本书我最大的期望是:我早在一年前能拿到这本书该是多么美妙的事情啊。
    "这个世界从来就不缺少十几岁的少年天才,而三十几岁的优秀软件设计师凤毛麟角"。
    我们重来都不缺少工程师,总是缺少尽可能多的优秀的工程师。任何想成为优秀工程师的人都不能容忍忽略这本书--cc2e的价值。(“最好是好的敌人”)
    我们深信,这本书就是献给那些愿意成为优秀软件构造者长期以来进行不断的努力、奉献、执著追求的人。只有这样的人,才能把这么一本“砖头”饶有兴趣的读下去、读完。

  • 1.j2ee提出了规范,给出了一个标准。On the other hand, I feel it has come up short on a number of measures.j2ee也确实降低了企业应用级项目的失败。
    2.任何规范和特定的实现都没有一个技术思想重要。如同重构的时机一样:OO原则,针对接口编程;将任何特定的规范已经实现尽量隐藏一般特性之后,比如ejb的接口隐藏在pojo之后。
    3.在我自己的技术选择中,几乎都是选择OpenSource社区的,很少受到规范驱动或者vendor驱动的影响。正好相反,也vendor driven才造就今天的我们。:)
    4.项目成功,检验架构的标准:
    simplicity
    productivity
    the fundamental importance of object orientation
    the primacy of business requirements
    the importance of empirical process
    the importance of testability
    5.一切皆来源于经验过程。spring比Expert One-on-One J2EE还要早。(没有working code就无法写出这本书。)springframework是Rod Johnson几个商业项目的经验而产生的。开发这个framework也应该是在模式大量复用中找到了突破点,如果一些模式大量的被复用,那么把这些模式的职责转嫁给framework来做,dry原则。当然,必须优先考虑模块化的原则,比方说对于log4j的如何集成到framework的方式。
    6.Architecture and implementation should always be undertaken with clear goals in mind.

    Productivity
    1.framework不断抽象,不断重构产生的,framework与代码生成的转换:If we see a requirement for boring repetitive code, we should apply an OO solution and abstract it into a framework,rather than generate it and live with the resulting duplication.
    2.代码生成技术在解决生产率中扮着十分重要的角色。在j2ee开发中涉及到代码生成的层次很多。从dll,database schema到jsp.
    3.There shouldn’t be vast amounts of repetitive plumbing code in J2EE applications.Better architectural choices and better frameworks can virtually eliminate such code,meaning that nearly all application code can be hand-authored.(注:framework形成的时机之一。)I’m not saying that code generation is a bad technology in general—merely that,when properly designed and built on appropriate frameworks, most J2EE applications should not contain enough boilerplate code to justify it and outweigh its negatives.
    4.关于代码生成以及MDA作者的观点:The natural path of our industry is toward higher levels of abstraction. Perhaps one day MDA-powered code generation will prove to be an appropriate abstraction. However, I feel that this is 10–15 years away, if it ever happens.
    5.Better Solutions for Higher Productivity:
    Architecture
        Avoid unnecessary architectural complexity.
        Avoid unnecessary use of EJB.
        Use abstraction layers to hide the complexity of core J2EE and J2SE APIs.
        If possible, use an O/R mapping product to simplify the persistence layer.
        Use a good application framework.  

    Focus and methodology
        Focus! Know what problems you should be solving, and concentrate on them.
        Use a reference architecture and start from a template application.
        Use an agile development process.

    Use appropriate tools.
    6.Different developers do the same thing in different ways, wasting
    valuable development time and complicating maintenance.程序设计始终要做的就是不发生这样的事情。
    7.Know What Problems to Solve 生产率即是知道要解决得是什么问题,将主要是domain problems而不是generic problems.
    8.Use Reference Architectures and Templates一旦选择了技术,将着手reference architecture.begin work using a skeleton application that establishes the overall plumbing.
    9.And remember that the more upfront effort before arriving at a working prototype, the greater the risk of inadequate performance or an unworkable architecture. 项目组也应该精化,微型化。
    10.J2EE developers are fortunate in that all these requirements can be met by free, open source tools, such as Eclipse, JUnit, Ant, a good Eclipse XML plugin, CVS, and the standard Eclipse JUnit and CVS integration.

    OO
    1.本身OO是一种范式,是一个模型,在SICP中对于讲到代换模型的理论:In general, when modeling phenomena in science and engineering, we begin with simplified, incomplete models. As we examine things in greater detail, these simple models become inadequate and must be replaced by more refined models.关于OO的讨论算是一个检查考虑问题的讨论。
    2.作者提出的实践中运用oo的四个方面:封装domains concepts;运用polymorphism将共性和差异分离;代码复用;extensibility.
    3.j2ee应用的对象常常都是一些fake objects,即是不具备objects的某些特征:identity,state,behavior.
    4.oo针对接口编程的优点和误区。

    The importance of business requirements
    1.这个问题因不同的角色而已。就我而言,如同我一样的普通程序员,对于generic technical problems常常都是难题,故而在这方面的需要长足的学习和提高的;对于我们而言,我们domain problems就是如何具备了generic technical方面的强大能力只是第一步。
    The Importance of an Empirical Process
    1.Always develop a vertical slice to validate your application’s architecture early in the project. Don’t trust our advice or anyone else’s without establishing that it’s appropriate to your needs.验证自己的想法。

  • 2005-08-28

    javabean

    Tag:Java

    使用javabean已经很久了,但是很少去研究和使用jdk中的java.beans包和java.beans.beancontext包。
    时间和空间这个计算机的永恒话题,也一直是设计的折衷话题。记得刚开始写javabean的时候,对象的set get都是一行一行代码的手写。一次几十个方法下来,而且复制粘贴,复杂,维护修改都很费力。
    现在apache jakarta commons的子项目已经有一些解决方案了,主要在包org.apache.commons.beanutils中,使用可以参见Test Case和《Jakarta Commons Cookbook》。当然,有时候也需要我们自己根据自己的应用编写自己的处理javabean的代码。今天正好看到了一些java.beans的代码,罗列如下:
    java.beans.Introspector
     public static String decapitalize(String name) {
      if (name == null || name.length() == 0) {
       return name;
      }
      if (name.length() > 1 && Character.isUpperCase(name.charAt(1)) && Character.isUpperCase(name.charAt(0))) {
       return name;
      }
      char chars[] = name.toCharArray();
      chars[0] = Character.toLowerCase(chars[0]);
      return new String(chars);
     }
    java.beans.PropertyDescriptor
     public PropertyDescriptor(String propertyName, Class beanClass) throws IntrospectionException {
      if (propertyName == null || propertyName.length() == 0) {
       throw new IntrospectionException("bad property name");
      }
      setName(propertyName);
      String base = capitalize(propertyName);

      // Since there can be multiple setter methods but only one getter
      // method, find the getter method first so that you know what the
      // property type is. For booleans, there can be "is" and "get"
      // methods. If an "is" method exists, this is the official
      // reader method so look for this one first.
      try {
       readMethod = Introspector.findMethod(beanClass, "is" + base, 0);
      } catch (Exception getterExc) {
       // no "is" method, so look for a "get" method.
       readMethod = Introspector.findMethod(beanClass, "get" + base, 0);
      }
      Class params[] = { readMethod.getReturnType() };
      writeMethod = Introspector.findMethod(beanClass, "set" + base, 1, params);
      propertyType = findPropertyType(readMethod, writeMethod);
     }
    (注:代码格式为eclipse默认设置)
       我没有读过javabean的规范,今天针对javabean的使用和操作随处可见,也算是Rod Johnson所说的fake object了。如果javabean的property命名不符合规范,就有可能出错,一旦这种错误被framework捕获了还没有throw给应用,那么发现这种命名错误就更困难了。

    如今我会优先选择commons-beanutils和jdk的java.beans对java bean进行操作。