Intro To Programming EC201 Fundamental Programming
Intro To Programming EC201 Fundamental Programming
Intro To Programming EC201 Fundamental Programming
IntroductiontoProgramming
Lectureby: Lecture by: Pn.WanFazlini Idayu binti WanFakari Politeknik Kuala Terengganu KualaTerengganu
1
AProgrammerisapersonwhodesigns,writes andtestcomputerprograms.
What ?
Programming Language g g g g
?
Function?
8
To ease daily process e.g.: transaction, payroll, accounting, registration, information exchange etc.
7
Method of communication for which computers could understand and execute ld d d d the instructions written in source code.
A programming language is therefore a practical way for us (humans) to give instructions to a computer.
programmerstalkto lk computerusingacomputer p g p language. Generationofcomputer p languages : Low Level Language LowLevelLanguage HighLevelLanguages
9 10
Tellme1+1is equaltowhat???
LowLevelLanguage: g g 1st :Machinelanguage 2nd :Assemblylanguage:The languagestructuredependson l d d instructionset/CPU s instruction set/ CPUs architecture.
*lowlevellanguageenablesefficientmachine low level language enables efficient machine usagebutitisdifficulttouse.
13
HighLevelLanguage:
3rd :Procedureoriented: P d i t d COBOL,C,FORTRAN,Pascal 4th :Problemoriented/query: DATATRIEVE,INTELECT DATA TRIEVE INTELECT
14
15
16
HERE:
18
Assembly y code
So, S computer need t d translator call: -Assembler -Compiler or interpreter. Assembler: y assembly machine compiler or interpreter high level machine hi h l l hi
19
WhatisC? What is C?
Ahighlevelstructured&proceduralprogramming language. C is an intermediate language between human & Cisanintermediatelanguagebetweenhuman& computer.
CHistory C History
Derived from the BCPL language by DerivedfromtheBCPLlanguageby MartinRichards(1967). KenThompsondevelopedaBlanguagefrom BCPLlanguage(1970). BCPL language(1970) EvolvedintotheClanguagebyDennisRitchie (1970)atBellTelephoneLaboratoriesInc. ( (nowtheAT&TBellLaboratories). ) Clanguagewasfirstusedonacomputer DigitalEquipmentCorporationPDP11tofully Digital Equipment Corporation PDP 11 to fully useinUNIXoperatingsystem.
22
Human language
Machine language
:Linktolibraryfunction
exemode
:Output(checkforanysemanticerrors) p ( y )
23 24
25
26
Receiveusertextinput
Returnresulttouser
30
module1 data+data1
module2 data+data2
procedure1
procedure2
procedure3
32
Objectorientedprogramming OOP(1)
Basedonobjects andvisual. 4thgenerationlanguage TheconceptsintheOOP:
Object class
Objectorientedprogramming OOP(2)
Anobjectorientedprogramisdecomposedintoa networkofcollaboratingobjects. Anobjectrepresentsathingorconceptandhasa knownsetofbehaviorsthatmaybeinvokedbyother objects. Foranyactivityoftheprogram,anobjectresponsible For any activity of the program, an object responsible forthatactivitymayinteractwithotherobjectsby g , , invokingtheirbehaviors,or"methods",untilthe activityiscomplete.
33 34
OOP splits the program into objects that can be OOPsplitstheprogramintoobjectsthatcanbe reuseintootherprogram. Eachfunctionisdevelopedtoinstructanobjectto E h f ti i d l dt i t t bj t t performactionsbasedontheeventhattakeplace.
Objectorientedprogramming OOP(3)
Themostpopularobjectorientedprogramming languagesincludeJava,VisualBasic,C#,C++,and languages include Java Visual Basic C# C++ and Python.
Objectorientedprogramming ( ) (OOP)
Loadprogram Text input Drawwindow button
window
35
Programreadyto P d t use
36
Structure Programming
Modular d l Programming
Compare between the following types of programming: Structured programming Modular programming Object-oriented programming
* Discuss in group and list the answer. * We will discuss in next class.
37
Definition Languageuse
Ada,Pascal,C. d l
Stepused
toptobottom approach
39