+ All Categories
Home > Documents > Powered by DeSiaMore1 Programming Concepts David T. Makota Department of Computing & Information...

Powered by DeSiaMore1 Programming Concepts David T. Makota Department of Computing & Information...

Date post: 25-Dec-2015
Category:
Upload: dora-allen
View: 213 times
Download: 0 times
Share this document with a friend
Popular Tags:
26
Powered by DeSiaMore 1 Programming Concepts David T. Makota Department of Computing & Information Technology (CIT) The Institute of Finance Management Dar Es Salaam, Tanzania
Transcript

Powered by DeSiaMore 1

Programming Concepts

David T. MakotaDepartment of Computing & Information Technology (CIT)

The Institute of Finance ManagementDar Es Salaam, Tanzania

Powered by DeSiaMore 2

Contents

• Computer programs

• Programming

• Programmer

• Programming languages

Powered by DeSiaMore 3

COMPUTER PROGRAMS

• A computer program is one or more instructions that are intended for execution by a computer.

• Computer programs may result from the compilation or interpretation of programming languages, direct result of hardware processing, or manually input to the central processor of a computer.

• A computer program does nothing unless its instructions are executed by a central processor.

Powered by DeSiaMore 4

Computer programs: cont

• A computer program expressed in a human-readable computer programming language is source code.

• Source code may be converted into an executable image by a compiler, or executed immediately with the aid of an interpreter.

• Compiled computer programs are commonly referred to as executables, binary images, or simply as binaries — a reference to the binary file format commonly used to store the executable code.

Powered by DeSiaMore 5

Computer programs: cont

• Computer programs are generally specified using declarative, imperative, or visual programming methods.

• With the imperative approach, an algorithm is specified

• with the declarative approach, the output is specified and the implementation details are hidden.

• With a visual approach, program elements are graphically manipulated rather than specified textually.

Powered by DeSiaMore 6

Computer programs: cont

• Computer programs may be categorized along functional lines. These functional categories include application software, operating systems, video games, and compilers, among others.

• Computer programs embedded in hardware devices are called firmware.

Powered by DeSiaMore 7

Computer programs: cont

• Program execution– Typically, computer programs are stored in non-volatile

memory until requested either directly or indirectly by the computer user to be executed.

– Upon such a request the program is loaded into random access memory where it can be accessed directly by the central processor.

– The central processor then executes ("runs") the program, instruction by instruction, until termination, either by a successful self-termination or by either a software or hardware error.

– Modern day multiprocessor computers or computers with multicore processors may run multiple programs on a single computer simultaneously.

Powered by DeSiaMore 8

Computer programs: cont

• Computer programs can be divided into two categories– Application software

• is a subclass of computer software that employs the capabilities of a computer directly and thoroughly to a task that the user wishes to perform.

– System software • is a generic term referring to any computer software which

manages and controls the hardware so that application software can perform a task.

Powered by DeSiaMore 9

Computer programs: cont

• Two Views of a Programuser

interface

software layers hidden by user

interface

user’s view

programmer’s view

Powered by DeSiaMore 10

Computer programs: cont

• Real world examples:– library catalogue– word processor– video game– ATM

Powered by DeSiaMore 11

PROGRAMMING

• Computer programming is the iterative process of writing or editing source code of computer programs, followed by testing, analyzing and refining this code.

• MANY ASPECTS OF PROGRAMMING– Programming is controlling

• computer does exactly what you tell it to– Programming is teaching

• computer can only “learn” to do new things if you tell it how– Programming is problem solving

• always trying to make computer do something useful — eg: finding an optimal travel route

Powered by DeSiaMore 12

Programming: cont

• Many aspects of programming: cont– Programming is creative

• must find a good solution out of many possibilities

– Programming is modelling• describe salient (relevant) properties and behaviours of a system of

components (objects)

– Programming is abstraction• identify important features without getting lost in detail

– Programming is concrete• must provide detailed instructions to complete task

Powered by DeSiaMore 13

PROGRAMMER

• A programmer or software developer is someone who programs computers, that is, one who writes computer software.

• The term computer programmer can refer to a specialist in one area of computer programming or to a generalist who writes code for many kinds of software.

• One who practices or professes a formal approach to programming may also be known as a programmer analyst, software engineer, computer scientist, or software analyst.

Powered by DeSiaMore 14

Programmer: cont

• Application versus system programming– Computer programmers often are grouped into two broad

types: applications programmers and systems programmers

– Applications programmers write programs to handle a specific job, such as a program to track inventory within an organization.

– Systems programmers, in contrast, write programs to maintain and control computer systems software, such as operating systems and database management systems.

Powered by DeSiaMore 15

PROGRAMMING LANGUAGES

• A programming language is an artificial language that can be used to control the behavior of a machine, particularly a computer.

• Programming languages, like natural languages, are defined by syntactic and semantic rules which describe their structure and meaning – syntax: grammatical rules for forming instructions– semantics: meaning/interpretation of instructions

Powered by DeSiaMore 16

Programming languages: cont

• programming languages allow you to expressyourself more precisely than natural language– as a result, programs cannot be ambiguous

Powered by DeSiaMore 17

Programming languages: cont

• Categories of programming languages– Machine language

• machine is short for computing machine (i.e., computer)• computer’s native language• sequence of zeroes and ones (binary)• different computers understand different sequences• hard for humans to understand:

01010001...

Powered by DeSiaMore 18

Programming languages: cont

• Categories of programming languages– Assembly language

• mnemonics for machine language• low level: each instruction is minimal• still hard for humans to understand:

ADD.L d0,d2

Powered by DeSiaMore 19

Programming languages: cont

• Categories of programming languages– High-level languages

• FORTRAN, Pascal, BASIC, C, C++, Java, etc.• high level: each instruction composed of many low-level

instructions• closer to English and algebra• easier to read and understand:

Powered by DeSiaMore 20

Software Development: A 5-Step Process

The Waterfall Model

Powered by DeSiaMore 21

Software Development: cont

1) Analysis– English description of system models, to meet a

requirement or specification– work with potential users to develop detailed

specifications• May be written by non-programmer

Powered by DeSiaMore 22

Software Development: cont2) Designing the system

– divide & conquer: system is composed of smaller subsystems which in turn may be composed of even smaller subsystems

– pseudocode: somewhere between English and program code• describe tasks, subtasks, and how they relate

– hand-simulation: desk-check pseudocode by stepping through it without using a computer

– often use diagrams to better communicate the structure of the system

Powered by DeSiaMore 23

Software Development: cont

3) Implementing the design– emphasis on good problem decomposition, well

structured design, and readable, well-documented programming style

– hand-simulate as you go, may need to backtrack and redesign

– if design is good, most of the hard work should be done

Powered by DeSiaMore 24

Software Development: cont

4) Testing and Debugging– testing: submitting input data or sample user

interactions and seeing if program reacts properly– typically done in stages, starting with individual

components and working up to subsystems, and eventually the entire program

– debugging: process of removing program bugs– bugs: errors in code or design

Powered by DeSiaMore 25

Software Development: cont

5) Maintenance– finally, keep the program working and current– in a successful piece of software, maintenance is

often said to be 80% of the effort

• Result: Working program– solves original problem

Powered by DeSiaMore 26

Software Development: cont

• Good program– satisfies the specification– produced on time and within budget– user-centric design– uses creativity to solve problem– well structured/organized/written/documented– can be easily extended and maintained


Recommended