端午過后
1.什么是模式?
模式,即pattern。其實(shí)就是解決某一類問題的方法論。你把解決某類問題的方法總結(jié)歸納到理論高度,那就是模式。
Alexander給出的經(jīng)典定義是:每個模式都描述了一個在我們的環(huán)境中不斷出現(xiàn)的問題,然后描述了該問題的解決方案的核心。通過這種方式,你可以無數(shù)次地使用那些已有的解決方案,無需在重復(fù)相同的工作。
模式有不同的領(lǐng)域,建筑領(lǐng)域有建筑模式,軟件設(shè)計領(lǐng)域也有設(shè)計模式。當(dāng)一個領(lǐng)域逐漸成熟的時候,自然會出現(xiàn)很多模式。
什么是框架?
框架,即framework。其實(shí)就是某種應(yīng)用的半成品,就是一組組件,供你選用完成你自己的系統(tǒng)。簡單說就是使用別人搭好的舞臺,你來做表演。而且,框架一般是成熟的,不斷升級的軟件。
2.為什么要用模式?
因?yàn)槟J绞且环N指導(dǎo),在一個良好的指導(dǎo)下,有助于你完成任務(wù),有助于你作出一個優(yōu)良的設(shè)計方案,達(dá)到事半功倍的效果。而且會得到解決問題的最佳辦法。
為什么要用框架?
因?yàn)檐浖到y(tǒng)發(fā)展到今天已經(jīng)很復(fù)雜了,特別是服務(wù)器端軟件,設(shè)計到的知識,內(nèi)容,問題太多。在某些方面使用別人成熟的框架,就相當(dāng)于讓別人幫你完成一些基礎(chǔ)工作,你只需要集中精力完成系統(tǒng)的業(yè)務(wù)邏輯設(shè)計。而且框架一般是成熟,穩(wěn)健的,他可以處理系統(tǒng)很多細(xì)節(jié)問題,比如,事物處理,安全性,數(shù)據(jù)流控制等問題。還有框架一般都經(jīng)過很多人使用,所以結(jié)構(gòu)很好,所以擴(kuò)展性也很好,而且它是不斷升級的,你可以直接享受別人升級代碼帶來的好處。
框架一般處在低層應(yīng)用平臺(如J2EE)和高層業(yè)務(wù)邏輯之間的中間層。
軟件為什么要分層?
為了實(shí)現(xiàn)“高內(nèi)聚、低耦合”。把問題劃分開來各個解決,易于控制,易于延展,易于分配資源…總之好處很多啦:)。
3.以下所述主要是JAVA,J2EE方面的模式和框架:
常見的設(shè)計模式有什么?
首先,你要了解的是GOF的《設(shè)計模式--可復(fù)用面向?qū)ο筌浖幕A(chǔ)》一書(這個可以說是程序員必備的了),注意:GOF不是一個人,而是指四個人。它的原意是Gangs Of Four,就是“四人幫”,就是指此書的四個作者:Erich Gamma,Richard Helm,Ralph Johnson,John Vlissides。這本書講了23種主要的模式,包括:抽象工廠、適配器、外觀模式等。
還有其他的很多模式,估計有100多種。
軟件設(shè)計模式太多,就我的理解簡單說一下最常見的MVC模式。
MVC模式是1996年由Buschmann提出的:
模型(Model):就是封裝數(shù)據(jù)和所有基于對這些數(shù)據(jù)的操作。
視圖(View):就是封裝的是對數(shù)據(jù)顯示,即用戶界面。
控制器(Control):就是封裝外界作用于模型的操作和對數(shù)據(jù)流向的控制等。
另外:
RUP(Rational Unified Process)軟件統(tǒng)一過程,XP(Extreme Programming)極端編程,這些通常被叫做“過程方法”,是一種軟件項(xiàng)目實(shí)施過程的方法論,它是針對軟件項(xiàng)目的實(shí)施過程提出的方法策略。也是另一個角度的模式。
剛吃完飯,也沒啥事干,來寫寫blog吧
也許就像你看到的那樣,我寫的東西是比較偏的
先來舉個例子吧:
>>> var person=function(){}
>>> person.aa="aa"
"aa"
>>> person.bb="bb"
"bb"
>>> person.cc="cc"
"cc"
上面是定義了一個person類
給這個類添加了幾個類屬性
你單獨(dú)運(yùn)行
>>> person.cc
"cc"
那是沒問題的
但是你在程序中寫就有問題了,
看看下面的程序:
for(var t in person){
alert(t);
alert(person.t) //為什么這個就有問題呢,結(jié)果為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.
還沒寫完,待我醒來再細(xì)說!
晚上和位不認(rèn)識的朋友通話了
第一次
還聊的很投機(jī),
第一次
我今天晚上把頭發(fā)剪短了
第一次
兩個人對金錢的看法很相像
第一次
這么多第一次說明了什么
--------有緣
祝我有緣的朋友復(fù)試成功!
對于為什么要使用prototype來實(shí)現(xiàn)繼承,我就不說了,網(wǎng)上很多
下面主要是我對于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(){}
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. 產(chǎn)生, 導(dǎo)致, 發(fā)生
4:
bespoke [be·spoke || b?'sp??k]
adj. 預(yù)定的; 定制的
bespeak [be·speak || b?'spi?k]
v. 預(yù)定; 證明; 預(yù)約; 表示
5: ado
ado [a·do || ?'du?]
n. 紛擾, 騷擾; 費(fèi)力, 麻煩; 忙亂; 無謂的紛擾
6:effect
effect [ef·fect || ?'fekt]
n. 結(jié)果, 效果, 影響
v. 造成; 招致; 產(chǎn)生; 實(shí)現(xiàn), 達(dá)到
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. 妥協(xié), 折衷案, 折衷
v. 互讓解決; 放棄; 連累, 危及; 泄露; 妥協(xié), 讓步
11: inefficient
inefficient [,inef'fi·cient || ‚?n?'f??nt]
adj. 無效率的, 無能的
12: efficient
efficient [ef'fi·cient || -nt]
adj. 生效的; 能干的; 有效率的
自從從上家公司跳槽之后
戶口和檔案問題一直困擾著我,
當(dāng)然,如果我還在天津工作的話
應(yīng)該是沒什么問題
可我現(xiàn)在來到了北京
一個戶口很緊張的城市
而且我又不是研究生
所以落戶口是根本沒希望的
但是如果這些落不了
那有關(guān)的五險一金怎么辦
煩煩煩煩煩
昨天HR和我說
公司對于你們這樣的
有特批
也就是說什么都能上
哈哈哈哈哈哈哈哈哈
開心
http://picasaweb.google.com/ye.zhouquan
Function()的特殊之處有三點(diǎn):
1: Function() constructor 它是允許js引擎動態(tài)的去編譯和運(yùn)行,所以它很像全局的eval()。
【注】:可別小看這個eval(),它可是js的一個解釋器哦,嘿嘿!
2:正因?yàn)?nbsp;Function() constructor 是動態(tài)的去創(chuàng)建函數(shù)體,因此它會比直接function定義函數(shù)要消耗資源,
特別在循環(huán)中不推薦使用
3:這點(diǎn)也是 Function() constructor 最重要的一點(diǎn), Function() constructor 創(chuàng)建的函數(shù)是全局的,而不是相
應(yīng)得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"
這個周末生活比較豐富,當(dāng)然也沒學(xué)什么東西
周六是老鄉(xiāng)過來,中午請他吃的飯,晚上吃完飯
再送他回去,周天中午請大學(xué)同學(xué)王林霞吃飯,
下午一塊去打球了,然后去她同學(xué)那打了會麻將。
晚上和她那些高中同學(xué)一塊吃了個飯。回來洗了個
澡,和老陳聊了會天。OVER.