Computer Science Guide

From Earlham CS Department
Revision as of 21:15, 15 October 2014 by Ghcrows13 (talk | contribs) (c++)
Jump to navigation Jump to search

This guide is supposed to be useful to you. Make it as useful as it can be. Treat the information you find here as a starting place -- search for more information when necessary. That's all.


forward

This is a compilation of online resources.

  • resources can be cut and/or edited to better fit the philosophy of this guide


Guide philosophy:

  • be simple
  • help those that desire it
  • expose concepts without complexity
  • be accessible by print and web
  • provide links to all sourced information
  • be editable by those without malicious intent


It is NOT expected that you read this text sequentially or entirely.

  • use this text in whatever way benefits you most


This is NOT a supplement for a traditional academic resource such as a textbook.

notes about text

formatting

citation

  • source links are included above their quotes

note key

  • (TODO: ) is used to indicate content in need of edits

composition

  • All content is kept simple.
  • Readability and conciseness is critical. It is the point of this guide.
  • Ideally this guide will be contained in a single wiki page.

sources

Wikipedia is relied upon heavily as it was the fastest way to get this project going. Additional sources are welcome to be incorporated where appropriate.

software

overview

http://en.wikipedia.org/wiki/Computer_programming

Programming is a process that leads from an original formulation of a computing problem to executable programs. It involves activities such as analysis, understanding, and generically solving such problems resulting in an algorithm, verification of requirements of the algorithm including its correctness and its resource consumption, implementation (commonly referred to as coding[1][2]) of the algorithm in a target programming language. Source code is written in one or more programming languages (such as C, C++, C#, Java, Python, Smalltalk, JavaScript, etc.). The purpose of programming is to find a sequence of instructions that will automate performing a specific task or solve a given problem. The process of programming thus often requires expertise in many different subjects, including knowledge of the application domain, specialized algorithms and formal logic.


design

http://en.wikipedia.org/wiki/Software_design#Software_Design

Software design is both a process and a model. The design process is a sequence of steps that enable the designer to describe all aspects of the software to be built. It is important to note, however, that the design process is not simply a cookbook. Creative skill, past experience, a sense of what makes “good” software, and an overall commitment to quality are critical success factors for a competent design.

The design model is the equivalent of an architect’s plans for a house. It begins by representing the totality of the thing to be built (e.g., a three-dimensional rendering of the house) and slowly re?nes the thing to provide guidance for constructing each detail (e.g., the plumbing layout). Similarly, the design model that is created for software provides a variety of different views of the computer software. Basic design principles enable the software engineer to navigate the design process.


concepts

conditionals

http://en.wikipedia.org/wiki/Conditional_(computer_programming)#If-then-else_expressions

Conditional statements are features of a programming language which perform different computations or actions depending on whether a boolean condition evaluates to true or false.

if-then-else

http://en.wikipedia.org/wiki/Conditional_(computer_programming)#If-then-else_expressions

IF (boolean condition) THEN
    (consequent)
ELSE
    (alternative)
END IF
switch

http://en.wikipedia.org/wiki/Conditional_(computer_programming)#Case_and_switch_statements

Switch statements (in some languages, case statements) compare a given value with specified constants and take action according to the first constant to match. There is usually a provision for a default action ('else','otherwise') to be taken if no match succeeds.

switch (someCharacter) {
  case 'a':
    onA();
    break;

  case 'x':
    onX();
    break;

  case 'z':
    onYandZ();
    break;

  default:
    onNoMatch();
}
loops

http://en.wikipedia.org/wiki/Control_flow#Loops

A loop is a sequence of statements which is specified once but which may be carried out several times in succession. The code "inside" the loop is obeyed a specified number of times, or once for each of a collection of items, or until some condition is met, or indefinitely.

for (i = 0; i < n; i++) {
     // code
}

enumerations

http://en.wikipedia.org/wiki/Enumerated_type

An enumerated type is a data type consisting of a set of named values called enumerators. The enumerator names are usually identifiers that behave as constants. A variable that has been declared as having an enumerated type can be assigned any of the enumerators as a value. In other words, an enumerated type has values that are different from each other and that can be compared and assigned.

enum class Color {Red, Green, Blue};

structures

classes

http://en.wikipedia.org/wiki/Class_(computer_programming)

In object-oriented programming, a class is an extensible program-code-template for creating objects, providing initial values for state (member variables) and implementations of behavior (member functions, methods).[1][2]

inheritance

http://en.wikipedia.org/wiki/Class_(computer_programming)#Hierarchical

Classes can be derived from one or more existing classes, thereby establishing a hierarchical relationship between the parent classes and the child class. The relationship of the parent class to the child classes is commonly known as an is-a relationship.[18] For example, a class 'Button' could be derived from a class 'Control'. Therefore, a Button is a Control.

Structural and behavioral members of the parent classes are inherited by the child class. Derived classes can define additional structural members (data fields) and/or behavioral members (methods) in addition to those that they inherit and are therefore specializations of their superclasses. Also, child classes can override inherited methods if the language allows.

composition

http://en.wikipedia.org/wiki/Object_composition

In computer science, object composition is a way to combine simple objects or data types into more complex ones. Composite objects are usually expressed by means of references from one object to another; in other words the use of variables.

style

c++

Resources

[C documentation]

[Stack Overflow]

[cheat sheet for dummies]

Libraries

[list of packaged libraries]

[std library]

C++ comes packaged with libraries.

  • some examples are cmath, cstdio, and random
  • often cmath and math.h are synonyms for each other
    • this is a quirk that's leftover from original C

=Macro Guard

Syntax

using namespace std;

Compiling

Makefile

python

hardware

overview

cpu

http://en.wikipedia.org/wiki/Central_processing_unit#Design_and_implementation

A central processing unit (CPU) carries out the instructions of a computer program by performing the basic arithmetical, logical, and input/output operations of the system.

Hardwired into a CPU's design is a list of basic operations it can perform, called an instruction set. Such operations may include adding or subtracting two numbers, comparing numbers, or jumping to a different part of a program. Each of these basic operations is represented by a particular sequence of bits; this sequence is called the opcode for that particular operation. Sending a particular opcode to a CPU will cause it to perform the operation represented by that opcode. To execute an instruction in a computer program, the CPU uses the opcode for that instruction as well as its arguments. A computer program is therefore a sequence of instructions, with each instruction including an opcode and that operation's arguments.

The actual mathematical operation for each instruction is performed by a subunit of the CPU known as the arithmetic logic unit or ALU. In addition to using its ALU to perform operations, a CPU is also responsible for reading the next instruction from memory, reading data specified in arguments from memory, and writing results to memory.

ram

http://en.wikipedia.org/wiki/Random-access_memory

Random-access memory (RAM) is a form of computer data storage. RAM allows data items to be read and written in roughly the same amount of time regardless of the order in which data items are accessed.[1]

In contrast, with other direct-access data storage media such as hard disks, CD-RWs, DVD-RWs and tapes, the time required to read and write data items varies significantly depending on their physical locations on the recording medium, due to mechanical limitations such as media rotation speeds and arm movement delays.

RAM is normally associated with volatile types of memory (such as DRAM memory modules), where stored information is lost if the power is removed, although many efforts have been made to develop non-volatile RAM chips.[2]

hard drives

http://en.wikipedia.org/wiki/Hard_disk_drive

A hard disk drive (HDD)[b] is a data storage device used for storing and retrieving digital information using rapidly rotating disks (platters) coated with magnetic material.[2]

An HDD retains its data even when powered off. Data is read in a random-access manner, meaning individual blocks of data can be stored or retrieved in any order rather than sequentially.

An HDD consists of one or more rigid ("hard") rapidly rotating disks (platters) with magnetic heads arranged on a moving actuator arm to read and write data to the surfaces.

displays

motherboards

ports

peripherals

operating systems

networks

overview

topology

http://en.wikipedia.org/wiki/Network_topology

Point-to-point

The simplest topology with a permanent link between two endpoints. Switched point-to-point topologies are the basic model of conventional telephony. The value of a permanent point-to-point network is unimpeded communications between the two endpoints. The value of an on-demand point-to-point connection is proportional to the number of potential pairs of subscribers and has been expressed as Metcalfe's Law.


Bus

In a LAN with bus topology, each node is connected to the single bus cable. A signal from the source travels in both directions to all machines connected on the bus cable until it finds the intended recipient. If the machine address does not match the intended address for the data, the machine ignores the data. Alternatively, if the data matches the machine address, the data is accepted. Since the bus topology consists of only one wire, it is rather inexpensive to implement when compared to other topologies. However, the low cost of implementing the technology is offset by the high cost of managing the network. Additionally, since only one cable is utilized, it can be a single point of failure.


Star

In local area networks with a star topology, each network host is connected to a central hub with a point-to-point connection. In Star topology every node (computer workstation or any other peripheral) is connected to central node called hub or switch. The network does not necessarily have to resemble a star to be classified as a star network, but all of the nodes on the network must be connected to one central device. All traffic that traverses the network passes through the central hub. The hub acts as a signal repeater. The star topology is considered the easiest topology to design and implement. An advantage of the star topology is the simplicity of adding additional nodes. The primary disadvantage of the star topology is that the hub represents a single point of failure.


Ring

A network topology that is set up in a circular fashion in which data travels around the ring in one direction and each device on the ring acts as a repeater to keep the signal strong as it travels. Each device incorporates a receiver for the incoming signal and a transmitter to send the data on to the next device in the ring. The network is dependent on the ability of the signal to travel around the ring. When a device sends data, it must travel through each device on the ring until it reaches its destination. Every node is a critical link.[4] In a ring topology, there is no server computer present; all nodes work as a server and repeat the signal. The disadvantage of this topology is that if one node stops working, the entire network is affected or stops working.


Mesh

The value of fully meshed networks is proportional to the exponent of the number of subscribers, assuming that communicating groups of any two endpoints, up to and including all the endpoints, is approximated by Reed's Law.


Tree

security

protocols

databases

graphics

troubleshooting