7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
1/31
Nhpmnlptrnh
Trnhby: PhmMinh Tun; Email: [email protected]
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
2/31
KhinimvchngtrnhmytnhCcngnnglptrnh
CckhinimcbnvlptrnhCcvntmhiumrngkinthc
nghnghip
Thutngv bicthmtingAnh
11/10/2012 Khoa CNTT - H Khoa hc t nhin 2
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
3/31
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
4/31
Khinim CPU camytnhcthitkcththc
hincccchngtrnhmmy(machine
code program) chiuhnh(HH) npvoRAM camytnh.Chngtrnhmmythngphitngthch
vitnghmycth, bao gmtphpccch
thcvitbngcclnhCPU cahmy,clutrnadidngmttptin mthcthi (executable program file) caHH cth.
11/10/2012 Khoa CNTT - H Khoa hc t nhin 4
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
5/31
Qui trnhthchin B1. Ngisdng(ngidngcuiend
user) ra lnhthchin(chy) chngtrnh.B2. HH nhnclnhsthchin:
Tmvnptptin mthcthi cachngtrnh(nmtrna) voRAM camytnh.
BmlnhcaCPU (CPU program counter) ctrnlnhutincachngtrnh(cngilngvchngtrnhprogram entry point)
11/10/2012 Khoa CNTT - H Khoa hc t nhin 5
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
6/31
Qui trnhthchin(tiptheo) B3. CPU thchintngchthmttrong RAM
cho nkhi gplnhktthc:Chplnhmmyhinhnhvothanh ghi lnh.Tngbmlnh(trnlnhktip). Thi hnhlnhmmy.
B4. Ktthcthchinchngtrnh, HH chnhnlnhmi.
11/10/2012 Khoa CNTT - H Khoa hc t nhin 6
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
7/31
cimMichthcachngtrnhlmtlnhm
my(mtdyccbyte chphhpviqui
ctplnhcamtloiCPU no)ccutrchatheo qui ccaHH.cchytrnmthCPU vHH cth.
Nidung rtkhhiuivingidngmytnh, chcCPU thchhpvihiurvthi hnhc.
11/10/2012 Khoa CNTT - H Khoa hc t nhin 7
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
8/31
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
9/31
KhinimVicvitccchngtrnhmmyrtccv
kmhiuqungay civicclptrnh
vinchuynnghipvvygiiphpkhiulsdngccNNLT cpthpnhhpnghocccNNLT cpcao (sbn phnsau).
ChngtrnhvitbngNNLT cgilchngtrnhngun(source code program)hay mngun(source code).
11/10/2012 Khoa CNTT - H Khoa hc t nhin 9
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
10/31
Chngtrnhnguncdchsangchngtrnhmmybngccchngtrnhdch:Trnhhpdch(assembler) dchcc
chngtrnhhpng.Trnhthngdch(interpreter) vtrnhbindch
(compiler) dchccchngtrnhcpcao.
11/10/2012 Khoa CNTT - H Khoa hc t nhin 10
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
11/31
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
12/31
Ngnnglptrnh(programminglanguage) lngnngclptrnhvinsdngvitchngtrnhchomytnh.
Khi mtchngtrnhcvitbngmtNNLT nothccchth, culnhtrong
chngtrnhphituntheo ccqui tc,cclutdo NNLT qui nh.
11/10/2012 Khoa CNTT - H Khoa hc t nhin 12
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
13/31
cimLNNLT phthucvotnghmycth,
vvykhngctnhtngthch.Dvit, c, sahnchngtrnhmmy.uimltndngvkhai thcctnh
nngcamihmycth, nhvychng
trnhcthchynhanh hn.
11/10/2012 Khoa CNTT - H Khoa hc t nhin 13
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
14/31
cimcxutkhcphccchnchca
NNLT cpthp.Ddngvddintccc tng
trutng.Ctnhtngthchcao (khi thay idng
mytnhthchcnsachngtrnhrtthocthmchkhngcnsamvnmbochyng).
11/10/2012 Khoa CNTT - H Khoa hc t nhin 14
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
15/31
NNLT cpthpHpng(assembly language)
NNLT cpcao C/C++
COBOL
FORTRAN
Java, C#
PHP, Ruby, Perl
Ada, BASIC, Visual Basic (VB), Lisp, Pascal,
11/10/2012 Khoa CNTT - H Khoa hc t nhin 15
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
16/31
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
17/31
Mtchngtrnh(program) lmtdyccchth(instruction) iukhinshotngcamytnhnhmgiiquyt
mtcngvicno.Ngivitchngtrnh(cngillp
trnhvinhay thochngvinprogrammer) lnhngngitolpranhngchngtrnhmytnh.
11/10/2012 Khoa CNTT - H Khoa hc t nhin 17
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
18/31
Hai chngtrnhnginsau chin ramtdngchcnidung lHelloeverybody! bngNNLT Java vC.
11/10/2012 Khoa CNTT - H Khoa hc t nhin 18
ChngtrnhJava ChngtrnhC
1234
5678
// Hello.javaimportjava.util.*;publicclassHello {
publicstaticvoidmain(String argv[])
{System.out.print(Hello everybody!);
}}
/* Hello.c */#include
voidmain(void)
{pritnf(Hello everybody!);
}
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
19/31
iviccNNLT cpcao truynthng(trcthhcaJava vC#), qutrnhvit, dchvchychngtrnhgmcc
cngonnhsau: B1. Sonchngtrnhngunvlulna. B2. Dchchngtrnhngunnhtrnhbindch.
B3. Niktcctptin mtrung gian tora B2. B4. Chychngtrnhngnngmytora B3.
11/10/2012 Khoa CNTT - H Khoa hc t nhin 19
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
20/31
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
21/31
Hnchcaccchngtrnhcpcaotruynthngltrnhbindchcachngphtsinh trctipmthcthi phthuc
vommytnhcamthmytnhvhiuhnhcthnnkhngthmangisdng cchiuhnhkhc.
11/10/2012 Khoa CNTT - H Khoa hc t nhin 21
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
22/31
NNLT hininhJava hay C# trnhbindchkhngdchtrctipmngunthnhmthcthi mcthitkcth
dchthnhmthcthi trutng(abstract executable code) clpmyvhiuhnh.
11/10/2012 Khoa CNTT - H Khoa hc t nhin 22
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
23/31
Do mytnhthtkhngthhiucmtrutngnnnhngchngtrnhdngmthcthi trutngchchyckhi
csnmyohtrcho victhi hnhloimthcthi .ChngtrnhngunJava (tptin *.java)
cdchthnhmthcthi khngphthuc
mytnh(tptin *.class) cthchyctrnbtkmytnhnocitmyoJava (Java Virtual MachineJVM)
11/10/2012 Khoa CNTT - H Khoa hc t nhin 23
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
24/31
Trong ccnmgny, ccngdngchytrnweb phttrinrtmnh.Chytrninternet thngqua mttrnhduyt
web.
cvitbngccngnngnhPHP, JSP,Java Script, VB Script ctnhtngthch
cao, hotngtrnbtkmytnhnocinternet
11/10/2012 Khoa CNTT - H Khoa hc t nhin 24
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
25/31
Tonbqui trnhbindchcthcmtcchddngvthuntinnhvocngcgilmitrngphttrinphnmm(Integrated Development EnvironmentIDE)Sonthochngtrnh.Qunlhthngtptin mngun.
Qunlhthngccphinbncamngun.Kimtra licphp, bindch, linktchngtrnh.Chytngdnglnh(debug) tmli.
11/10/2012 Khoa CNTT - H Khoa hc t nhin 25
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
26/31
MtsIDE thngdng: Eclipse: htrnhiungnng. C++ Visual Studio: ngnngC++. C# Visual Studio: ngnngC#.Visual Caf: ngnngJava. J Builder: ngnngJava.
11/10/2012 Khoa CNTT - H Khoa hc t nhin 26
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
27/31
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
28/31
abstract executable code: mtrutng assembler: trnhhpdch assembly language: hpng compiler: trnhbindch data type: kiudliu debug: chychngtrnhtheo tngdnglnhtmli executable program file: mttptin mthcthi end user(s): ngisdng, ngidngcui IDE: vitttcaIntegrated Development Environment,mitrngpht
trinchngtrnhtchhp instruction: chth interpreter: trnhthngdch link: niktccmtrung gian linker(hay link program): chngtrnhlinktmtrung gian
11/10/2012 Khoa CNTT - H Khoa hc t nhin 28
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
29/31
machine code program: chngtrnhmmy object code: mitng, mtloimtrung gian chaphilmmy
thts program entry point: ngvochngtrnh program: chngtrnh programmer: ngivitchngtrnh, lptrnhvin, tc:thochngvin programming language: ngnnglptrnh low-level programming language: ngnnglptrnhcpthp high-level programming language: ngnnglptrnhcpcao programming: lptrnh source code program: chngtrnhngun source code: mngun syntax error: licphp text editor: trnhsonthovnbn(cthdngsonmngun)
11/10/2012 Khoa CNTT - H Khoa hc t nhin 29
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
30/31
Thinking in C, Bruce Eckel, E-book, 2006.
Theory and Problems of Fundamentals ofComputing with C++, John R.Hubbard,
Schaums Outlines Series, McGraw-Hill, 1998.
11/10/2012 Khoa CNTT - H Khoa hc t nhin 30
7/25/2019 CTT003-Ch01-GioiThieuTongQuanVeLapTrinh
31/31