穷小子

MajorYe
数据加载中……

2008年4月17日

端午过后

posted @ 2008-06-09 21:20 MajorYe 阅读(166) | 评论 (0)编辑 收藏
Pattern & FrameWork

1.什么是模式?

模式,即pattern。其实就是解决某一类问题的方法论。你把解决某类问题的方法总结归纳到理论高度,那就是模式。

Alexander给出的经典定义是:每个模式都描述了一个在我们的环境中不断出现的问题,然后描述了该问题的解决方案的核心。通过这种方式,你可以无数次地使用那些已有的解决方案,无需在重复相同的工作。

模式有不同的领域,建筑领域有建筑模式,软件设计领域也有设计模式。当一个领域逐渐成熟的时候,自然会出现很多模式。

什么是框架?

框架,即framework。其实就是某种应用的半成品,就是一组组件,供你选用完成你自己的系统。简单说就是使用别人搭好的舞台,你来做表演。而且,框架一般是成熟的,不断升级的软件。

2.为什么要用模式?

因为模式是一种指导,在一个良好的指导下,有助于你完成任务,有助于你作出一个优良的设计方案,达到事半功倍的效果。而且会得到解决问题的最佳办法。

为什么要用框架?

因为软件系统发展到今天已经很复杂了,特别是服务器端软件,设计到的知识,内容,问题太多。在某些方面使用别人成熟的框架,就相当于让别人帮你完成一些基础工作,你只需要集中精力完成系统的业务逻辑设计。而且框架一般是成熟,稳健的,他可以处理系统很多细节问题,比如,事物处理,安全性,数据流控制等问题。还有框架一般都经过很多人使用,所以结构很好,所以扩展性也很好,而且它是不断升级的,你可以直接享受别人升级代码带来的好处。

框架一般处在低层应用平台(如J2EE)和高层业务逻辑之间的中间层。

软件为什么要分层?

为了实现“高内聚、低耦合”。把问题划分开来各个解决,易于控制,易于延展,易于分配资源…总之好处很多啦:)。

3.以下所述主要是JAVA,J2EE方面的模式和框架:

常见的设计模式有什么?

首先,你要了解的是GOF的《设计模式--可复用面向对象软件的基础》一书(这个可以说是程序员必备的了),注意:GOF不是一个人,而是指四个人。它的原意是Gangs Of Four,就是“四人帮”,就是指此书的四个作者:Erich Gamma,Richard Helm,Ralph Johnson,John Vlissides。这本书讲了23种主要的模式,包括:抽象工厂、适配器、外观模式等。

还有其他的很多模式,估计有100多种。

软件设计模式太多,就我的理解简单说一下最常见的MVC模式。

MVC模式是1996年由Buschmann提出的:

模型(Model):就是封装数据和所有基于对这些数据的操作。

视图(View):就是封装的是对数据显示,即用户界面。

控制器(Control):就是封装外界作用于模型的操作和对数据流向的控制等。

另外:

RUP(Rational Unified Process)软件统一过程,XP(Extreme Programming)极端编程,这些通常被叫做“过程方法”,是一种软件项目实施过程的方法论,它是针对软件项目的实施过程提出的方法策略。也是另一个角度的模式。

posted @ 2008-05-03 11:58 MajorYe 阅读(155) | 评论 (0)编辑 收藏
object.property与object["property"]的区别

刚吃完饭,也没啥事干,来写写blog吧
也许就像你看到的那样,我写的东西是比较偏的
先来举个例子吧:
>>> var person=function(){}
>>> person.aa="aa"
"aa"
>>> person.bb="bb"
"bb"
>>> person.cc="cc"
"cc"
上面是定义了一个person类
给这个类添加了几个类属性
你单独运行

>>> person.cc
"cc"
那是没问题的
但是你在程序中写就有问题了,
看看下面的程序:
for(var t in person){
alert(t);
alert(person.t)  //为什么这个就有问题呢,结果为undefined
}
但该为
for(var t in person){
alert(t);
alert(person.[t])  //这样就可以了
}
为什么呢????

The important difference to note between these two syntaxes is that in the first, the property name is an identifier, and in the second, the property name is a string. You'll see why this is so important shortly.

In C, C++, Java, and similar strongly typed languages, an object can have only a fixed number of properties, and the names of these properties must be defined in advance. Since JavaScript is a loosely typed language, this rule does not apply: a program can create any number of properties in any object. When you use the . operator to access a property of an object, however, the name of the property is expressed as an identifier. Identifiers must be typed literally into your JavaScript program; they are not a datatype, so they cannot be manipulated by the program.

On the other hand, when you access a property of an object with the [] array notation, the name of the property is expressed as a string. Strings are JavaScript datatypes, so they can be manipulated and created while a program is running.
还没写完,待我醒来再细说!

posted @ 2008-04-21 12:19 MajorYe 阅读(363) | 评论 (1)编辑 收藏
祝复试成功

晚上和位不认识的朋友通话了
第一次
还聊的很投机,
第一次
我今天晚上把头发剪短了
第一次
两个人对金钱的看法很相像
第一次
这么多第一次说明了什么
      --------有缘
祝我有缘的朋友复试成功!

posted @ 2008-04-18 23:30 MajorYe 阅读(168) | 评论 (0)编辑 收藏
Prototype的一些新的见解(JS)

对于为什么要使用prototype来实现继承,我就不说了,网上很多
下面主要是我对于prototype的一些见解:
// The constructor function initializes those properties that
// will be different for each instance.
function Rectangle(w, h) {
    this.width = w;
    this.height = h;
}

