IT 1113 Module 1: Introduction to Programming

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

abstraction

displaying only essential information and hiding the background details

tractable algorithms

easy algorithms that can be run in O(n^x) time

the accumulator is ____________ each memory location

equal to

Program Life Cycle

introduction, growth, maturation, saturation, decline

_________ of procedures that are already written are available for all sorts of tasks

libraries

modal programs/user interfaces

means "it has modes" - asks for input when ready - user follows its lead - user can't provide any input other than what's being requested - easier to write, but harder to learn and use - good for novice users being guided by tutorial and decision support systems where the user doesn't know which questions should be asked

non-modal programs/user interfaces

user driven and not restricted like modal programs; has driven the creation of modern Graphical User Interfaces (aka windowing systems)

debugging

using information from testing to find errors and correct program behavior

why client-server?

- allows us to divide programming effort - clients and servers can run on machines that are well-matched to their respective tasks - without proper planning both client and server are inherently scalable - vendor-independence is increased - with networking, server can be located anywhere

issues with client-server programming

- complexity and coordination of development - keeping protocol consistent between client and server - security, authentication, and confidentiality - distribution and maintenance of client HW and SW - client's function are highly dependent on HW and OS; applications can interfere with each other and users tend to customize/modify/install SW which breaks things in the process - vendors, API's, and GUI's can change

implementing an algorithm: computation

- data movement - arithmetic operations - call a procedure that returns a value

How is the World Wide Web an example of a client-server application?

- framework for client (browser) is simple, mostly standardized, and open; it is cheap with a flexible graphical interface -server is also simple, mostly standardized, and open; it can provide access to other services, including legacy applications - additional components of the client applications are downloaded (HTML, Java applets, ActiveX controls) as needed from the server

what do interpreters do?

- interpret a problem-oriented language directly (some Basic, Pascal, perl) -interpret a less-machine-dependent language (Java) -interpret a different machine language (SoftPC and Virtual PC on Macs) -make executable code portable because they can make hardware appear to understand a different language

the server

- listen for requests from clients - receive a request from client - perform task in response to requests (e.g. data retrieval, data storage, calculations) - return the results to the requesting client

implementing an algorithm: flow control

- make a decision - transfer control - repeat statements until a condition is false - call a procedure

typically, a machine language is...

- procedural - coded in binary - defined by the manufacturer of the CPU chip - not very pleasant for humans to deal with - the only thing a computer can "understand"

how do procedures provide abstraction?

- provide what appear to us to be new machine instructions - although the computer still has to execute all the instructions, the programmer doesn't have to rewrite them and the re-used instructions don't take up extra space in the computer's memory

how are clients and servers typically run?

- run on separate hardware, connected via a network - client runs on cheaper desktop machines which support a GUI - server runs on one or a few more expensive computers due to high reliability and speedier network -client and server programs have to carefully define how they will talk (protocol) and must agree on format, data, type of requests, and type of results - similar to an API but with procedure calls between processes, usually across a network, and a "remote procedure call" (RPC)

When you know how to read programs, you can....

- understand process of SW development - make minor modifications to existing programs - communicate effectively with programmers - understand problems involved in the SW design process - generate effective test data for programs - better support end-users using the programs

the client: human-computer interface (HCI)

-presents info to user - collects info from user - concerned about being easy to use - often provides a GUI

variable types

1. INTEGER (CARDINAL): numbers only 2. FLOATING POINT (FRACTIONAL): numbers only 3. CHARACTER: letters, punctuation, etc. 4. STRUCTURES: arbitrary combinations of the above data that should be kept together

when writing programs, we usually depend on...

1. a compiler or assembler (program) to translate human-friendly programs into a form the hardware can interpret 2. an operating system to load/transfer control to the program, handle the particular details of our hardware, and provide easy access to information stored in RAM or on disks

using an object

1. first request that an instance of an object be created, supplying the necessary data in our message 2. the object class allocates storage for space for a unique copy of its data that will belong to this instance 3. receive an object identifier (aka handle or pointer) that uniquely identifies this particular object instance 4. we can then send messages to this object instance requesting it to perform its advertised functions 5. when finished, we can ask that the object instance be destroyed which frees its storage space and makes it unusable

comparison of programming languages

1. machine language: 1012 2. assembly language: LOAD 103 3. problem-oriented language: ADD ONE TO COUNTER

How can we improve a program's life cycle?

1. recognizing the costs: computers are cheap, but software is not, and people are even less so 2. don't make the same mistakes: study similar projects and try to learn why they failed or succeeded 3. although use of formal methodologies prescribed by SW engineering doesn't guarantee success, it does help

what hardware does a real program see?

1. registers: a few really fast storage locations 2. RAM/memory: many more fast storage locations 3. disks: even more secondary storage space 4. peripheral hardware: a way to talk to the world ( mice, keyboards, adapters, etc.)

in a perfect world, a program's life cycle would go through the following stages:

1. requirements analysis: what problem do we need to solve? 2. design: how will we solve it? 3. coding: explain the design to the computer 4. testing: make sure we got steps 1-3 right 5. documentation, training, and delivery 6. production: use what we've built 7. maintenance: smaller versions of the previous steps to deal with changing requirements, business climate, laws, etc.

how do we use a compiler?

