Programming reference: glossary of common programming and coding terms, numeral systems, conversion between base 10 and base 2, memory sizes (bit, byte, etc.), and C# built-in data types.
Glossary
A
- Abstract Class
- An abstract class cannot be instantiated.
- Aggregation
- Indicate a whole-part relationship, and are known as "has-a" relationships.
- Algorithm
- A well-defined computational procedure that takes some value, or set of values, as input and produces some value or set of values, as output and through these steps the input is transformed into the output. (Paraphrased from Introduction to Algorithms, page 5.)
- Array
- A data structure fixed in size that holds a collection of elements. Each array element is identified by its position in the collection (index number or element index).
- ASP.Net
- A unified Web development model for building Web applications that is part of the .NET Framework.
- Association
- A generic relationship between two classes.
B
- Base 10
- Ten symbols (numbers) to represent ten values (0-9).
- Base 2
- Two symbols to represent values: a one or a zero.
- Binary
- A base-2 numeral system or binary numeral system number. Values are expressed with only two symbols: 0 and 1. (Video)
- Bit
- A single binary number.
- Boolean
- A data type with a binary value (such as: true or false, 1 or 0, or on and off).
- Byte
- Eight bits (8 bits can hold a value from 0-255 which is 256 values).
C
- Case sensitive
- If something (such as a programming language) is case sensitive, it means that it treats a lowercase letter as different than an uppercase version of the same letter.
For example, apple and Apple would not be considered equal. However, Apple and Apple would be equal.
Case sensitivity is important to note when programming in a language like C#. In the following code example CustomMethod() and customMethod() would be treated as calls to two different methods.MyObject.CustomMethod(); MyObject.customMethod();
- C#
- A language developed by Microsoft to work with the .Net platform. It was evolved from C and C++.
- Character
- A data type that stores a single character.
- Class
- A template of a type of object.
- Class Diagram
- Class diagrams identify the class structure of a system, including the properties and methods of each class.
- Code Block
- A code block (or statement block) is enclosed in curly braces {}. It can contain nested blocks.
- Comment
- Comments are notes inserted by the programmer that are ignored by the compiler. They can be used for many reasons such as explaining why a particular approach was taken in solving a solution, or what still needs to be added to complete the program. Comments often help outline the programmer's thought process.
Single-line comments start with two slashes //.
Comments that can span multiple lines start with a slash and an asterisk /* and end with an asterisk and a slash */.// Example of a single-line comment /* Example of a multi-line * comment that spans * multiple lines */
- Compiler
- The compiler produces executable (.exe) files. (It can also create dynamic-link libraries or code modules).
- Compiled
- Compiled Language: A compiled language is one that is used primarily to created an executable (.exe), dynamic-link library (dll), or other component that has been compiled into machine code. Compiling a program into native code ahead-of-time (AOT), or just-in-time (JIT) can be more efficient and faster than a program that uses an interpreter to run. As languages can often be compiled or interpreted, this label typically refers to a language that is used mainly for compiled code. An interpreted language is one that is used primarily to create code that requires an interpreter to run. Examples of languages usually compiled: C and C++. Examples of languages usually interpreted: Python and JavaScript. (Learn more...)
- Composition
- If a class cannot exist by itself, and instead must be a member of another class, then that class has a Composition relationship with the containing class.
- Concatenation
- The operation of joining two things together. String concatenation in c# is adding two strings together with an operator.
- Conditional Statement
- A statement that controls execution flow. See if statement and switch.
- Console.WriteLine()
- Writes the current line terminator to the standard output stream.
- Console.ReadLine()
- Reads the next line of characters from the standard input stream.
- Console.ReadKey()
- Obtains the next character or function key pressed by the user.
- Constant
- A variable that has a value that won't change.
- CPU (Central Processing Unit)
- The hardware within a computer that carries out program instructions. The clock rate is the speed that instructions are executed (generally noted in terms of hertz).
D
- Declare
- State the data type (Char, String, Array, Integer, etc.) and a name.
- Dependency
- A class depends on another class when it uses it as a member variable or parameter.
- Dot Notation
- A programming syntax that uses the dot operator to indicate relationships. For example:
- Call a method of a class using the format: Class.Method()
- Call the method of a specific object using the format: ObjectInstanceIdentifier.Method()
Code example:
Console.WriteLine("Hello"); MyObject.CustomMethod();
- Double
- A number that allows a decimal point for greater precision, and that is larger than a float. In C# a double stores 64-bit floating-point values (range: ±5.0 x 10-324 to ±1.7 x 10308, precision: 15-16 digits).
E
- Encapsulation
- A group of related members (properties, methods, etc) are treated as a single unit or object. Encapsulation separates its external (public) behavior from its internal (private) implementation details.
F
- Field
- Information about a class (attributes or properties of a class).
- Floating-Point Number
- A data type that stores a number with greater range - including numbers that aren't whole and that use a decimal point to indicate precision. For example, a floating-point number could store a price (such as 12.53) or the value of pi (3.14159265359). In c# a float is a type that stores a 32-bit floating-point value (range: ±1.5 x 10-45 to ±3.4 x 1038, precision: 7 digits), and that requires the use of an f in the value (example: float pi = 3.14159265359f).
- FlowBoard
- A combination of a flowchart and storyboard.
- Flowchart
- A visual representation that can be helpful in designing and understanding the flow of a process, and that typically indicates decision points and potential paths.
- FTP
- File Transfer Protocol: a way to transfer files from one location to another.
- Function
- A series of statements performing a logical operation or set of operations. A function is defined once, and can be used multiple times by calling or invoking it. Functions may accept one or more parameters and may return a value. The basic structure of a function is: access modifier return value identifier (parameters){body}.
G
- Generalization
- A generalization relationship is the equivalent of an inheritance relationship in object-oriented terms (an "is-a" relationship).
- Gigabyte
- 1024 megabytes (over 1 billion bytes)
H
- Hexadecimal
- A numeral system that has 16 values, from 0 to F. One common use of hexadecimal is to express colors in languages like CSS. The numeric representation of a color is preceded by a hash mark (#), and is in the format of RR GG BB. 0 represents the darkest color, and F represents the lightest, so that #000000 is black and #ffffff is white. #333333 is a darker grey, and #eeeeee is a lighter grey.
Examples: the color #ff0000 is red (equal to RGB 255,0,0), #00ff00 is green, and #0000ff is blue. - HTML (Hyper Text Markup Language)
- A language that structures document elements.
I
- IDE
- Integrated Development Environment: software that allows you to write, compile, and debug as you develop applications.
- Identifier
- Names programmers choose for their classes, methods, variables, etc.
- if Statement
- Statement or statements are run if the evaluation of a test expression is true. Example: if (total== 100){ //statement to run if total is equal to 100}.
- Initialize
- Provide an initial value.
- Integer
- A data type that stores a whole number.
- Interpreted
- An interpreted language is one that is used primarily to create code that requires an interpreter to run. Examples of languages usually interpreted: Python and JavaScript. (See also: compiled)
- Instance
- A specific object instantiated from a class.
J
- Java
- A language and technology platform created by Sun Microsystems.
K
L
- Literal
- A primitive piece of data
- Logic Error
- An error that produces unintended behavior, yet the code compiles and runs. This type of error is generally a mistake in the programmer's logic; statements have been designed to inadvertently do something that wasn't what they intended.
- Loop
- The repeated execution of a statement or statements. Common loops: for, while, and do while.
M
- Megabyte
- 1024 kilobytes (over 1 million bytes)
- Memory
- Two main types of memory: RAM and ROM. Random access memory (RAM) is volatile and requires power to retain; when the computer is turned off what is in RAM is lost. Read only memory (ROM) is longer term storage and is used for boot programs, hard disks, external drives, etc.; the information stored remains when the power to the system is shut off.
N
- Namespace
- A logical unit of organization that is used to separate a particular programming interface from others. (Read more and see code example)
O
- Object
- An instance of a class.
- OOP
- Object-Oriented Programming: models a problem by organizing it as a collection of discrete objects, how the objects interact, and what the relationships between the objects are.
- Operator
- An operator is a symbol that produces an action.
- Order of Operations
- Order of operations determines which procedures are performed first in a given mathematical expression. Precedence can be controlled using parentheses.
P
- Polymorphism
- Multiple classes used interchangeably; each class implements the same properties or methods in different ways.
- Pseudocode
- A set of instructions in plain English. It does not use any language-specific syntax, and is easily understood.
Q
- Quicksort
- A divide and conquer algorithm that splits data into two fairly equal parts; low elements and high elements. The parts are then recursively sorted. Learn more and see examples at Rosetta Code.
R
- Recursion
- Something defined in terms of itself (or its type). In programming, recursive is often used to describe a structure that calls itself.
S
- Statement
- An action; single lines that end in a semicolon, or a series of lines in a code block.
- Storyboard
- A visual tool traditionally used for linear work - capturing the key frames of an animation, film or other time-based visual medium.
- String
- A data type that stores a string of characters.
- Switch
- A conditional statement that allows the testing of multiple values, however the test is limited to discrete values. Read more...
- Syntax Error
- An error in programming language's syntax. This type of error is usually caught by a compiler or an IDE and is generally easier to debug than a logic error.
T
- Terabyte
- 1024 gigabytes (over 1 trillion bytes)
- Ternary Operator
- An operator that works on three operands. Example:
string mood = (this.HappinessLevel > 0) ? "happy" : "unhappy";
- Thread
- A thread is what an operating system allocates processor time to. Multiple threads can run in a process (operating systems use processes to separate the running applications). Multi-threading allows your application to essentially "multi-task". If you would like to use threads, see the MSDN Threading Tutorial. Read more...
U
- UML (Unified Modeling Language)
- A standardized general-purpose modeling language that includes a set of graphic notation techniques to create visual models of object-oriented software systems.
- Unary Numeral System
- The simplest numeral system to represent natural numbers. Each number is represented by a mark.
Example: |, ||, |||, ||||, |||||, ||||||, etc. - using directive
- The using directive has a few purposes. The first allows the use of types in a namespace without having to specify the namespace.
For example:using System; namespace Example { class Program { static void Main() { Console.ReadKey(); } } }
Otherwise:
namespace Example { class Program { static void Main() { System.Console.ReadKey(); } } }
The scope of the using directive is the file in which it appears.
Another way the using directive is helpful is that it allows access to static elements without having to fully qualify the name.
For example:using static System.Console; namespace Example { class Program { static void Main() { ReadKey(); } } }
Advanced: The using statement can also be used to create an alias for a namespace of a type (using alias directive), and when an IDisposable object is declared and instantiated to ensure that Dispose is called even if an exception occurs while you are calling methods on the object.
V
- Variable
- A storage location and an associated name (identifier) associated with a value and whose associated value may be changed; a variable can store dynamic (changing) information. The information stored is referenced using the variable name.
W
X
- XML (Extensible Markup Language)
- A markup language derived from SGML that can be used to markup data, and to create other languages.
Y
Z
. (DOT)
- . (Dot Operator)
- The dot operator specifies a member of a type or namespace. For example:
System.Console.ReadLine();
- .cs
- The file extension .cs indicates a file that has C# code.
- .csproj
- The file extension .csproj indicates a C# project.
- .exe
- The file extension .exe indicates an executable application.
- .NET Framework
- The .NET Framework is a software framework developed by Microsoft.
- .sln
- The file extension .sln is for a solution file which contains information Visual Studio uses to load the solution, projects within the solution, and any persisted information attached to the solution (a solution is a structure for organizing projects in Visual Studio).
Numeral Systems
There are several systems for expressing numbers, including:
- Unary: The simplest numeral system to represent natural numbers. Each number is represented by a mark.
Counting: | > || > ||| > |||| > ||||| > |||||| > .... - Decimal: Uses symbols 0 through 9. Examples: 98.6, 0.003, and 3.14.
Counting: 0 > 1 > 2 > 3 > 4 > 5 > ... - Binary: Uses only two symbols. Example: 0 and 1. In computer systems, these digits represent bits.
Counting: 0 > 1 > 10 > 11 > 100 > 101 > ... - Hexadecimal: 16 alphanumeric values from 0 to 9, then A to F.
Counting: 0 > 1 > 2 > 3 > ..... > 9 > A > B > C > D > E > F
Decimal | Binary |
---|---|
0 | 0 |
1 | 1 |
2 | 10 |
3 | 11 |
4 | 100 |
5 | 101 |
6 | 110 |
7 | 111 |
8 | 1000 |
9 | 1001 |
10 | 1010 |
Example of Base 10 Numbers Converted to Base 2.
Base 10 | Base 2 | |
Dolphin Flippers | 2 | 10 |
Sides of a Square | 4 | 100 |
Days in a Week | 7 | 111 |
Planets (incl. Pluto) | 9 | 1001 |
Base 10 to Base 2 Conversion
Humans commonly use the decimal system to count, but alternative systems like binary and hexadecimal are important to understand for computer programming.
Converting from one system to another gives us a better understanding of numeral systems in general.
"Easy Method" Walk-Through
There is an easy method of converting a number from base 10 to base 2. The key is to use a guide that has power of 2 values in a range that exceeds the number we want to convert. We will be working from the left to the right.
The top row is where we will be putting our base 2 number.
BASE 2: | ||||||||
GUIDE: | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
The lower row is a set of base 2 values that will serve as our guide numbers.
Steps Overview
The number we want to convert will start out as our "working number".
- First, find the guide number that is equal to or less than the working number.
- If you can subtract the guide number from your working number and have a positive number left over, add a 1 in the cell above. The remainder is now your working number.
- If the result would be a negative number, add a 0 in the cell above and skip the subtraction (leave the working number the same).
- Move to the next cell on the right.
- Repeat steps two, three, and four until you have reached the end of the guide.
First Working and Guide Numbers
Let's convert the number 57 from base 10 to base 2.
To convert the number 57, we can look at the highest number that could be subtracted from 57 in the guide. That number is 32, so our guide number will be 32.
Working=57 and Guide = 32.
BASE 2: | ||||||||
GUIDE: | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Second Working and Guide Numbers
57-32 = 25.
Because there would be a positive number (25) after subtracting the guide number (32) from the working number (57), we put a 1 in our base 2 row (above the guide number 32).
BASE 2: | 1 | |||||||
GUIDE: | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Let's update our working and guide numbers.
57-32 = 25.
25 becomes our new working number.
The cell next to 32 is 16, so 16 is our new guide number.
BASE 2: | 1 | |||||||
GUIDE: | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Working=25 and Guide = 16.
Third Working and Guide Numbers
Subtract our updated working number from our updated guide number.
25-16 = 9.
The result is a positive number. Put a 1 above in the base 2 row, above the cell that holds our guide number (16).
BASE 2: | 1 | 1 | ||||||
GUIDE: | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Our remainder is 9, and the next number in the guide is an 8.
BASE 2: | 1 | 1 | ||||||
GUIDE: | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Let's update our working and guide numbers.
Fourth Working and Guide Numbers
Working=9 and Guide = 8.
We can subtract 8 from 9 with a positive result, so our next base 2 digit is also a 1.
BASE 2: | 1 | 1 | 1 | |||||
GUIDE: | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
9-8 leaves 1. Our new remainder is 1, and the next cell in our guide holds a 4.
BASE 2: | 1 | 1 | 1 | |||||
GUIDE: | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Fifth Working and Guide Numbers
Working=1 and Guide = 4.
We can't subtract 4 from 1 and still have a positive number so our next base 2 digit is a 0.
BASE 2: | 1 | 1 | 1 | 0 | ||||
GUIDE: | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Our working number is still 1 since we couldn't subtract 4 from 1 without the result being a negative number. The next number in our guide is 2.
BASE 2: | 1 | 1 | 1 | 0 | ||||
GUIDE: | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Sixth Working and Guide Numbers
Working=1 and Guide = 2.
If we can't subtract 2 from our working number and get a positive number, we add another zero.
BASE 2: | 1 | 1 | 1 | 0 | 0 | |||
GUIDE: | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
We have only one number left in our guide - a one.
BASE 2: | 1 | 1 | 1 | 0 | 0 | |||
GUIDE: | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Seventh Working and Guide Numbers
Working=1 and Guide = 1.
We can subtract 1 from 1 without a negative result, so the last digit we add to our base 2 number is a 1.
BASE 2: | 1 | 1 | 1 | 0 | 0 | 1 | ||
GUIDE: | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
Result
57 (base 10) = 111001 (base 2).
Memory
BitA single binary numberByteEight bits (8 bits can hold a value from 0-255 which is 256 values).Kilobyte1024 bytesMegabyte1024 kilobytes (over 1 million bytes)Gigabyte1024 megabytes (over 1 billion bytes)Terabyte1024 gigabytes (over 1 trillion bytes)
C# Built-In Data Types
Type | Range |
byte | 0 .. 255 |
sbyte | -128 .. 127 |
short | -32,768 .. 32,767 |
ushort | 0 .. 65,535 |
int | -2,147,483,648 .. 2,147,483,647 |
uint | 0 .. 4,294,967,295 |
long | -9,223,372,036,854,775,808 .. 9,223,372,036,854,775,807 |
ulong | 0 .. 18,446,744,073,709,551,615 |
float | -3.402823e38 .. 3.402823e38 |
double | -1.79769313486232e308 .. 1.79769313486232e308 |
decimal | -79228162514264337593543950335 .. 79228162514264337593543950335 |
char | A Unicode character. |
string | A string of Unicode characters. |
bool | True or False. |
object | An object. |