penguinCoder

Some Basic Technical Terminolgy Cheat Sheet

Rate this Entry
by , 10-10-2012 at 05:08 AM (1752 Views)
Well I just got out of class, and I thought I would do a brain dump of some of the terminology that is utilized in Programming and Computer Science. This is going to be in more human readable format then most places I have found on the Internet.

Abstract Algorithm Analysis
What is O(N)?
Big O of N, and it is commonly pronounced, is when the run-time of an algorithm is approximately proportional to the size of the data (N), when there are large amounts of data; in the worst case scenario.

What happens when run-time is doubled?
O(1) - Nothing changes
O(logN) - Increases by a constant
O(N) - Doubles
O(NlogN) - Increases by a little more than double
O(2^N) - Squares

Traditional Procedural Programming VS Object-Orientated Programming
• Also called Process-Orientated or Task-Orientated Programming
• Focuses on a specific application, and the sequence of steps to accomplish a given task
• The code can be optimized for the needs of that application, so it may be more efficient in time and space during run-time
• Very difficult to reuse due to it being customized

Object-Orientated Programming
• Data-Orientated
• Focuses on development of general purpose data management tools to support all possible related applications
• Focuses on code reuse
• Initial development may take longer, but the ability to reuse existing tools will make future developments much quicker
• The generality of these tools may cause them to be less efficient at run-time

Record VS Object
A record contains just data, and has no control over its access and manipulation.
An object contains both data and the code to manipulate that data. Data can be declared private, using the keyword 'private', restricting access to this data to public methods inside of the class; this is called Data Hiding. An object also has a constructor method, which combines the task of storage allocation and initialization into one inseperable operation. It also allows for the separation between 'interface' and 'implementation'.

Instance VS Class
The best analogy of these two are cookies. The class would be considered the cookie cutter, where the instance would be considered the actual cookie.
An instance is one specific example of an object. It has both values and storage allocated to it.
A class is a template/model for an object. A class defines a new variable type, and therefore does not have either a value or storage allocated to it. It is initialized using the keyword 'new'.

Static Data Members VS Non-Static Data Members
A static data member is shared by all members of that class. It is allocated storage in the Static Space, alongside the code. The lifetime of a static data member is throughout the entire program's execution. It can be accessed inside or outside of a method, through the use of the class name.
A non-static data member, also called an instance variable, is unique for each instance. It is allocated storage in the Heap Space, and the lifetime of a non-static variable is from the initialization, use of the keyword 'new', to the point when there are no more references to the instance that it is associated with; and the garbage collector has been run. It cannot be accessed through static member functions.
They both are defined inside of a class, but outside of any method. They also both have the same visibility, although it is dependent upon their privacy qualifier. If they are defined using the keyword 'public', they can be accessed from anywhere. If they are defined using the keyword 'private', they can only be accessed by methods in the same class.

Virtual Memory
Static Space
Contains the program code, along with any data members and functions.
Stack Space
Contains local variables. These locations may be used by one function, and later be reused by another function.
Heap Space
Contains dynamically allocated storage; things that are declared using the keyword 'new'. Locations are assigned by the run-time memory management system, as requested during execution; then reclaimed during garbage collection if no longer used.

Local Variables
Local variables are defined inside of a method, and are only 'alive' while the method is being executed. They are allocated storage when the method is executed, and they lose their storage as soon as the method exits. Their visibility is only the containing block, bound by the closest pair of curly braces ({}).

Updated 10-18-2012 at 01:30 AM by penguinCoder

Tags:
Categories
Cheat Sheet