You are on page 1of 41

CODE CONVENTION (Chun vit code v thit k giao din)

H Ni, Ngy 11/02/2011

I. 1. 2. 3. 4. II. 1. 2. 3. 4. 5. 6. 7. 8. III. 1. 2. 3. 4. 5. IV. 1. 2. 3.

M U .................................................................................................................... 4 Mc ch ............................................................................................................... 4 Phm vi ................................................................................................................. 4 Thut ng v vit tt ............................................................................................. 4 Tham kho ............................................................................................................ 4 CHUN VIT CODE TRONG C# ............................................................................... 5 Quy tc t tn ...................................................................................................... 5 Vng lp. ............................................................................................................... 8 lp trnh hng i tng....................................................................................... 8 Ngoi l................................................................................................................. 9 S kin.(Events) .................................................................................................. 10 Bin v kiu d liu(Various data types) ................................................................ 11 Khun dng code. ................................................................................................ 13 Ghi ch. .............................................................................................................. 13 CHUN VIT CODE TRONG SQL SERVER. .............................................................. 15 Chun t tn trong SQL SERVER. ........................................................................ 15 Chun vit m ngun trong SQL Server. ................................................................ 17 Kiu d liu. ........................................................................................................ 18 Th tc. .............................................................................................................. 18 Cc cn nhc khi vit lnh(Performance considerations) ......................................... 19 CHUN VIT CODE TRONG ORACLE PL/SQL. ......................................................... 20 Chun t tn trong ORACLE PL/SQL. ................................................................... 20 Khun dng code. ................................................................................................ 21 S dng ngn ng.(Language Usage). .................................................................. 22 1.1 1.2 X l ngoi l. .............................................................................................. 26 i tng lu tr. ........................................................................................ 27

V. 1.

CHUN THIT K GIAO DIN. .............................................................................. 28 Chun thit k giao din Winform. ........................................................................ 28 1.1 Chun t tn trong Winform. ....................................................................... 28

1.2 1.2 2.

Chun thit k giao din cc thnh phn control ca WinForm. ....................... 29 Chun thit k giao din cc thng bo(Message). ......................................... 32

Chun thit k giao din Webform. ....................................................................... 33 2.1 2.2 2.3 Chun t tn cc thnh phn control ca ASP.NET. ...................................... 33 Tiu chun ti u. ........................................................................................ 34 Tiu chun v hin th. ................................................................................. 34

I.

M U 1. Mc ch

Mc ch ca ti liu l hng dn thi hnh vit m v thit k giao din Winform v Webform theo quy c v chun ho s trnh by m ngun v thit k giao din ca cc developer .

2. Phm vi
S dng ni b

3. Thut ng v vi t tt
Thut ng Din gii

4. Tham kho
STT Ti liu

II.

C HUN VIT CODE TRONG C# 1. Quy tc t tn


1. S dng ting Anh khai bo tn. V d: magnetization, optimizing, realize, ... 2. S dng kiu Pascal v Camel t tn. Vi kiu Pascal ch ci u tin ca mi t c vit hoa. V d: BackColor. Vi kiu Camel ch ch ci ca t th 2, th 3, c vit hoa. V d: backColor. 3. S dng kiu Pascal cho tn lp. V d: public class HelloWorld { ... } 4. S dng kiu Pascal cho tn phng thc. V d: void SayHello(string name) { ... } 5. S dng kiu Camel cho tn bin v tham s ca phng thc. V d: int totalCount = 0; void SayHello(string name) { string fullMessage = "Hello " + name; ... } 6. S dng tin t I vi kiu Pascal cho cc giao din. V d: Ientity, IExportProvider 7. Khng s dng k hiu Hungary cho tn bin. V d: Sai: string m_sName; int nAge;

ng: string name; int age; 8. S dng t c ngha m t cho bin v khng s dng t vit tt. V d: ng: string address int salary Sai: string nam string addr 9. Khng s dng ch ci n t tn v d nh i, n, s Trng hp ngoi l l khi n c s dng trong vng lp. V d: for ( int i = 0; i < count; i++ ) { ... } 10. Khng s dng du gch di _ cho tn bin cc b 11. Tt c cc bin thnh vin u c bt u bng du gch di m_ phn bit vi bin cc b. Phn cn li ca tn bin c s dng c php Pascal 12. Khng s dng tn bin trng vi cc t kha. 13. Thm tin t is cho tn bin, phng thc v thuc tnh Boolean. V d: private bool isFinished 14. Phng thc tr v gi tr nn c tn m t gi tr c tr v. V d: GetObjectState(). 15. Cc bin thnh vin nn c khai bo trn cng v trn tng dng tch bit. 16. Khai bo bin cc b gn ni u tin n c s dng. 17. Tn ca khng gian(namespace) tn phi theo khun dng chun sau: <company name>.<product name>.<top level module>.<bottom level module> 18. Quy nh t tn cho cc thnh phn giao din ca Winform . cch t tin t theo bng sau:
Coltrol Tin t

Label

lbl

TextBox

txt

DataGrid

dtg

Button

btn

ImageButton

imb

Hyperlink

hlk

DropDownList

ddl

ListBox

lst

DataList

dtl

Repeater

rep

Checkbox

chk

CheckBoxList

cbl

RadioButton

rdo

RadioButtonList

rbl

Image

img

Panel

pnl

PlaceHolder

phd

Table

tbl

Validators

val

19. Tn tp tin phi ph hp vi tn lp. V d: class HelloWorld th tn tp tin l HelloWorld.cs

20. S dng kiu Pascal cho tn tp tin. 21. Khng s dng cc ch ci c th b ln vi ch s v ngc li. V d: Khng vit : bool b001 = (lo == l0) ? (I1 == 11) : (lOl != 101);

2. Vng lp.
1. Khng thay i gi tr bin lp trong vng lp For: Cp nht cc bin lp trong vng lp thng gy nhm ln thm ch s cn t hn nu bn thay i bin lp ti hn mt v tr. Lut ny p dng cho c vng lp Foreach. 2. Thay i gi tr bin lp gn ni iu kin ca vng lp c ch nh. 3. Tt c cc iu khin If, Else, While, Do, Swicth phi c theo sau bi mt cp du ngoc nhn ({ }) ngay c khi trong thn n rng. V d: // Count number of elements in array. for (int i = 0; i < y; i++) { } Ngoi l: Nu cu lnh else c th trc tip theo sau mt cu lnh if . Nu mnh if theo sau bi mt cu lnh n th khng cn t n trong mt khi v ton b cu lnh s c vit trn mt dng. V d: if (x < 10) x = 0; 4. Tt c cc khi lnh switch u phi c nhn Default nh l nhn Case cui cng. 5. Khng so snh r rng iu kin l ng hay sai. V d: while (condition == false) // Sai while (condition != true) while (condition) // Sai while (((condition == true) == true) == true //Sai // ng