// The prototype object holds methods and other properties that
// should be shared by each instance.
Rectangle.prototype.area = function( ) { return this.width * this.height; }

var r = new Rectangle(2, 3);
r.hasOwnProperty("width");   // true: width is a direct property of r
r.hasOwnProperty("area");    // false: area is an inherited property of r
"area" in r;                 // true: "area" is a property of r
>>> function pp(){}
>>> pp.prototype.p="33"
"33"
>>> var t=new pp()
>>> tt.p
tt is not defined
[Break on this error] undefined
javascript: with ... (line 1)
>>> t.p
"33"
>>> t.p="44"
"44"
>>> t.p
"44"
>>> var tt=new pp()
>>> tt.p
"33"
>>> pp.prototype.constructor
pp()
>>> tt.constructor
pp()
>>> tt.prototype.constructor
tt.prototype has no properties
[Break on this error] undefined
javascript: with ... (line 1)
>>> tt.prototype.oo="22"
tt.prototype has no properties
[Break on this error] undefined
javascript: with ... (line 1)
>>> "p" in tt
true
>>> tt.hasOwnProperty
hasOwnProperty()
>>> tt.hasOwnProperty("p")
false
>>> tt.tt=0
0
>>> tt.hasOwnProperty("tt")
true
//从我的firebug调试中你能看出来吗?嘿嘿

posted @ 2008-04-18 11:25 MajorYe 阅读(185) | 评论 (0)编辑 收藏
08-04-18英语学习总结

1: delve

delve a little into the history of how it came to be like that

delve [delv]

v. 探究, 钻研; , ; 搜索; , ;

2: sooner or later

3: generated

we first need to remind ourselves why XML has proved such a success and generated so much excitement.

generate [gen·er·ate || 'dʒenəreɪt]

v. 产生, 导致, 发生

4:

bespoke [be·spoke || bɪ'spəʊk]

adj. 预定的; 定制的

bespeak [be·speak || bɪ'spiːk]

v.                  预定; 证明; 预约; 表示

5: ado

ado [a·do || ə'duː]

n. 纷扰, 骚扰; 费力, 麻烦; 忙乱; 无谓的纷扰

6effect

effect [ef·fect || ɪ'fekt]

n. 结果, 效果, 影响

v. 造成; 招致; 产生; 实现, 达到

7: bewildering

Don't worry if this example seemed a bit bewildering

bewilder [be·wil·der || bɪ'wɪldə]

v. 使迷惑; 使昏乱; 使不知所措

8: minimizes

This minimizes the work that needs to be done at display time and is ideal when the same displayed page is presented to very many users.

minimize (Amer.) ['min·i·mize || 'mɪnɪmaɪz]

v.                  ...减到最少

9:occasionally

It's occasionally useful to have a stylesheet as the input or output of a transformation.

occasionally [oc'ca·sion·al·ly || ə'keɪʒnəlɪ]

adv. 偶尔, 间或

10: compromise

The xhtml output method, as one might expect, is a compromise between the xml and html output methods

compromise [com·pro·mise || 'kɒmprəmaɪz]

n. 妥协, 折衷案, 折衷

v. 互让解决; 放弃; 连累, 危及; 泄露; 妥协, 让步

11: inefficient

inefficient [,inef'fi·cient || ‚ɪnɪ'fɪʃnt]

adj. 无效率的, 无能的

12: efficient

efficient [ef'fi·cient || -nt]

adj. 生效的; 能干的; 有效率的

posted @ 2008-04-18 09:14 MajorYe 阅读(450) | 评论 (0)编辑 收藏
毕业后,有关的档案和户口问题

自从从上家公司跳槽之后
户口和档案问题一直困扰着我,
当然,如果我还在天津工作的话
应该是没什么问题
可我现在来到了北京
一个户口很紧张的城市
而且我又不是研究生
所以落户口是根本没希望的
但是如果这些落不了
那有关的五险一金怎么办
烦烦烦烦烦
昨天HR和我说
公司对于你们这样的
有特批
也就是说什么都能上
哈哈哈哈哈哈哈哈哈
开心

posted @ 2008-04-18 08:48 MajorYe 阅读(180) | 评论 (0)编辑 收藏
我的网络相册

http://picasaweb.google.com/ye.zhouquan

posted @ 2008-04-17 18:06 MajorYe 阅读(158) | 评论 (0)编辑 收藏
javascript中Function与function的特殊之处

Function()的特殊之处有三点:
1: Function() constructor 它是允许js引擎动态的去编译和运行,所以它很像全局的eval()。
   【注】:可别小看这个eval(),它可是js的一个解释器哦,嘿嘿!
2:正因为 Function() constructor 是动态的去创建函数体,因此它会比直接function定义函数要消耗资源,
      特别在循环中不推荐使用
3:这点也是 Function() constructor 最重要的一点, Function() constructor 创建的函数是全局的,而不是相
   应得scope里面的
   eg:
  var y = "global";
  function constructFunction() {
     var y = "local";
    return new Function("return y");  // Does not capture the local scope!
}
// This line displays "global" because the function returned by the
// Function() constructor does not use the local scope. Had a function
// literal been used instead, this line would have displayed "local".
alert(constructFunction()());  // Displays "global"

posted @ 2008-04-17 18:03 MajorYe 阅读(411) | 评论 (0)编辑 收藏