summaryrefslogtreecommitdiff
path: root/01-05.md
blob: 1c4eb0b5644916584de35b398aa684ab85c5b9d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# Object-Oriented Programming and Advanced Data Structures

### Data Structure

- Why?
	- Allows for organizing data, which in turn allows for efficient access to data
- What?
	- Various examples (list, stack, queue, tree, graph, etc.)

### Abstract Data Type vs. Data Structure

- In computer science, an **abstract data type (ADT)** is a mathematical model for data types
	- a data type is defined by its behavior (semantics) from a **user POV** of the data
	- specifically in terms of possible values, possible operations on data of this type, and the behavior of these operations
	- examples: int, float, etc.
- **Data Structure** is the representation of data from **implementer POV**

---

## Introduction - Phases of Software Development

### Software Phases

- Specification of the task
- Design of a solution
- Implementation (coding) of the solution
- Analysis of the solution
	- Analyze time and space complexity
- Testing and debugging
	- This is arguably the most important phase
- Maintenance and evolution of the system
- Obsolescence

### Implementation Phase

1. Design
	- Discuss Concept & Design Strategy
	- Requirements Analysis
	- System Architecture
	- Roadmap
2. Develop
	- Technical Specification
	- App Development
3. Deliver
	- Testing
	- Delivery & Launch

---

## Testing the Code

### Program Testing

- Part of the science of software engineering is the systematic construction of **a set of *good* test inputs that is likely to discover errors**
- GOOD test inputs have two properties:
	- Positive verifications: you must know what output a correct program should produce for each test input
	- Negative verifications: the test inputs should include those inputs that are most likely to cause errors

### Testing Methods

- Boundary Checking
	- `int time_check(int hour);`
- Fully Exercised Code
	- Make sure that **each line of your code is executed at least once** by some of your test data
	- If there is some part of your code that is sometimes skipped altogether, then make sure that **there is at least one test input that actually does skip this part** of your code

### Testing Stages

- Unit Testing
- Integration Testing
- System Testing
- Acceptance Testing
- Performance Testing
- Security Testing
- Usability Testing
- Compatibility Testing

### Example

- write a test for

```
//prerequisite: N <= array1 length
//prerequisite: N <= array2 length
int *add_array(int *array1, int *array2, int N){
	int i;

	for(i = 0; i<N, i++){
		array1[i] += array2[i];
	}
	
	return array1;
}
```

1. Positive Verification: Two arrays with the same size, and N = the length of the arrays
2. Negative Verification: Pass an N that will go out of the bounds of at least one of the arrays
3. Positive Verification: Two arrays with different size, and N is less than the size of the smaller array

---

## Standard Library

### STL

- **Standard Library** aids programmers in writing portable code that can be compiled and run with many different compilers on different machines
- To use one of the library facilities, a program places an "include directive" at the top of the file that uses the facility
	- For example, to use the usual C++ input/output facilities: `#include <iostream>`

### Standard Name Space

- **The Standard Namespace**
	- All of the items in the new header files are part of a feature called the **standard namespace**, also called **std**
	- When you use one of the new header files, your program should also have this statement after the include directives: `using namespace std;`
	- Note: There are other alternatives that we will talk about later
		- Namespaces are kind of like classes with a number of defined functions
		- `::` is the scope resolution

```
functionGlobal();    //functionGlobal belongs to the global namespace
A::functionA(); //functionA belongs to namespace A
```

---

[01/07 ->](01-07.md)