Developing Software - Programming and Problem Solving I | CECS 174, Study notes of Computer Science

Material Type: Notes; Class: Programming & Problem Solving I; Subject: Computer Engr & Computer Sci; University: California State University - Long Beach; Term: Unknown 1999;

Typology: Study notes

Pre 2010

Uploaded on 08/18/2009

koofers-user-dsf
koofers-user-dsf 🇺🇸

10 documents

1 / 11

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CHAPTER 1
INTRODUCTION AND REVIEW
CECS 174 Programming and Problem Solving I covers the
basics of programming. After taking CECS 174, you should:
be able to write simple programs
understand the basics of C++
be familiar with simple types, structs, classes and arrays
understand how to compile and execute C++ programs
This course, CECS 274 Programming and Problem Solving II,
will focus on the tools you need to solve sophisticated problems
with the computer.
1
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Developing Software - Programming and Problem Solving I | CECS 174 and more Study notes Computer Science in PDF only on Docsity!

CHAPTER 1

INTRODUCTION AND REVIEW

CECS 174 Programming and Problem Solving I covers the basics of programming. After taking CECS 174, you should:  be able to write simple programs  understand the basics of C++  be familiar with simple types, structs, classes and arrays  understand how to compile and execute C++ programs This course, CECS 274 Programming and Problem Solving II, will focus on the tools you need to solve sophisticated problems with the computer.

An alternative name for this course might be: the design and implementation of algorithms and data structures used in computer science. Defn: An algorithm is a list of instructions to accomplish a given task. An algorithm has: ˙ 0 or more inputs ˙ 1 or more results ˙ unambiguous instructions ˙ a finite number of steps in which it terminates Defn: A data structure is a concrete organization imposed on a collection of data.

(1) Software Life Cycle (or the Engineering Process)Requirements Specification Clearly state the problem and understand what is needed for its solution.  Analysis Identify the components of the problem (input, output, etc.).  Design Create a solution to the problem and document the solution.  Develop a Test Plan Decide how the correctness of the program will be determined.  Implementation or coding Do the programming.  Testing Systematically test the program.  Operation Use the software.  Maintenance Update or modify the program.

(2) Goals of Software Engineering (or The Characteristics of “Good” Software)Correctness Does the software meet its specifications?  Predictability Does the software always behave in a predictable, understandable manner?  Understandability Can the software code be understood and maintained?  Modifiability Can the software be easily changed to meet new needs?  Reusability Can the software be used in other systems?  Efficiency Does the software make optimal use of computer resources--time, memory, I/O devices?

Strongly vs. Weakly Typed Languages Defn: A language is strongly typed if

  1. Every object (variable) in the language has a unique type that does not change during the life of the object.
  2. Each object’s type is defined (by a declaration) at compilation time so that the compiler can determine whether that object is being used correctly. C++ satisfies only condition 1. Examples:Ada is a strongly typed language.  C++ is not as strongly a typed language. SO...You must be very careful in C++.

Example Problem With Typing C++ will let you do the following: float Ans; int A, B; ... A = 7; B = 2; Ans = A / B; ... We would like the value stored in Ans to be 3.5, but C++ will do integer division on A and B. Thus, Ans will have the value 3.0. Probably not what the programmer wants! In Ada, Ans = A / B would never even be compiled successfully because Ans has a different type from A and B. Thus, this problem would not occur.

Scalar Types (or Simple Types) In a scalar type, each value has a single component. Examples:Integer types int Flavors; short ShortInt; long LongInt;  Floating-point types float Temp; double DoubleVar;  Enumeration types enum Colors {Red, Green, Blue};

Composite Types (or Structured Types) In a composite type, each value can have multiple components. Examples:Record Types (or Structures) struct SampleRec { Type1 Field1; Type2 Field2; … TypeN FieldN; };  Class Types class Class1 { public: void function1(); … private: int intVar; … };  Array Types int intArray[10]; or const int MAX =10; float FloatArray[MAX];