diff options
author | lshprung <lshprung@yahoo.com> | 2021-01-05 10:07:52 -0800 |
---|---|---|
committer | lshprung <lshprung@yahoo.com> | 2021-01-05 10:07:52 -0800 |
commit | 64123cb1cb10e210b23146237cab5ee81f9c6311 (patch) | |
tree | 35f73207170e71e2a86a052de938d6a999d2a33a |
First commit
-rw-r--r-- | 01-05.md | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/01-05.md b/01-05.md new file mode 100644 index 0000000..6783f60 --- /dev/null +++ b/01-05.md @@ -0,0 +1,115 @@ +# 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 |