Programming Creating programs that run on your PC (BTW- groups of programs are called software...

13
Programming Creating programs that run on your PC (BTW- groups of programs are called software applications)

Transcript of Programming Creating programs that run on your PC (BTW- groups of programs are called software...

Programming

Creating programs that run on your PC

(BTW- groups of programs are called software applications)

Learning Objectives

1. Understand the differences between structured programming, object-oriented programming (OOP), aspect-oriented programming (AOP), and adaptive software development.

2. Identify and describe the activities involved in the program development life cycle (PDLC).

3. Understand what constitutes good program design and list several tools that can be used by computer professionals when designing a program.

Understanding Computers: Today and Tomorrow, 14th Edition

2 2

Learning Objectives

4. Explain the three basic control structures and how they can be used to control program flow during execution.

5. Discuss some of the activities involved with debugging a program and otherwise ensuring it is designed and written properly.

6. List some tools that can be used to speed up or otherwise facilitate the program development process.

7. Describe several programming languages in use today and explain their key features.Understanding Computers: Today

and Tomorrow, 14th Edition3

Breaking into Program development

1. Analysis• What should it do?

2. Design• How will it do it?

3. Develop• Creation

4. Implement• Get rid of the “bugs”

5. Maintain• Keeping it running

From SDLC, break into PDLC

Programs & Programming Computer program –

a sequence of instructions for a computer written to perform a specific task

Programming: Process of designing, writing, testing, debugging & maintaining the source code of computer programs Programs need to be designed before they can be

developed One thing to remember:

Programs use computer memory Space to Run in Space to save pieces of information in for later use

(variables)

6

Programming Languages Programming – writing a computer program

Write from scratch in selected language– write reusable code Use Software Development Kit (SDK) Use Application Programming interface (API)

Programming language A set of rules, words, symbols, and codes used to write computer

programs Programming Tools

Flowcharts, business documents, models Categories of programming languages

Low-level languages High-Level languages 4GL languages

Once written, prepare for execution (running) .exe or .dll Loads in memory Uses memory to save information (variables)

Programming Languages

Low Level

Difficult to code in; machine dependent

Machine language: 1’s and 0’s

Assembly language Includes some names and

other symbols to replace some of the 1s and 0s in machine language

High Level Closer to natural languages Machine independent – run on windows

and Mac OS’s Easier to learn Many generations (4), as time passes and

hardware gets better Translated to machine language

FORTRAN - mathematical, scientific, and engineering applications

BASIC family (BASIC, Visual Basic, VB.NET) – games to web services

COBOL - business transaction processing C family (C, C++, C#, objective C) –

mainframes, web services, iPhones Pascal – for midrange servers – taught

STRUCTURE Java - web services, applets – most popular

today Python – todays games

Languages (LOW LEVEL – HIGH LEVEL)

8

• Programmers write comments in code to explain complicated parts (ignored by computer)

• Each programming language has its own set of rules to follow• Many programming languages to choose from – 3rd gen are quite similar

9

Fourth Generation Languages

Closer to natural languages Easier to work with than high-level Much of the code written is reusable! Mostly used with:

Databases Includes structured query language (SQL) DB2, SQL Server, Oracle, Access, Foxpro,

Powerbuilder, Natural, FOCUS Apps

Software development kits (SDK’s) Web Services

Application Program Interfaces(API’s)

PROGRAMMING LANGUAGES

Programmers write out complicated logic visually – in diagrams called flowcharts

GET A NUMBER

SAVE THE NUMBER IN MEMORY

Got 2 numbe

rs?

START

RESERVE MEMORY

TELL MEMORY VARIABLE WE HAVE A NUMBER

• Variable to indicate how many numbers we have gotten• Variable to save the first number• Variable to save the second number

ADD THE NUMBERS IN MEMORY

DISPLAY SUM

STOP

NOYES

Other symbols, like an ellipse or circle, mean other things

WRITE THE PROGRAM USING

CHOSEN LANGUAGE

TRANSLATE THE PROGRAM(LANGUAGE COMPILER)

INTO MACHINES LANGUAGE

Creates .EXE

EXECUTE (RUN) THE PROGRAM

- PROGRAM LOADS IN MEMORY, and USES

MEMORY TO SAVE INFO

USERS CLICK ON ICON TO RUN “APP”

Programs can have errors • Compiler errors: Program doesn’t run

− Typically syntax errors: When the programmer has not followed the rules of the programming language

• Run time error: Error that occurs when the program is running• Usually an operation that cannot be completed

• Logic errors: Program will run but produces incorrect results

Programs use computer memory -Need “run space” Save pieces of information for later use (variables)

Approaches to Design and Development

Procedural Programming Steps to accomplish task are separated

into small modules and execute in a certain order or when needed

Object-oriented Programs consist of a collection of

objects that contain data and methods to be used with that data and are used when needed

Aspect oriented Separates functions so program

components can be developed and modified individually from one another One program does all the database work,

another program presents the web page, etc..

Adaptive Building the program in small steps of

functionalityUnderstanding Computers: Today

and Tomorrow, 14th Edition13