Mot so kien thc c s ve lap trnh bang ngon ng C

Muc luc | Phan sau

I. Phan m au

Noi dung:

 

Gii thieu ngon ng C & C++

- C la mot loai ngon ng lap trnh bac cao a dung pho bien nhat hien nay.
- C c phat trien t ngon ng B (K. Thompson, 1967) bi Dennis Ritchie cua hang AT&T Bell Labs va bat au xuat hien t nam 1972.
- Yeu cau cua ngon ng bac cao: tnh de oc-viet (readability), tnh de bao tr (maintainability) va kha nang linh ong (portability).
C la ngon ng lap trnh oc lap vi phan cng va cac he ieu hanh may tnh.
- 1978: quyen sach The C Programming Language (Kernighan & Ritchie) la tai lieu kinh ien cua ngon ng C.
- 1983: American National Standards Institute (ANSI) thanh lap uy ban xay dng chuan cho ngon ng C.
- 1990: Chuan ANSI C ra i.

- 1983: yeu to lap trnh hng oi tng + C ngon ng C++ do Bjarne Stroustrup phat trien Bell Labs.
- C++ la mot ngon ng gan nh la m rong cua ngon ng C, a co 3 phien ban: 1.1 (1986), 2.0 (1989) va 3.0 (1991). Chnh phien ban 3.0 la c s e xay dng chuan ANSI C++ .

Lap trnh hng oi tng (Object Oriented Programming)

- Phng phap lap trnh:
* LT tuyen tnh (linear)
* LT thu tuc (procedural)
LT cau truc (structural) (Chng trnh = Cau truc d lieu + Giai thuat)
* LT hng oi tng (object-oriented)

- ac iem LTHT:
* oi tng (Object): D lieu + phng thc
trong tam cua qua trnh phat trien chng trnh.
* Lp (Class): tap hp cac oi tng co tnh chat chung giong nhau.
* Tnh ong goi d lieu (encapsulation): oi tng bao gom d lieu va phng thc c ong goi ma ngi s dung co the tiep can en d lieu thong qua cac chc nang ma khong can biet en noi dung lap trnh cu the cua chung.
* Tnh ke tha (inheritance): S ke tha cho phep nh ngha cac lp mi da tren cac lp co san
cho phep s dung lai cac module chng trnh ma khong can thay oi chung.
* Tnh a hnh (polymorphism): trong cac lp ke tha nhau, co the nh ngha phng thc co cung ten hoac y ngha nhng hoan toan khac nhau ve mat lap trnh.

- u iem:
* Tnh ke tha
loai bo nhng oan chng trnh phai viet lai, m rong cac lp nhanh chong.
* C s chng trnh la oi tng
viec thiet ke va lap trnh thc hien theo quy trnh ch khong theo kinh nghiem hoac thu thuat tiet kiem thi gian va tang nang suat.
* Tnh ong goi
am bao tnh bao mat ma van phat trien chng trnh c.
* Cach tiep can at trong tam oi tng
co the xay dng mo hnh chi tiet va de cai at.
* Kha nang m rong he thong ln hn kha thi hn.

- Ngon ng LTHT:

C s ve phan cng va phan mem e thc hien chng trnh C

Phan cng:
* Cac loai may tnh co phan mem bien dch ngon ng C &C++ (tng thch ANSI C)
* oi vi PC, cau hnh may phu hp vi chng trnh bien dch ngon ng.

Phan mem:
* Cac loai may s dung HH Unix, C la ngon ng mac nh.
* oi vi PC: Turbo C, Turbo C++, Borland C++, Symantec C, Visual C++, C++ Builder…

Muc luc | Phan sau