Computer Science Guide

From Earlham CS Department
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.


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



  • source links are included above their quotes

note key

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


  • 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.


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.



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.


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.



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 (boolean condition) THEN

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':

  case 'x':

  case 'z':


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


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};



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]


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.


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.



A library is a collection of implementations of behavior, written in terms of a language, that has a well-defined interface by which the behavior is invoked. This means that as long as a higher level program uses a library to make system calls, it does not need to be re-written to implement those system calls over and over again. In addition, the behavior is provided for reuse by multiple independent programs. A program invokes the library-provided behavior via a mechanism of the language. For example, in a simple imperative language such as C, the behavior in a library is invoked by using C's normal function-call. What distinguishes the call as being to a library, versus being to another function in the same program, is the way that the code is organized in the system.

The value of a library is the reuse of the behavior. When a program invokes a library, it gains the behavior implemented inside that library without having to implement that behavior itself. Libraries encourage the sharing of code in a modular fashion, and ease the distribution of the code.



Namespaces provide a level of direction to specific identifiers, thus making it possible to distinguish between identifiers with the same exact name. For example, a surname could be thought of as a namespace that makes it possible to distinguish people who have the same given name. In computer programming, namespaces are typically employed for the purpose of grouping symbols and identifiers around a particular functionality.


Readability, consistency, and documentation are vital to writing good code. Why? It makes code easier to understand.



[C documentation]

[Stack Overflow]

[cheat sheet for dummies]


[list of packaged libraries]

[std library]

Macro Guard







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.


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

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.




Motherboard specifically refers to a printed circuit board (PCB) with expansion capability. As the name suggests this board is the "mother" of all components attached to it, which often include sound cards, video cards, network cards, hard drives, TV tuner cards, extra USB ports, firewire ports, or other forms of persistent storage.



The resource includes a list of common ports with images.


operating systems


Common features

  • Process management
  • Interrupts
  • Memory management
  • File system
  • Device drivers
  • Networking
  • Security
  • IO



The operating system must be capable of distinguishing between requests which should be allowed to be processed, and others which should not be processed. Authentication is used to identify who is making a given request.


For hardware functions such as input and output and memory allocation, the operating system acts as an intermediary between programs and the computer hardware,[1][2] although the application code is usually executed directly by the hardware and will frequently make a system call to an OS function or be interrupted by it.


file structure

command line







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.



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.



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.



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.



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.





Database Management System (DBMS)


Database management systems (DBMSs) are specially designed software applications that interact with the user, other applications, and the database itself to capture and analyze data.

DBMS programs: MySQL, PostgreSQL, Microsoft SQL Server, Oracle, SAP and IBM DB2



Techniques such as indexing may be used to improve performance.



Database security deals with protecting the database content, its owners, and its users. Database access control deals with controlling who or what is allowed to access information in the database. The information may comprise specific database objects (record types, specific records, data structures), certain computations over certain objects (query types, or specific queries), or utilizing specific access paths to the former (using specific indexes or other data structures to access information).

This may be managed directly on an individual basis, or by the assignment of individuals and privileges to groups. Data security prevents unauthorized users from viewing or updating the database.

Data security deals with protecting data, both physically (from corruption, destruction, or removal; physical security), or the interpretation of them, or parts of them to meaningful information (e.g., by looking at the strings of bits that they comprise, concluding specific valid credit-card numbers; data encryption).

Change and access logging records who accessed which attributes, what was changed, and when it was changed. Monitoring can be set up to attempt to detect security breaches.