1. start with an algorithm and write it in the appropriate language 2. type the program into a file using a text editor, The contents of this file is called "source code" 3. run the compiler to translate the source code into object code (machine language) 4. Depending on your environment, you may use a "linker" to combine your program with other system-supplied programs to generate an "executable" object code file. (This is finally your program in a form that can be loaded into the computer's memory and execute) 5. ask the operating system (program) to load your executable object code file into memory and point the CPU's program counter at it (aka, double click it)

classes of algorithms

1. traceable 2. intractable 3. non-computable

characteristics of program testing

1. we can demonstrate the presence of bugs but not their absence 2. planning a group of test to verify correct operation is an essential but inexact process (too slow to try all possible inputs to verify correct outputs) 3. programs must be re-tested when they are modified to catch any bugs introduced

layers of computer interface

A. user interface (SW) B. application (SW) C. problem-oriented language (SW) D. assembly language (SW) E. operating system machine language (SW/HW) F. machine language (SW/HW) G. microarchitecture (SW/HW) H. digital logic (HW) I. semiconductor physics (HW) J. quantum mechanics (HW)

bug

An error in a program that prevents the program from running as expected.

compilers vs. interpreters

COMPILER: 1. understand meaning of program in the source language 2. generate a program with the same meaning in the object language INTERPRETER: 1. understand meaning of program in the source language 2. take the actions requested by the source program 3. tend to be slower than complied languages because they must translate each instruction every time they execute it

true or false: executable code files are portable.

FALSE; unless another computer system is compatible at the OS and machine langauge level, the executable code won't work there because it's machine language code is specific to that machine

firmware

Software that is permanently stored in a chip (built into the hardware).

memory allocation

The assignment of storage of the values of variables -when is the storage allocated -when is the storage released - what if you use more than was allocated?

interpreter

a computer program that directly executes (performs) instructions written in a programming language without requiring the instructions to be previously; instead of translating the program they take the actions it requests directly.

linker

a computer program that takes one or more object files generated by a compiler and combines them into a single executable file, library file, or another object file.

non-procedural program

a description of the desired result of a task

software engineering

a disciplined approach for constructing information systems in a systematic method through the use of common methods, techniques, or tools

object-oriented programming

a method of further abstracting and hiding details

client-server programming

a method that provides abstraction and encourages the application of multiple computers to a single task; requests go to the server from the client, and results are returned to the client from the server

algorithm

a method, procedure, or recipe for doing a job; usually has inputs, and outputs which are the results of its actions

procedural program

a set of instructions describing the steps of a task

event-driven (user-driven) programming

a way of organizing a program to be more responsive to a human user

Why might one still write a program in assembly language?

although it is more time consuming, it gives the programmer more control and higher performance

intractable algorithms

can be processed for very small collections of data, but after the first few data items the times become prohibitively large

Application Program Interfaces (API)

collection of procedures and data structures which your program can access; world wide standard that defines things like "printf" and "scanf" ex: windows 3.1, windows 32, macOS, UNIX

difference between run-time and compile-time

compile-time: the process of compiling source code into machine code in order to create an executable program; a compile-time error is usually a syntax error or missing file that prevents the program from successfully compiling run-time: when the application/program is opened and running; run-time errors occur when the program is running, but has bugs. Examples include features that don't work, program crashes, unexpected program behavior, etc.

operating systems

covers up much of the hardware detail (abstraction); very complex collections of procedures; load executable code into memory ; handle most aspects of controlling hardware; handle file system organization; provide services for interacting with users; resource allocation and sharing

variables

name for a storage location; the compiler and linker keep track of variables, and they can come in different shapes and sizes

a _______________ language is used for most commercial programming today

problem-oriented

each type of event activates a different family of ___________

procedures -ex: clicking the mouse-left-button-down key (event) triggers a procedure where the identity of the screen object is recorded and it is either highlighted or dragged if the object is moveable

program counter

register that contains the memory location number (ADDRESS) of the next instruction

accumulator

register that holds a number for doign arithmetic operations

variable declarations

signals to the compiler to: - leave room in memory for data items - assigns programmer-friendly names to computer-friendly storage locations -remember what type of data is supposed to go there in can we mistakenly try to put something else in that location

procedures (subroutines, functions)

structuring mechanism given by most languages that allow us to create our own instructions; allow us to reuse code

testing

tells us both whether our program does what it was designed to do AND whether our design solves the problems it was intended to solve

programming language semantics

the meaning of the words and symbols once they've combined according to the syntax rules; compilers have a harder time catching semantics errors than syntax errors because it is derived from natural language as opposed to computer-processable language

hardware

the parts of the computer you can touch

software

the programs and data that tells the hardware what to do

syntax

the set of rules for combining the words and symbols into legal language phrases; compilers are pretty good about recognizing and complaining about a program's syntax errors

assemblers

translate assembly languages: - translate operation codes and keep track of memory location assignments - assembly programmers must know a great deal about the details of the computer's machine language (architecture) - a program must be rewritten to run on a computer with a different machine language

compiler

translate problem oriented languages: -a statement in a problem oriented language usually translates into many machine instructions - compilers keep track of many things like use of storage locations, access to OS services, and access to other programs -some compilers translate into assembly language


Kaugnay na mga set ng pag-aaral

Cardiovascular System, Blood, and Lymphatic Systems EAQs

View Set