Download Data Storage - Fundamental of Computer - Handout | CECS 230 and more Study notes Computer Science in PDF only on Docsity! Chapter 1 – Data Storage Boolean Operations o AND (^) o OR (v) o XOR o NOT Flip-flop circuit = circuit built from gates that can store one bit Mass Storage o Magnetic Discs Constant angular velocity with track divided into sectors o CD-ROM Constant linear velocity with one continuous track o Magnetic Tape Sequential access – not random access o Flash Memory Finite number of read/write cycles, not subject to magnetic fields Binary Numbers o Binary: 11012 o Decimal: 1310 o 2’s Complement Notation 1st bit = sign bit (0: positive, 1: negative) Toggle bits Add 1 Then, transfer as usual o Overflow Adding two positive numbers yield a negative number Adding two negative numbers yield a positive number o Hexadecimal notation Binary Hexadecimal Decimal 0000 0 0 0001 1 1 0010 2 2 0011 3 3 0100 4 4 0101 5 5 0110 6 6 0111 7 7 1000 8 8 1001 9 9 1010 A 10 1011 B 11 1100 C 12 1101 D 13 1110 E 14 1111 F 15 o Floating Point Notation 1st bit = sign bit (0 = positive, 1 = negative) Bit 2,3,4 = exponent Bit Pattern Value 111 3 110 2 101 1 100 0 011 -1 010 -2 001 -3 000 -4 Bit 5,6,7,8 = mantissa CHAPTER 2 – Data Manipulation Main Memory -> Bus -> Cache -> Registers (slowest -> fastest) Easier to understand and more efficient o Recursive – call themselves, repeating the set of instructions as a sub-task of itself Searches o Sequential – start at first element and query each consecutive element until you: 1) find target 2) reach end o Binary – requires an ordered list, start at center element and subdivide until: 1) 0 elements are left 2) find target o Binary search is generally more efficient Big “O” Notation o Classifies algorithms according to complexity in time or space o f(x) = O(g(x)) if lim n→∞ |f (n)/g (n)|<∞ o Typical BigO Complexities (Best -> Worst) O(1) -> getting specific element from list O(log2n) -> Binary Search, dividing list in half O(n) -> scanning a list O(nlog2n) -> MergeSort O(n2) -> Bubble Sort, Matrix/Vector multiply, Insertion Sort O(nc) -> nested for loops(c levels) O(cn) O(n!) o Time to solve problem depends on data Average-case time Best-case time = data is well suited for algorithm Worst-case time = data is such that algorithm performs poorly (time-wise) CHAPTER 7 – Software Engineering Development Phases o Requirements Specifications Determines business objectives Understands customers’ needs and wants Goal is to specify what services the proposed system will provide and identify any conditions on those services Prototyping – visual side of program with no guts UNDERSTAND PROBLEM BEFORE CODING o Design Creating a plan for the construction of the proposed system Modularity Separate things into specific sections Difficult to understand entire systems Ideally only need to understand a few modules to correct a bug Information Hiding Limit access as much as possible NO global variables unless constants Limit access to variables, data, and internal logic Coupling Limit dependencies between modules Control coupling – one module calling another Data coupling – data being used in multiple locations Minimize coupling -> more modularity Cohesion How focused the responsibilities of a module are Logical cohesion – logically similar tasks in one module Functional cohesion – all parts of a module are focused on a single activity Increase cohesion -> decrease coupling o Implementation Actual writing of the programs, creating of data files, and development of databases Take the design specifications and code o Testing Successful test identifies a bug Impossible to test all paths Equivalence classes Similar inputs that vary (i.e. +/-) can lead to discovery of bugs Use data relative and applicable to the use of the program Boundary Testing Values close to limits are most error prone Check barely valid and invalid values Black Box Testing Testing is done supplying inputs to mysterious code Performed from users point of view Usually tested with actual users of the system and checked on system level and component level White Box (Glass) Testing values based on code Applied to unit test Spotting possible bugs based on the code Basis Path Testing Test every line of code Develop inputs that will run through all possibilities that could exist within your code No line should be left untouched or unexecuted after development Test Coverage Applications that attempt to test your code and run it through all possibilities to break the code Alpha/Beta Testing Alpha = early release within company or organization for testing Beta = early release to public Pros: Others find bugs, promotes product before official release Waterfall Method: Requirements Design Construction Integration Verification Installation Maintenance Iterative Model Initial Planning -> Planning -> Requirements -> Analysis & Design -> Implementation -> Testing -> Evaluation -> Deployment o BOLD: Repeated if necessary Extreme Programming Style of programming used to help develop, design, implement, test, and finalize programs Simplicity Making modules or functions simple and not adding extra “clunk” code in order to create simple yet effective designs Pair Programming Two programmers, one computer One codes while the other watches and tries to catch for any bugs or issues that could arise Slow, but less bugs in code Unit Testing Helps locate and narrow down manageable chunks of code to identify bugs Regression tests prevent the bug from re-entering the code Continuous Integration Nightly builds are done on the code to ensure that no bugs are issues, no one can leave until it works DOCUMENT, DOCUMENT, DOCUMENT CHAPTER 8 – Data Abstractions Joins tables together in large database EX. FROM table1 JOIN table2 ON table1.colX = table2.colY CHAPTER 11 – Artificial Intelligence (AI) AI -> originally aimed at mimicking human intelligence Search Trees o Depth First Search Traverse child, before siblings o Breadth First Search Traverse siblings first, then children Heuristics o Two Requirements: Efficient -> if the heuristic is slow, it may be more efficient to construct the entire tree and look at every state Accurate -> if the accuracy is questionable, wrong paths more often will be taken Machine Learning o It is finding patterns in large amounts of data Artificial Neural Networks o Each input is multiplied by a weighting factor o Output is 1 if sum of weighted inputs exceeds the threshold value, 0 otherwise o Network is programmed by adjusting weights using feedback from examples Nearest Neighbor o Most simple algorithm may be the Nearest Neighbor algorithm o Steps Memorize every training example Classification involves searching through all examples to find closest match Output class of closest match o Very fast to train. Simply save the data set. o Can be very slow to classigy new examples, but very simple to implement OTHER AREAS TO STUDY Student Presentations ESSAY: In a hypothetical situation our university must close one of three departments: Accountancy, Emergency Medicine, or CECS. Defend the CECS department. Consider the claims of the other departments. Be sure to answer the underlying question: How does society benefit from a software engineer?