3. lp trnh hng i tng


1. Cung cp mt b khi dng mc nh Private nu ch c phng thc v thuc tnh tnh (static) trong lp. Ngoi l:

+ Nu lp c khai bo l Static th khng yu cu to b khi dng private. + Khi mt lp c khai bo l abstract khi mt b khi dng protected c yu cu. 2. Cu lnh If - Else v Switch s c s dng khi vng lp ph thuc vo gi tr ca i tng. Rng buc ng s c s dng khi vng lp ph thuc vo loi ca i tng.

4. N goi l
1. Khng bao gi a ra mt Catch Exception m khng lm g c. Nu bn che giu mt ngoi l bn s khng bao gi bit mt ngoi l c xy ra hay khng. Rt nhiu nh pht trin s dng phng php ny b qua cc li khng ng k. Nn trnh cc ngoi l bng cch kim tra tt c cc li iu kin lp trnh. Trong mi trng hp bt mt ngoi l m khng lm g c l khng c php. 2. Trong trng hp ngoi l hy a ra mt thng bo thn thin ti ngi s dng. a ra ch tit nht cc thng tin v li(nu c th). 3. Ch bt ngoi l c th khng phi chung chung. V d: Tt: void ReadFromFile ( string fileName ) { try { // read from file. } catch (FileIOException ex) { // log error. // case. throw; } } Khng tt: void ReadFromFile ( string fileName ) { try { 9 re-throw exception depending on your

// read from file. } catch (Exception ex) { // Catching general exception is bad... we will never know whether // it was a file error or some other error. // Here you are hiding an exception. // In this case no one will ever know that an exception happened. return ""; } } 4. Khng cn bt mt ngoi l chung trong tt c cc phng th c. iu ny s gip bn tm thy hu ht cc li trong chu k pht trin. 5. Khng vit khi Try-Catch trong tt c cc phng thc. Ch dng khi c th c mt ngoi l xy ra v khng c cch no ngn chn. V d, nu bn mun chn thm mt bn ghi m n cha tn ti trong CSDL, bn nn Select bn ghi s dng kha. Mt s nh pht trin c gng thm mt bn ghi m khng kim tra xem n tn ti hay cha, nu ngoi l xy ra, n s cho rng bn ghi tn ti. iu ny khng c php. Bn nn kim tra cc li hn l ch i mt ngoi l xy ra. Mt khc, bn nn s dng b x l ngoi l khi bn lm vic vi h thng bn ngoi nh mng li, thit b phn cng,.. Cc h thng nh vy thng tht bi bt c lc no v kim tra li khng ng tin cy. Trong nhng trng hp ny bn nn s dng b x l ngoi l v c gng khc phc li. 6. Khng nn vit mt khi Try-Catch ln. Nu cn thit ch vit mi khi Try Catch cho mt cng vic m bn thc hin . iu ny gip bn d dng tm c on m ngun no ca bn a ra ngoi l a ra thng bo cho ngi dng . 7. Ch a ra ngoi l trong trng hp c bit. 8. Khng dng khi Try- Catch cho vng lp. 9. Khng lng mt khi Try Catch trong mt khi catch khc.

5. S kin.( Events)
1. Lun lun kim tra th hin ca mt s kin c null khng trc khi gi. 2. Lun s dng mc nh EventHandler v EventArgs cho hu ht nhng s kin n gin.

10

6. Bin v kiu d liu(Various data types)


1. S dng kiu enum bt c ni no cn thit, khng dng kiu s v kiu chui ch ra cc gi tr ring r. V d: Tt: enum MailType { Html, PlainText, Attachment } void SendMail (string message, MailType mailType) { switch ( mailType ) { case MailType.Html: // Do something break; case MailType.PlainText: // Do something break; case MailType.Attachment: // Do something break; default: // Do something break; } }

Khng tt: void SendMail (string message, string mailType) { switch ( mailType ) { case "Html": // Do something break; 11

case "PlainText": // Do something break; case "Attachment": // Do something break; default: // Do something break; } } 2. C gng khi to bin ti ni m bn khai bo chng. 3. Lun s dng b danh ca kiu d liu c xy dng trong C# hn l dng ca h thng kiu chung ca .NET. V d: short khng dng System.Int16 int khng dng System.Int32 long khng dng System.Int64 string khng dng System.String 4. Khai bo cc bin thnh vin kiu Private. S dng cc thuc tnh truy cp cung cp kh nng truy cp ti chng nh Public, Protect, Internal. 5. Ch s dng kiu long cho cc bin c kh nng cha ng gi tr ln hn kiu int. 6. S dng kiu double cho phn s m bo chnh xc tr ong tnh ton. 7. S dng kiu int cho nhng gi tr s khng phi phn s, cc bin s ph hp vi kiu d liu int ngay c khi bin dng cho mt s khng m. 8. S dng kiu float cho cc phn s khi n khng ph hp vi kiu double hay Decimal. 9. Trnh s dng kiu float tr khi bn hiu r cc tc ng khi c s tnh ton . 10. S dng kiu decimal cho phn s khi n cn c lm trn ti mt chnh xc nht nh tnh ton. in hnh cc tnh ton lin quan n tin bc. 11. Trnh ch nh kiu c th cho mt enum, s dng kiu mc nh l int tr khi bn c nhu cu c th v vic s dng kiu long(rt him). 12. Ch khai bo hng (constants) cho nhng loi n gin. 13. Trnh chuyn i trc tip thay vo s dng t kha as v kim tra null. V d: object dataObject = LoadData(); DataSet ds = dataObject as DataSet; if(ds != null) 12

{} 14. Khng bao gi ghp chui trong vng lp

7. Khun dng code.


1. Lun t 2 du ngoc nhn({ v }) trn mt dng mi. 2. Lun s dng 2 du ngoc nhn ({ v }) trong cu lnh iu kin. 3. Khai bo cc bin c lp trn tng dng tch bit. 4. t cc Namespace dng using trn u ca file. Nhm cc Namespace .NET trn cc Namespace ty bin (custom namespace). 5. Nhm ni dung trong thn lp theo th t nh sau: Bin thnh vin. Constructors v Finalizers. Enums, Structs v Class c lng vo. Thuc tnh. Phng thc.

6. S dng #region nhm cc phn code c lin quan ti nhau. 7. S dng Tab tht u dng khng dng backspace. Kch thc mc nh ca Tab l 4. 8. S dng mt dng trng phn chia nhm m ngun c cng logic. 9. Ch nn c mt dng trng tch bit 2 phng thc trong mt lp.

8. Ghi ch.
1. Tt c cc ghi ch nn c vit bng cng ngn ng (ting Anh), ng ng php v cha cc du cu thch hp. 2. Dng k hiu // hoc /// khng dng /*.*/. 3. Khng dng nhiu du sao * cho khi comment. V d: //****************** //Comment block //****************** 4. Comment nn c vit cng mc tht u dng vi code. V d: Tt: // Format a message and display string fullMessage = "Hello " + name; DateTime currentTime = DateTime.Now; string message = fullMessage + ", the time is : " + currentTime.ToShortTimeString(); MessageBox.Show ( message ); 13

Khng tt: // Format a message and display string fullMessage = "Hello " + name; DateTime currentTime = DateTime.Now; string message = fullMessage + ", the time is : " + currentTime.ToShortTimeString(); MessageBox.Show ( message ); 5. Lun lun dng khi comment C# (///) cho thuc tnh truy cp Public, Protected, v Internal. 6. Lun dng ch thch <summary> bao gm <param>, <return> v <exception> bt c ni no c th. 7. Lun dng <see cref = /> v <seealso cref = /> nu c th.

14

III.

CHUN VIT CODE TRON G SQL SERVER.

1. Chun t tn trong SQL SERVER.


1. Bng. Tn bng nn c t theo tn ca thc th m n i din. v d thc th customer nn t tn bng l customers. Nu trong C s d liu ca bn c nhng bng c cng logic bn nn nhm chng vo mt nhm s dng tin t gm t 2 ti 3 k t. V d: C s d liu ca bn c cc bng lu thng tin v Sales v Human bn gp chng thnh 2 nhm nh sau: SL_NewLeads SL_Territories SL_TerritoriesManagers v HM_Candidates HM_PremierInstitutes HM_InterviewSchedules Tn bng nn c vit bng ting Anh v khng c khong trng trong t n. Quy tc t tn view tng t nh vi bng tr mt s ngoi l sau. View khng ch i din cho mt bng n l. Mt view c th l lin kt d liu ca 2 hay nhiu bng vi mt iu kin lin kt . V th trong trng hp ny nn xem xt ti vic ni tn ca cc bng c s lm tn View. V d: Mt view c ly d liu t 2 bng Customer v bng Address vy tn view s tng ng l CustomerAddress. 3. Th tc. Tn th tc c vit lin bng ting Anh. Tn th tc nn s dng cc ng t m t hnh ng m n thc hin. V d: 'GetCustomerDetails'. Ging nh trnh by vi quy tc t tn bng, bn c th nhm cc th tc c cng nhm logic vo mt nhm s dng tin t. V d c cc th tc x l vn lin quan ti bng Order bn c th vit: ORD_InsertOrder ORD_InsertOrderDetails ORD_ValidateOrder Khng nn t tn th tc vi tin t sp_, tin t tn ny ginh ring cho th tc h thng. 4. Trigger. Tn trigger c vit lin bng ting Anh. Tn trigger nn c s lin h vi tn bng m n ph thuc. 15 2. View.

Tn trigger nn c cc k t th hin loi ca n. Insert ins, Update upd, Delete del. V d sau l cc trigger ph thuc bng titles titles_instrg titles_updtrg titles_deltrg

Nu trigger ca bn thc hin hn 2 cng vic v nh insert v update bn vit: titles_InsUpdtrg

5. Index. Ging trigger index khng t tn ti mt mnh m ph thuc mt bng c s. v th tn index nn bao gm tn bng v tn ct m n c to cho. Index c hai loi Clustered v Nonclustered hai loi ny c th l unique hoc non-unique v th tn ca index cng nn quan tm ti loi index. Cu trc tn ca index nh sau: Tn bng + tn ct + U/NU+ Cidx/Nidx Trong : + U: Unique. + NU: Non Unique. + Cidx: Clustered index. + Nidx: Non clustered index. v d 1: index thuc loi unique clustered Titles_TitleID_U_Cidx V d 2: index thuc loi noncluster v nonunique OrderDetails_OrderID_NU_Nidx Index c th c to ra trn nhiu ct trong trng hp ny bn ni tn cc ct li vi nhau. V d: OrderDetails_OrderIDOrderDetailID_U_Cidx Index trn c to ra trn 2 ct OrderID, OrderDetailID 6. Ct. Tn ct c vit bng ting Anh khng c khong trng. Tn ct cn c ngha v khi qut c ni dung ca ct. V d: Name Address 7. Kha chnh. Tn kha chnh theo cu trc: Tn bng + ID V d: 16

CustomersID 8. Kha ngoi Tn kha ngoi c vit theo cu trc: Tn bng c tham chiu+kha chnh. 9. Rng buc Default v rng buc Check Tn rng buc Default c tin t DEF+ tn ct. Tn rng buc check c tin t CHK + tn ct.

2. Chun vi t m ngun trong SQL Server.


1. Code cn d c v c khun kh r rng. Vit ch thch trong th tc, trigger v cc khi lnh SQL bt c khi no c vn khng rnh mch. iu ny gip cc lp trnh vin khc c th hiu c code ca bn. Lun s dng Tab tht u dng khi cn thit gip vic c m ngun c d dng. Lun thng nht trong vic s dng ch in hoa v in thng trong vic t tn cho i tng v khi s dng tn trong mt th tc, trigger, V d: Khi bn to mt bng vi tn MyTable khi vit trong cu select bn nn vit : SELECT * FROM MyTable. Khng dng s ca ct trong mnh ORDER. S khin code kh hiu. SELECT OrderID, OrderDate FROM Orders ORDER BY 2 V d 2: SELECT OrderID, OrderDate FROM Orders ORDER BY OrderDate S dng mnh join chun ANSI thay th chov kiu join c. Vi kiu join ANSI mnh WHERE ch s dng cho d liu lc. vi kiu join c hn mnh WHERE s dng x l c iu kin Join v d liu lc. V d 1 cho kiu join ANSI, v d 2 cho kiu join c hn. V d 1: SELECT a.au_id, t.title FROM authors a INNER JOIN titleauthor ta ON a.au_id = ta.au_id 17 V d 1:

INNER JOIN titles t ON ta.title_id = t.title_id WHERE t.title LIKE '%Computer%' V d 2: SELECT a.au_id, t.title FROM titles t, authors a, titleauthor ta WHERE a.au_id = ta.au_id AND ta.title_id = t.title_id AND t.title LIKE '%Computer%' - cu lnh SQL d c vit mi mnh trn mt dng mi v tht u dng nu cn thit. V d: SELECT title_id, title FROM titles WHERE title LIKE '%Computer%' AND title LIKE '%cook%' Khng s dng Go to hoc hn ch ti mc ti thiu v dng nhiu gy kh c v kh hiu. Lun vit tn ct cn insert trong cu lnh INSERT trnh sai st khi c s thay i cu trc ca bng.

3. Kiu d liu.
S dng kiu d liu CHAR cho mt ct ch khi ct khng th null. S dng kiu d liu Unicode NCHAR, NVARCHAR hoc NTEXT nu c s d liu ca bn khng ch lu tr cc k t ting Anh. Ch s dng kiu d liu Unicode khi thc s cn thit v n chim gp hai ln khng gian khng b nh so vi kiu d liu khng phi Unicode. C gng khng dng kiu d liu TEXT v NTEXT lu mt khi lng ln d liu vn bn.

4. Th tc.
Khng gi hm lin tc trong mt th tc, trigger, mt hm hay mt l (batches) khc. V d bn cn ly chiu di ca mt bin kiu string ti nhiu ni trong th tc. Thay v gi hm LEN nhiu ln bn gi hm mt ln duy nht v lu kt qu vo mt bin cho ln sau s dng.

18

Nu th tc ca bn lun tr v mt tp kt qu l hng n nn xem xt ti vic s dng tham s OUTPUT tr v tp kt qu thay v s dng cu lnh SELECT.

Khng t tn th tc vi tin t SP_, tn ny ginh ring cho th tc h thng

5. Cc cn nhc khi vit lnh(Performance considerations)


Khng dng SELECT * trong cu truy vn m vit chnh xc tn ct bn cn ly ra sau cu SELECT. Trnh s dng bng tm hoc s dng mc ti thiu. Trnh s dng k t i din ti u ca mt t khi tm kim vi t kha nh LIKE. Hn ch s dng ton t khng bng (<> v NOT). S dng bng c to ra bi mt cu truy vn nh truy vn con bt c khi no c th. Chng ta s xem xt hai v d sau: V d 1: SELECT MIN(Salary) FROM Employees WHERE EmpID IN (SELECT TOP 2 EmpID FROM Employees ORDER BY Salary Desc) S chy chm hn v d 2 sau: SELECT MIN(Salary) FROM (SELECT TOP 2 Salary FROM Employees ORDER BY Salary Desc) AS A Hy s dng SET NOCOUNT ON ti u mt l, mt th tc, trigger ngn thng bo nh 1 row(s) affected sau khi thc hin SELECT, UPDATE, DELETE hay INSERT. Vic ny s ci thin c hiu sut ca th tc lu tr bng vic gim lu lng ng truyn trn mng. Thc hin kim tra ton vn tham chiu v kim tra tnh hp l ca d liu nn s dng cc rng buc (constraint) nh kha ngoi hay rng buc check thay v dng trigger. Ch dng trigger khi bn chc rng khng th s dng c bng rng buc. S dng rng buc s tit kim thi gian v bn khng cn vit code kim tra.

19

IV.

CHUN VIT CODE TRON G ORACLE PL /SQL. 1. Chun t tn trong ORACLE PL/SQL.
1. Quy tc t tn gi. (Naming package). Tn ca mt gi theo cu trc sau: PKG_Tn. Trong : + PKG: l thnh phn c nh nhn din gi. + Tn: l mt tn c ngha ca thnh phn cha trong gi. Tn gi c vit lin bng ting Anh. Nu trong tn cha nhiu ch t du gch di gia cc ch. V d: PKG_CONTRACT_UPDATE 2. Quy tc t tn th tc v hm. Tn th tc hoc hm c vit bng ting Anh v theo sau l hu t _FUNC vi hm v _PROC vi th tc. Tn th tc v hm l cc hnh ng m n thc hin v trng hp tn gm nhiu ch th phn cch cc ch bng du gch di. V d tn hm: GETNAME_FUNC. 3. Quy tc t tn bng. Tn bng c vit bng ting Anh v tn l kiu s nhiu. Nu tn cha nhiu t t du gch di gia cc t v ch vit t cui cng dng s nhiu. V d: APPLICATIONS APPLICATION_FUNCTIONS APPLICATION_FUNCTION_ROLES 4. Quy tc t tn ct. Tn ct c vit bng ting Anh v trng hp tn ct gm nhiu ch th gia cc ch t mt du gch di. V d: USER_FUNCTION. 5. Quy tc t tn kha. a. Tn kha chnh. Tn kha chnh gm tn bng cha n v hu t _PK V d: Tn bng: APPLICATION. Tn kha: APPLICATION_PK. b. Quy tc t tn kha ngoi.

20

Tn kha ngoi bao gm tn vit tt (l cc ch ci u tin ca tn bng v ch gm 4 k t) ca 2 bng v theo sau l hu t _FK. Tn hai bng theo th t bng tham chiu, bng cha kha ngoi. Gia cc ch c du gch di. V d: Tn bng tham chiu: APPLICATION. Tn bng cha kha ngoi: FUNCTION. Tn kha ngoi: APPL_FUNC_FK 6. Quy tc t tn thc th. Tt c cc tn thc th c vit dng s t bng ting Anh. Nu tn thc th cha nhiu ch th gia cc ch t mt du gch di. V d: APPLICATION APPLICATION_FUNCTION APPLICATION_FUNCTION_ROLE 7. Quy tc t tn mt s i tng khc. Rng buc check: tn_CHK. View : tn_V. Sequences: tn_SEQ Quy tc t tn con tr. + Vi con tr ch c ta thm tin t cr _. + Vi con tr c th cp nht ta thm tin t cu_. Bin cc b bt u vi tin t l. Bin ton cc v hng s ln lt c thm tin t g, c. Ngoi l (Exception): e_tn ngoi l. Tham s u vo: i_tn tham s. Tham s u ra: o_tn tham s. Tham s vo ra(In/out parameter): io_tn tham s.

8. Quy tc t tn bin.

9. Quy tc t tn trigger. Tn trigger c vit bng ting Anh gm tn bng + tn vit tt loi trigger + hu t _TRG V d: Tn bng: APPLICATIONS Action: BEFORE INSERT STATEMENT-LEVEL Name : APPLICATION_BIS_TRG

2. Khun dng code.


1. nh dng.

21

T kha v kiu d liu c vit hoa, m ngun c vit ch thng. Tht u dng vi 3 space. Mi cu lnh c vit trn mt dng. Vit cc t kha : THEN, LOOP, IS, ELSE, ELSIF, WHEN trn mt dng mi t du phy , trc cc thnh phn ring bit. Tham s, ton t, gi tr trong mt cu lnh gi c vit thng hng Khi ch c mt dng ch thch k hiu -- c s dng nh du mt ch thch. Cc cu lnh PL/SQL cn c b tr sao cho d c. Nhm cc nhm m c cng logic v tch bit gia cc nhm l mt dng trng hoc mt ghi ch. Trong code nn vit cc ch thch gip cc lp trnh vin khc c th d dng hiu c.

2. Ch thch m ngun. Trong chng trnh nu ch c mt dng ch thch, s dng k hiu --. Nu trong chng trnh c nhiu dng ch thch lin nhau ta s dng k hiu /**/

3. S dng ngn ng.(Language Usage).


1. Lut chung. t nhn cho khi con (sub blocks). Trnh nh ngha bin m bn khng dng ti. Nu trong chng trnh c on m no m bn khng s dng khng nn dng comment m nn xa b. Trnh lu ROWIDs hoc UROWIDs trong mt bng. Khuyn khch s dng %TYPE khai bo bin. V d: khi thay i kch thc ca ct ename trong bng EMP t VARCHAR2(10) sang VARCHAR2(20) s gy ra mt li trong m ngun bt c khi no mt gi tr ln hn 10 bytes c c. iu ny c th trnh bng vic s dng %TYPE. Khng khi to bin vi NULL S dng IS/IS NOT NULL nu mun xem mt gi tr c null hay khng. Trnh khi to bin s dng hm trong phn khai bo. V nu vic khi to ca bn b li bn s khng th x l li trong khi ngoi l. Trnh s dng ROWID hoc UROWID. Trnh s dng kiu d liu CHAR. Khng s dng chui trng thay th cho NULL. S dng kiu gi tr Boolean cho cc gi tr mang ngha kp. S dng TRUE, FALSE ch ra rng y l mt gi tr kiu Boolean lm cho m ngun d c hn. Trnh s dng kiu gi tr LONG. 22 2. Bin v kiu.

S dng con tr c d liu, sau khi x l d liu xong phi ng con tr li gii phng b nh.

3. CASE/IF/DECODE/ COALESCE/ NVL/ NVL2 S dng CASE hn l mt cu lnh IF vi nhiu ELSIF. Nn s dng CASE thay cho DECODE. Lun s dng COALESCE thay cho NVL nu tham s 2 ca hm NVL l mt li gi hm hoc mt cu lnh SELECT. V hm NVL lun xem xt c 2 tham s trc khi quyt nh tham s no c s dng. iu ny c hi nu nh tham s th 2 l mt li gi hm hoc mt cu lnh SELECT, n s thc hin bt k tham s 1 c cha gi tr NULL hay khng. Hm COALESCE th khng c nhc im ny. S dng CASE thay cho NVL2 nu tham s 2 hoc 3 ca NVL2 l mt li gi hm hoc mt cu lnh SELECT 4. Vng lp. Khng s dng cu lnh GOTO trong m ngun. Lun lun t nhn cho vng lp. V d: BEGIN <<process_employees>> FOR r_employee IN (SELECT * FROM emp) LOOP END LOOP process_employees; END; Lun s dng vng lp CURSOR FOR x l hon ton kt qu con tr tr khi bn ang x l mt s lng ln cc thao tc. V d: BEGIN <<read_Employees>> FOR r_employee IN c_employee LOOP END LOOP read_employees; END; Lun s dng vng lp NUMBERIC FOR x l mt mng ln. BEGIN <<process_employees>> FOR i IN t_employees.FIRST()..t_employees.LAST() LOOP 23 V d:

END LOOP process_employees; END; Lun s dng vng lp WHILE x l mt mng nh. DECLARE l_index PLS_INTEGER; BEGIN l_index := t_employees.FIRST(); <<ProcessEmployees>> WHILE l_index IS NOT NULL LOOP l_index := t_employees.NEXT(l_index); END LOOP process_employees; END; Trnh s dng EXIT ngng x l mt vng lp tr khi bn ang trong mt vng lp c bn. Lun x dng EXIT WHEN thay cho mt cu lnh IF thot khi mt vng lp. -- Khng tt BEGIN <<process_employees>> LOOP ... IF ... THEN EXIT process_employees; END IF; ... END LOOP process_employees; END; -- Tt BEGIN <<process_employees>> LOOP ... EXIT process_employees WHEN (...); END LOOP process_employees; END; 24 V d: V d:

t nhn cho cu lnh EXIT WHEN. BEGIN <<outerloop>> FOR l_outlp IN 1..2 LOOP <<innerloop>> FOR l_innerlp IN 1..4 LOOP DBMS_OUTPUT.PUT_LINE('Outer Loop counter is ' || v_outerlp || ' v_innerlp); EXIT outerloop WHEN v_innerlp = 3; END LOOP innerloop; END LOOP outerloop; END; Inner Loop counter is ' ||

V d:

Khng s dng con tr cho vng lp kim tra con tr c tr v d liu hay khng.

V d: -- Khng tt BEGIN ... EXCEPTION WHEN OTHERS THEN IF SQLCODE = -1 THEN ... END IF; END; -- Tt DECLARE l_employee_found BOOLEAN := FALSE; BEGIN OPEN c_employee; FETCH c_employee INTO r_employee; l_employee_found := c_employee%FOUND; CLOSE c_emplyoee; END; 25

1.1 X l ngoi l. 1. Khng x l mt ngoi l cha c t tn bng vic s dng s li. V d: -- Khng tt BEGIN ... EXCEPTION WHEN OTHERS THEN IF SQLCODE = -1 THEN ... END IF; END; -- Tt DECLARE e_employee_exists EXCEPTION; PRAGMA EXCEPTION_INIT(-1, e_employee_exists); ... BEGIN ... EXCEPTION WHEN e_employee_exists THEN ... END; 2. Trnh s dng mnh WHEN OTHERS trong mt khi ngoi l m khng c bt k x l c th no. V d: --Khng tt EXCEPTION WHEN OTHERS THEN IF SQLCODE = -1 THEN update_instead (...); ELSE err.log; RAISE; END IF; --Tt 26

EXCEPTION WHEN DUP_VAL_ON_INDEX THEN update_instead (...); WHEN OTHERS THEN err.log; RAISE; 3. Trnh s dng ngoi l c nh ngha trc bi Oracle. 1.2 V d: FUNCTION get_emp (in_empno IN emp.empno%TYPE) RETURN emp%ROWTYPE IS BEGIN ; END get_emp; Loi b cc tham s cha ng ti hoc chnh sa m ngun s dng cc tham s ny. 1. Gi (Package). Lun gi cho gi c kch thc nh. Ch bao gm mt vi th tc v hm s dng trong mt phm vi. Trnh khai bo bin ton cc l Public. Trnh th tc ng mt mnh, hy t th tc trong gi. Trnh s dng cu lnh RETURN trong th tc. Trnh t hm ng mt mnh hy t chng vo trong gi. Khng dng hn mt cu lnh RETURN trong thn mt hm. To cu lnh RETURN l cu lnh cui cng ca hm. Khng s dng tham s OUT tr v gi tr t mt hm. Khng bao gi c tr v gi tr NULL t mt hm BOOLEAN. 2. Th tc. i tng lu tr.

Lun lun thm tn ca n v chng trnh vo sau t kha END ca n v chng trnh .

3. Hm.

27

V.

CHUN THIT K G IAO DIN. 1. Chun thi t k giao din Winform.


1.1 Chun t tn trong Winform. Chun t tn cho cc thnh phn giao din ca WinForm.
Control Tin t

Label

lbl

TextBox

txt

DataGrid

dtg

Button

btn

ImageButton

imb

Hyperlink

hlk

DropDownList

ddl

ListBox

lst

DataList

dtl

Repeater

rep

Checkbox

chk

CheckBoxList

cbl

RadioButton

rdo

RadioButtonList

rbl

Image

img

Panel

pnl

PlaceHolder

phd

28

Table

tbl

Validators

val

1.2 2. Label. -

Chun thit k giao din cc thnh phn control ca WinForm.

Label gm t t m t ni dung ca mt control. Khi nhn chut vo label th khng thc hin hnh ng no c. S dng label m t ni dung cho mt GroupBox, TexBox, CheckBox, hoc a ra mt thng bo cho ngi dng. Sau mi label dng m t ni dung cho mt textbox, checkbox , DateEdit, Combobox.. nn c du : km theo. Cn l tri cho cc label. Label nn t Font Tahoma c kch thc l 8.25pt. V d:

3. Menu ngang. Gm mt tp cc la chn v nm trn cng ca Form chnh. Ty chn ca Menu ngang gm mt tp cc ty chn c s xung khi ngi dng kch vo. Cc ty chn ny nn c nhm li thnh cc nhm c cng logic. Nn thit lp phm tt cho cc ty chn nu c th gip ngi dng thao tc nhanh hn.

Cu trc ca phm tt c vit cng ty chn.(nh hnh minh ha). Ty chn cn c vit ngn gn d hiu, cn l tri cho tn ty chn. t t nht 2 ty chn trn menu ngang. Cc ty chn ca menu nn c sp xp theo chc nng, tn s s dng, trnh t s dng hoc th t ch ci. t cc ty chn c lin quan ti nhau thnh mt nhm v phn bit cc nhm ny bng mt ng phn cch. S dng 3 du chm lng sau ty chn gi ra mt Form phn cp khc. 29

4. Checkbox Dng la chn 2 hoc nhiu ty chn trong mt danh sch c nh.

Mi checkbox c mt hnh nh m t trng thi c chn v mt nhn ni dung ca checkbox ny. Cc checkbox c cng logic cn c nhm li vi nhau trong mt groupbox v c mt nhn m t ni dung chung cho tt c cc checkbox ny. Cc checkbox c ni dung khng loi tr nhau (c th chn mt lc nhiu ) . a ra cho ngi dng mt danh sch cc i tng la chn, mi i tng t trn mt dng ring bit. Mt listbox cn c thanh cun khi c nhiu i tng v c h tr chn mt hoc nhiu. Ch dng listbox cho mc ch la chn i tng khng dng gi lnh. Listbox lun xut hin vi mt mc c chn. Mover/Copy lists: + Danh sch ny dng dch chuyn i tng t tri qua phi

5. ListBox

+ Cc i tng c chn trong danh sch Dch chuyn t s c n v xut hin ti danh sch Dch chuyn ti. 6. Nt. (Button) Mt nt c nhn l ch ci hoc hnh nh hoc c 2 m t hnh ng m nt thc hin. Khi nhn chut mt ln trn nt s thc hin hnh ng c m t trn nhn. Mt nt c kch thc ph thuc di ca nhn m t nhng khng c nh hn di mc nh ca nt (75,23). S dng du chm lng nu nt gi ra mt form th cp khc. t thuc tnh enable = false cho mt nt khi ngi dng khng c php thc hin chc nng ca nt . t tabindex cho cc nt.

30

Khi thit k t du & trc cc k t khc nhau ca mi nt to ra gch chn ti mi nt c tc dng khi chut khng hot ng c.

7. i tng ch tin thc hin mt tin trnh. (Progress indicator) Dng khi mt tin trnh thc hin mt nhiu thi gian. Trng hp dng khi thc hin cc thao tc vi d liu trn li ch cn hnh nh th hin vic d liu ang c thao tc. Trng hp i tng ch tin c gn trn Form, cn c mt label thng bo cho ngi dng bit qu trnh ang c thc hin. Cn c mt nt thc hin vic hy b thc hin tin trnh trong trng hp ngi dng mun hy thao tc va yu cu. 8. Nt Radio. Dng la chn mt i tng t mt danh sch cc i tng c nh. Vic la chn cc i tng mang tnh cht loi tr nhau. Mt nt Radio cn c mt hnh nh biu th trng thi c chn v mt nhn m t ni dung ca nt. Cc nt Radio c cng logic c nhm li vi nhau v t trong mt groupbox, c mt nhn m t ni dung chung cho cc nt radio ny. Mt i tng lun lun c chn (u tin la chn mc nh). Chn mt nt radio ny th nt khc s c b chn. dng khi c 2 hoc 3 la chn. 9. Phm tt. Bng tng hp cc phm tt thng dng: Chc nng Sch hng dn ng nhp li Thot khi chng trnh ng Form Xa bn ghi 10. Li d liu (Gridview). S ct hin trn li ph thuc vo di d liu ca cc ct. khi d liu b n nhiu do di d liu ca cc ct hoc c nhiu ct nn t thm mt nt cho ty chn n hin cc ct trn li. Cn chnh d liu trn li theo quy tc sau: + D liu dng text c cn tri. + D liu ly ra dng s c cn gia. + D liu ly ra l tin c cn phi. 11. text. (textbox) Cc text c cn tri. Phm tt Ctrl + F2 Ctrl + L Ctrl + Q Esc Del

31

Vi cc text bt buc nhp d liu cn t thm mt du * mu trc text v mt label thng bo cho ngi dng bit. Cc text phi bt rng buc khi nhp d liu, s dng Error provider a ra cc thng bo c th v li. (cc rng buc bao gm s lng k t c php nhp, bt buc nhp d liu, kiu d liu).

12. Menu dc. Menu dc chia thnh 2 phn mt phn cha cc ty chn chung. Mt phn cha cc ty chn chi tit. Gia 2 phn ny c phn cch nhau bi mt ng k. Cc ty chn chung c cc icon m t ty chn. Khi ngi dng kch chn ty chn chung no th ty chn chi tit tng ng ca ty chn s hin ra tng ng ti phn dnh cho cc ty chn chi tit. Trn cng ca menu dc s c mt nhn. Nhn s thay i theo tn ca ty chn chung m ngi dng chn. 13. Combobox S dng chn mt i tng t mt danh sch c nh. Kch thc ca combobox ph thuc chiu di ca text nhng khng c nh hn kch thc mc nh. Khi chn mt i tng khc trong combobox i tng c hin th trn combobox s c thay i tng ng l i tng va c chn. 1.2 Chun thit k giao din cc thng bo(Message).

1. Thng bo tc ng (Action message). Mt thng bo tc ng thng bo cho ngi dng bit mt hnh ng cn s can thip ca ngi dng. Ngi s dng s thc hin chp nhn hnh ng hoc hy b vic thc hin hnh ng.

Thng bo ny xut hin trong tnh trng c th di chuyn c nhng c kch thc c nh. Lun cho php ngi dng tr li ng dng m khng thc hin hnh ng no. Tiu ca thng bo l tn vit tt v tn phin bn ca phn mm. Icon ca thng bo l hnh du ?. Nhn ca cnh bo l tn vit tt ca phn mm v phin bn.

2. Thng ip cnh bo. (Warning message).

32

S dng cnh bo thng bo cho ngi dng bit khi gp cc hnh ng gy tn hi hoc khng mong mun. Thong ip ny xut hin trong trng thi c th di chuyn c v c c nh kch thc. Trong trng hp ang thc hin mt thao tc v a ra cnh bo nhn s iu hng t ngi dng th cnh bo cn c 2 nt. Mt nt ngi dng xc nhn tip tc thc hin thao tc , mt nt hy vic thc hin.

Trong trng hp ch a ra mt cnh bo ch cn mt nt cho ngi dng xc nhn cnh bo. Icon ca cnh bo l hnh du chm than trong mt tam gic nh hnh trn. Nhn ca cnh bo l tn vit tt ca phn mm v phin bn. Ch s dng thng bo li khi chng trnh c li trong qu trnh thc hin mt thao tc no . Thng bo li xut hin trong trng thi c th di chuyn c v c kch thc c nh. Nhn ca thng bo gm tn vit tt ca phn mm v phin bn. Icon ca thng bo l mt du X mu . C mt nt cho ngi dng xc nhn li.

3. Thng bo li. (Error message).

2. Chun thi t k giao din Webform.


2.1 Chun t tn cc thnh phn control ca ASP.NET. Tn control Label TextBox GridView Button ImageButton Hyperlink DropDownList ListBox lblName txtName gvResult btnSave ibtnSave hlkHomePage ddlCompany lstCompany V d lbl txt gv btn ibtn hlk ddl lst Tin t

33

DataList Repeater Checkbox CheckBoxList RadioButton RadioButtonList Image Panel PlaceHolder Calender Adrotator Table [All]Validators ValidationSummary

dtlAddress repSection chkMailList cblAddress rdoSex rblAgeGroup imgLogo panSection plhHeader calMyDate adrBanner tblResults valCreditCardNumber valsErrors

dtl rep chk cbl rdo rbl img pan plh cal adr tbl val vals

2.2

Tiu chun ti u.

a. Dung lng File CSS: 50k. b. Dung lng File HTML: 70k. c. Dung lng nh ti a: nh CSS: 20k. nh <img>: 250k. nh ng: 40k. d. Tng kch thc nh: 750k. e. S lng thnh phn (element): 1200. f. su ti a ca cc heading: (tnh t <html>). H1: 7. H2: 10. H3: 13. g. S lng nh: (tt c cc nh) 100. h. S lng Media (flash, video): 2. 2.3 1. Font. a. S lng font: 2 (mt cho cc heading, mt cho ni dung). b. Loi font: Gii hn trong: Arial, Tahoma, Verdana, Times New Roman, Courier New. S dng font tng ng ca Window v Mac: + Arial, Helvetica, sans-serif. 34 Tiu chun v hin th.

+ Verdana, Geneva, sans-serif. + Tahoma, Geneva, sans-serif. + Courier New, Courier, monospace. + Times New Roman, Times, serif Kch thc font chun l 0.7 em v 0.75 em.(11px v 12px). n v kch thc em. Chiu cao dng: 1.25 em vi font serif, 1.5 em vi font sans-serif, 1 em vi font monospace. Ch s dng left alignment vi on vn. S mu ti a (tr en v trng): 3. + Mu link: thit k cho ngi dng thy c link no nhn vo c link no khng v link no c nhn vo (hoc va c nhn vo). + mu chnh. + mu ph. + Ngoi ra c th dng cc mu cng tone vi cc mu trn nhng khc nhau v m nht. tng phn cho php gia background v text: 4.5 (s dng cng c tnh http://snook.ca/technical/colour_contrast/colour.html, ratio). 3. nh. Kch thc ti a: 640x480. nh dng nh: + Ni dung: JPEG. + Icon: GIF. + Cc loi khc: khuyn khch s dng nh PNG v nh PNG nn ng cch s cho cht lng tt nht. nh ng: + Thi gian hot ng t 10s ti 15s. + S lng ti a trn mt trang:3 tr qung co. + Khng s dng nh ng cho cc Icon. 4. Quy tc HTML. a. Cu trc: Cc trang s c cu trc bt buc sau: <div id=wrapper> <div id=header> <h1><a href=/>Website name</a></h1> <!-- Khng dng <img />, m s dng image replacement -> 35 xem thng s Contrast 2. Mu sc.

... </div> <div id=main-nav> <ul> <li>....</li> </ul> </div> <div id=body> <div id=left-col>....</div> <div id=right-col>....</div> <div id=content>....</div> </div> <div id=footer> ... <div id=copyright>...</div> <address>(Company information)</address> .... </div> </div> Cc module chnh (l ni dung chnh ca trang) s c cu trc bt buc sau (tr header v footer) ... <div id=ModuleName class=box primary> <h1><a href=/>Module header</a></h1> <div class=box-content> ... </div> ... </div> ... Cc module ph s c cu trc bt buc sau (tr header v foote r) ... <div id=ModuleName class=box> <h3><a href=/>Module header</a></h3> <!-- C th c hoc khng --> <div class=box-content> ... </div> 36

... </div> ... on vn <p>This is a paragraph</p> on trch dn <blockquote>text </blockquote> Ch m <strong>ch m</strong> Ch in nghing <em>ch in nghing</em> Ch gch chn <ins>ch gch chn</ins> Ch gch ngang <del>ch gch ngang</del> t trong ngoc kp <q>Ch in T</q> Input caption <label for=input-id>Username</label> ... <input id=input-id type=text value=username /> Table header <th>Table header</th> Message <span class=msg-error>This is an error message</span> <span class=msg-info>This is an info message </span> <span class=msg-warning>This is an message </span> <span class=msg-success>This is an success message </span> Cc list dng title-description <dl> 37

<dt>This is an title</dt> <dd>This is a description for This is an title</dd> <dt>This is another title</dt> <dd>This is a description for This is another title</dd> </dl> Quy tc chung + Phi ng tt c cc th <br /> <input/> <img /> <hr /> + Phi dng thuc tnh alt vi <img /> + Nn t width + Phi dng title vi <a></a> + Phi dng type vi <input /> + Khng dng inline script, inline style + Trong th <a> ch c t cc th <span><em><strong><ins><del> bn trong + Khng c t cc th khc trong <span><em><strong><ins><del> + S dng HTML URL Encode vi tt c URL + S dng ng dn tuyt i vi tt c URL Validate : http://validator.w3.org/ Quy tc CSS + Khng dng float vi cc th <span><em><strong><ins><del> tr khi t trong th <a> + Trnh tt c cc gii php IE Hack + Khng dng CSS Expression (tr trng hp dng PNG Transparent) + Khng s dng CSS reset + Gi nguyn margin nguyn thy ca cc th, tr trng hp bt buc. + Dng CSS Shorthand vi list-style, background, border, margin, padding, font. 5. Cc quy nh cho SEO (Search Engine Optimization). Nn dng cc th Meta tag : l cc th Meta c s dng phn Header ca Html nhm tng kh nng tm kim cc t kho ca cc cng c tm kim. V Tr xut hin : <head> Meta tag xu t hin ti y </head> Th Meta Content Language c dng khai bo ngn ng ca website. Th ny cng c dng tng t nh Meta Name Language. Cc robot ca SE O thng dng th ny phn loi ngn ng ca website <Meta http-equiv="Content-Language" Content="vi">

38

Th Meta Content Type dng khai bo m cho website.Nu khng s dng th c khi ngi dng website s khng c c ni dung website do trnh duyt khng t ng iu chnh m ph hp cho website <meta http-equiv="content-type" content="text/html; charset=utf-8" />

Th Meta Description dng m t ni dung ca mt trang web. Ni dung ca th ny nn c vit ngn gn v xc tch khong t 20 n 25 t hoc t hn. y l th c hu ht cc SE s dng hin th ni dung kt qu tm kim.Th ny c khuyn khch s dng v nn vit mt cch xc tch nht nhm thu ht ngi dng bm vo website t kt qu tm kim. <meta name="description" content="M t ngn gn cho website " />

Th Meta Abstract cung cp ni dung tm tt cho phn m t ca websit <Meta Name="Abstract" Content="Thit K Website Ti <Meta name="Author" Content="FSC"> Th Meta Copyright y ch l th mang tnh thng hiu hay cc thng tin bn quyn c nhn hay s hu tr tu <meta name="copyright" content="Copyright 2008"> u a"> Th Meta Author dng hin th tc gi ca mt ni dung trn website

Nn tiu bi vit trong th H1-H6 my tm kim u tin khi phn tch ni dung trang B xung thuc tnh Title trong cc link gip cc spider duyt link tt hn S dng tag chn nh vi y cc thuc tnh ALT, Title. trong alt dng miu t nh cho cc b my tm kim, title dng miu t nh cho ngi dng. Tn nh nn t theo tn ca tiu bi vit <img src="/link nh" alt="miu t nh ginh cho S O" height="c nh" width="c nh" title="hin th v i ng i d ng">

- S dng .htaccess chuyn tn min t non-www thnh dng www (s dng redirect 301) - m bo rng khi khch click vo logo ca site th h c a tr li trang ch - Nu font ch ca website qu nh, hy cho n v mc tiu chun (font -family:Arial;fontsize:12px ), SE c th b qua site ngy nu font ch qu nh - Loi b cc plugin ko cn thit - Lun chn thng tin lin h, hoc trang lin lc cui trang web - Nn c gng sp xp site theo mt mu CSS stylesheet - Sa hoc loi b cc link sai, hoc cht thng xuyn nu bn khng s dng nofollow - S dng alt tag cho tt c bc nh, c bit l trang ch - Loi b cc iframe trong site, phn ln cc SE ko index cc iframe, n c th lm cho c page cha iframe b nh hng 39

- Nn to mt file robots.txt cho website - Nn s dng mt navigation c bn cho site bn - S dng cng mt mu cho cc link - Kim tra li chnh t trong ni dung website - nh dng website theo mt khun mu xc nh - Nn s dng t nht 1 bc nh cho mi trang c km alt tag, ng ngh l loi b ht tranh nh c th ci thin rank cho site - To mt about page cho site - Nn chn 1 s bc nh vo about page (nh logo, map) - Nn loi b cc popup trong site - Chn link n cc bookmark, cc mng x hi sau mi bi vit v about page - Nn chn mt cng c tm kim cho site - To mt trang iu khon c nhn cho site - t link ti iu khon c nhn di mi trang - Khi rewrite url nn s dng du - thay cho du _ - Nn chn google maps vo trang lin lc (about page) - Nn chn link t trang ny n trang khc cho site - S dng th META description ring bit cho mi trang - Kim tra m ngun v sa cc li - Khng nn c 1 trang trao i link - Chn mt hp tm kim ca site 404 error page - Nn to mt sitemap cho site - Chn link n site map cui mi trang - Nn chn dng copyright abc cui mi trang - Tt tt c cc file nhc, phim t ng chy (automatically plays) - Nn thay th cc Flash animated = gif animated - t logo ca site u mi trang - Nn s mua thm cc domain .net .org .biz v redirect n v site - Nn to mt trang support, help hoc FAQ - Khi tr li mt yu cu, tr gip g nn tr li trang support hoc help , khng nn s dng email, a h n trang FAQ nu cu hi c tr li, nn cp nhp FAQ thng xuyn - Nn chn m thng k (analytics code) cho website ca bn tt c cc trang, c th s dng histat.com, statcounter.com, hay google analytics ty theo nh hng pht trin - Xa b tt c cc m t ng iu chnh kch thc trnh duyt ca khch - Nn to mt favicon ring cho site - Ch nn s dng email dng @tenmiencuaban.com - t thuc tnh label= cho tt c cc form ca site

40

- S dng W3C Compliant kim tra v sa cha cc li c th gy nh hng n qu trnh hot ng ca SE bots

41