Programming. What is a Program ? Sets of instructions that get the computer to do something...

18
Programming

Transcript of Programming. What is a Program ? Sets of instructions that get the computer to do something...

Page 1: Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.

Programming

Page 2: Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.

What is a Program ?

• Sets of instructions that get the computer to do something

• Instructions are translated, eventually, to machine language using an interpreter or a compiler

• Programs may be a few lines or millions of lines of code

Page 3: Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.

Programming Tasks

• All computer programs are written so they can take data, manipulate it and then produce a result.

• This process uses three distinct tasks:– INPUT – getting data from an external source (the user, a database, a

file, etc.)– PROCESSING – actual manipulation of the data– OUTPUT – reporting the results of data manipulation back (using the

monitor, writing information to a database, etc.)

Page 4: Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.

Relationships in Programming

• Programmer – The person who solves a problem by providing a solution through writing instructions (the program) for the computer. (AKA – The developer)

• User – Any person who uses a program written by a programmer

Page 5: Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.

Programming Languages

• Machine Language– Binary digits (bits – 1s and 0s) which are translated to electrical

impulses that get the computer to do something– “Native” language of computers

• Assembly Languages– Group of basic commands which are more like English– Tied to specific processors– Still need to be translated to machine language

Page 6: Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.

Categories of Languages

• High Level Languages– In terms of syntax, very close to human language

(mostly English)– Lower error rate than writing machine language or

assembly language programs– Need to be translated to machine language before

execution• Compilers• Interpreters

Page 7: Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.

More on HLL’s

• Operations common to all HL languages:– Sequential Operations – Operations in which lines

of code execute in order, one right after another– Conditional Operations – Operations in which

execution depends on the outcome of a previous condition (usually evaluated to be TRUE or FALSE)

– Looping Operations – Operations designed to repeat until a given condition is satisfied.

Page 8: Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.

Even more on HLL’s

• Procedural Languages – Early high level languages– Focus on structures– Examples include QuickBasic, Fortran, Pascal,

Visual Basic (early versions)• Object-Oriented languages (OOP)– More recent development– Focus on data, not structures (Primacy of Data)– Examples include Java, C#, C++, Visual Basic.Net

Page 9: Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.

Still More on HLL’s

• A high-level language program needs to be translated into a lower level language

• Compiler : software (i.e. a program itself!) that translates a high-level language program (source code) into a lower level language

• Example: a compiler for the high-level language C translates a C program into a machine language program (executable code)– Why? a computer can only execute machine language

instructions …

Page 10: Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.

Programming Development Cycle

• Done after identifying inputs, processing & outputs

• Steps1. Analyze the problem2. Plan a solution to the problem (algorithm)3. Design the user interface4. Code the solution5. Test and debug the solution6. Complete program documentation7. Begin to plan for next release (start Cycle again)

Page 11: Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.

1. Analyze the Problem

• Questions to ask:– Who is my intended audience?– What SPECIFIC outcomes does my audience

expect?– What business rules is my audience expecting to

have incorporated into the solution?– What is the SCOPE of the problem?

Page 12: Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.

2. Plan a Solution (Algorithm)

• What types of programming structures are needed?– Sequential structures– Conditional structures– Looping structures

• What data structures are needed?– Variables– Lists– Arrays

Page 13: Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.

2. Plan a Solution (Algorithm)1. Identify the Inputs

– What data do I need?– How will I get the data?– In what format will the data be?

2. Identify the Processes:– How can I manipulate data to produce meaningful results?

3. Identify Outputs:– What outputs do I need to return to the user?– What format should the outputs take?

4. Identify relevant modules– How can I break larger problems into smaller, more manageable

pieces?– What inputs do the modules need?– What processes need to happen in the modules?– What outputs are produced by the modules?

Page 14: Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.

3. Design the User Interface

• AKA – The “UI”• Is the UI “learnable”?• Is it simple? (Limit user choices)• Does the UI promote error-proof use?• Is the layout of the UI arranged in a fashion

conducive to the user’s culture and expectations?

Page 15: Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.

4. Code the Solution

• Develop an actual program from an algorithm• Should be the “easiest” part of the process –

all the work should already be done!

Page 16: Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.

5. Test and Debug the Solution

• Alpha Testing – Internal testing done with expected client data (NOT LIVE DATA)

• Beta Testing – Testing done at the client site with their data (USUALLY LIVE DATA)

• Try to predict common user errors• Test subjects should be Power Users, Normal

Users and Neophytes

Page 17: Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.

6. Complete Documentation

• User Documentation:– User Manual– Technical Documentation (for System Administrators)

• Internal Documentation:– Documentation comments– Code comments– Procedural comments– Should be done while coding!

Page 18: Programming. What is a Program ? Sets of instructions that get the computer to do something Instructions are translated, eventually, to machine language.

7. Plan Next Release

• What bugs need to be fixed?– Are bugs “critical”? (Need to be fixed in a minor

release)– If bugs are not critical, they can be fixed in next

major release• What product enhancements do the users

want for the next release?