hun myoung park, ph.d
DESCRIPTION
Introduction to Electronic Government Programming & Software Development Saturday, September 20, 2014. Hun Myoung Park, Ph.D. Public Management & Policy Analysis Program Graduate School of International Relations. Programming Languages. To communicate between human beings and computers - PowerPoint PPT PresentationTRANSCRIPT
Programming & S/W Development
Hun Myoung Park, Ph.D.,
Public Management and Policy Analysis ProgramGraduate School of International Relations
International University of Japan
OutlineProgramming LanguagesLanguage TranslatorsSoftware DevelopmentSoftware Analysis and DesignProgrammingImplementation & MaintenanceDocumentation
2
Programming LanguagesTo communicate between human beings
and computersInstruct a computer (H/W) to do what you
want to get using a programming languageEach computer can understand its own
machine language onlyInstructions can be written in programming
languages and then translated into the corresponding machine language.
3
Machine LanguageFirst generation languageConsists of 1 and 0Only language that computers can
understandEach computer has its own machine langue
(machine dependent)Difficult to write and read programs
4
Assembly LanguageSecond generation languageReplace machine language’s binary codes for
instructions and addresses with corresponding symbols and mnemonics
1:1 matchTranslated by assembler More technical and fasterBut less flexible and user friendly (not easy
to read)
5
High Level Languages 1Less machine dependentMore readable (closer to human languages
and farther away from machine language) and flexible
But less efficient (bigger and slower)Need to be translated into a machine
language (interpretation or compilation)
6
High Level Languages 2BASIC (Beginner’s All-purpose Symbolic
Instruction Code)FORTRAN (FORmula TRANslator) by IBMCOBOL (Common Business Oriented
Language) by ANSI. ADA, PL/1, Pascal
7
High Level Languages 3C by Bell Lab C++, and Visual CJAVA by Sun MicrosystemsWeb programming (script) languages: Perl,
PHP, Python, Ruby
8
Types of Languages 1First generation (machine language) Second generation (assembly language) Third (high level language), forth (query
languages), and fifth (natural & intelligent languages) generation languages
9
Type of Languages 2Low-level languages (i.e., machine &
assembly language) High-level languages (e.g., C and Java) Script languages (e.g., Perl, PHP, Python)
10
1st GL (Machine) 2nd GL (Assembly) 3rd GL (High level)
Mac
hine
Frie
ndlin
ess
& H
/W C
ontr
olS
ize
/ Tim
e S
pent
Larger & slower
Smaller & faster
More difficult to work with(Closer to machine)
More control of H/W(More risky to write)
Easier to work with(Closer to human)
Less control of H/W(Less risky to write)
11
Programming ParadigmsProcedural programmingObject-oriented programming Functional programmingDeclarative programming
12
Procedural Programming 1Imperative or structured languagesTells the computer what you want it to do
step by stepFORTRAN, COBOL, BASIC, C, Pascal, Ada
13
Procedural Programming 2Procedures (actions) & objects (data) are
independentPassive objects that cannot initiate an
action by itselfA subprogram (routine or module) is a
section of the program that performs a particular task when it is called from the main program.
14
Object-oriented Programming 1Active Objects have both data and
methods (procedures or actions)Methods are not independent of but belong
to the active object.Objects need stimulus to perform actionsVisual Basic, Visual C, C++, Java, SmalltalkEven in script languages (PHP & Python)
15
Object-oriented Programming 2A class is a abstract blueprint of objects
that have data and methods An object (instance) is an (actualized)
instance of the class (variables + actions)A class of human beings (name, gender,
height… + eating, sleeping, speaking …)An object of human beings (Seohyun,
170cm, 40Kg … + eating milk, … )
16
Object-oriented Programming 3class human {
public name …
public height …
…
function eating (…) {
…
}
function studying (…) {
...
}
…
} // end of class
17
Object-oriented Programming 4Inheritance: a class can inherit from other
classes. A class student inherits data and methods from a class human being and has its own data and methods
Student = human beings + student’s data and methods
Faculty = human beings + faculty’s data and methods
Staff = human beings + staff’s data and methodsCodes are reusable (minimize redundancy)
18
Object-oriented Programming 5Data abstraction and decoupling:
separating objects from classesEncapsulation and information hiding: Data
are bound closely with their methods. Polymorphism enables to define methods
with the same name that do difference things depending on classes.
A work() may mean teaching in a class faculty but farming in a class farmer.
19
Functional ProgrammingDefine primitive functions and combine
them to keep creating new functions LISP (LISt Programming) & Scheme
20
Declarative ProgrammingLogical reasoning to answer queriesUse deductive logic PrologReport generators: query languagesQuery languages: SQL (structured query
language)Application generators: Visual Basic,
FOCUS
21
Declarative languagesDefine computation logic Logical reasoning to answer queries use
deductive logics Used in artificial intelligenceFourth generation languageProlog (PROgramming in LOGic)Query languages: SQL (structured query
language) and Report generators
22
Language Translators
23
Language Translators 1Computer can understand machine
languages only Language translators translate source
codes into the machine language.A source code file needs to be compiled
and linked to be an object file, executable file in a computer.
24
Language Translators 2Lexer reads a source code (program)
character by character and assembles characters into reserved words (token)
Parser performs syntactic analysis and converts tokens to nodes on a syntax tree.
Code generator produces segments of machine code of each node.
Optimizer inspects machine codes and eliminates redundancies.
25
Language Translators 3Assembler translates a assembly programsInterpreter (interactive)Compiler (non-interactive, batch)
26
InterpreterInteractive way of communicating between
users and machines.Translates each line of the source programs
or translates instructions one by one and return the result promptly.
Java source Bytecode by Java compiler interpreted by JVM emulator
BASIC, LISP (LISt Processor) by MIT for artificial intelligence
27
CompilerCompiler translates a whole source code
into an object code before executing it.Most high level languages (e.g., C and
Java) are translated by their compilers.Source code Object file Linking
libraries Executable fileA library is a collection of commonly used
modules that are combined into the executable file.
28
Computer Software (Program)A collection of well organized instructions that
a computer executes to achieve specific tasks.
Algorithm or logic is a set of ordered steps to solve a problem.
Programming and coding (writing statements) is only a part of system development
29
Software Development
30
Software Development In the system development stage, when
customized software is needed Program development life cycle (PDLC)
1. Problem clarification2. Program design3. Program coding4. Program testing5. Program documentation and maintenance
31
Problem ClarificationObjectives and users (programming needs)Output to be produced by the systemsInput required to get the desired outputProcessing to transform input to output Feasibility (e.g., budget, man powers,
modification of old program?)
33
Design the ProgramProgram logic in structured programming;
modularization (subprogram or subroutine)Design details Pseudo-code (narrative outline) FlowchartsControl structure (logic structure),
sequence, IF, case, iteration or loop (DO, FOR, WHILE)
Structured work-through to review
34
FlowchartStart
End
Read x
sum = 0i = 1
If i <= x
sum = sum + i
i = i + 1
Print sum
No
Yes
35
Components of a Program Variables (data type, constant, variable
declaration and initialization)Input and outputExpression (operators)Statements (assignment, compound
statement, control statements)Subprogram: variables, parameters, call by
value, call by reference
36
Control StructuresSequence control Repetition (Loop)
If (score > 90) {
grade = “A”;
} elseif (score > 80) {
grade = “B”;
} else {
grade = “C”;
}
for (i=1; i<x; 1) {
sum = sum + i;
}
while (i<x) {
sum = sum +1;
i = i + 1;
}
37
CodingA process of writing a program using a
proper programming languageThe result is a source code (program file in
the text format)Follow coding standardsDocumentation (comments or remarks)
makes it easy to understand and check mistakes.
38
CompilingInterpret a source code (program file) and
convert into an object fileSource code Compiling Object file
(object module) Linking Executable file (load module)
Linking combines object files and built-in libraries (commonly used modules)
39
DebuggingA process of checking and correcting errors
(bugs) in a programErrorsSyntax errorLogic error in the logic of a programRun-time error occurs while a program is
running
40
Software TestingTo check if the software meets the
requirements and works as expectedUnit testing (component testing),
integration testing, system testing, and acceptance testing
Running programs with test data Alpha test at developers’ siteBeta test or pre-release test (outside test)
41
Implementation and MaintenanceImplementation to run the program on the
information systems Installation and compatibility testsMaintenance (updating)
42
DocumentationDescription of the program developmentData dictionaryDocumentation for usersDocumentation for operatorsDocumentation for programmersDocumentation in source programs
43
ConclusionSoftware development is not the same as
coding (programming).Importance of software test .Documentation in all stages.
44