Concepts & Terms Flashcards

1
Q

Define

Immutability / mutability

A

Characteristic of reference objects. A ref variable is immutable if, when a second ref variable points to the first, a change to the second WILL NOT change the first.

Immutable objects are easy and inexpensive to copy, because copying only creates a pointer rather than a second object. In the example below, A isn’t changed even when pointer B is modified:

  • String A = “Hello”;*
  • String B = A;*
  • B += “ there!”;*
  • Print A, B*

Output:

Hello Hello there!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Define

Lambda expression

A

An in-line WHERE syntax for an anonymous delegate or method. Lambda expressions are used heavily in LINQ

var evens = Enumerable.Range(1, 100).Where(x => (x % 2) == 0) ToList();

See also: anonymous delegate

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Define

Boxing / unboxing

A

Implicit conversion from one type to another.

foreach(int I in myCollection)

The above statement attempts to convert each object in the collection to an int in order to execute the code in the loop.

  • Int x = 30; *
  • Object obj = x;* // boxing
  • Int y = (int)obj; *// unboxing
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Define

MFC

A

Microsoft Foundation Class

C++ wrapper for the Windows API

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Define

ASP Session State

A

Current progress or state of a user’s web application. While visiting a web site, a user may visit multiple pages and generate values for multiple variables. Maintaining these values while the application is used is maintaining session state.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Define

Singleton

A

Sole instance of a class. No other instances of that class are allowed (in theory). The singleton is a Design Pattern.

In C#, instantiating a static class achieves this, though there are other ways it can be done, too. For example, MSDN suggests creating a class that creates a single instance of itself, and provides public methods that allow access/reference to that instance. The constructor of that class would also be made private.

  • Public class Singleton {*
  • Private static Singleton instance;*
  • Private Singleton() {}*
  • Public static Singleton Instance {*
  • Get { if(instance==null) Instance = new Singleton; }*
  • Return instance; }*
  • }*
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Define

WPF

A

Windows Presentation Foundation .NET technology for rendering Windows applications via DirectX. Utilizes XAML

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Define

Delegate

A

Wrapper for a single method. Allows the passing of a method as a parameter. This allows a single function (if it accepts a delegate) to filter the results depending on how it’s called, without having to hard code the filtering functionality.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Define

Inheritance

A

When object A inherits from B, A adopts the signature or functionality of B.

Interfaces : A must implement the signature of B, but the functionality of that signature is left up to A.

Objects : A gains the function the functionality of B.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Define

Overload

A

Provides different signatures for the same method.

  • Employee(string Name) {…} *
  • Employee(int EmployeeID) {…}*
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Define

Type constraint

A

Associated with Generics; restricts the types the generic can accept when being instantiated. For example, Collection might only want to allow the collection to contain objects that implement the IEnumerable interface.

class Doc doc where T : IEnumerable {…}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Define

Thread Safety

A

The ability of an object (X) to be accessible to objects (A and B) from different threads, without compromising the functionality or data of X.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Define

Reference type

A

Variables of less well-defined types (when compared to value types). Stored on the heap. Copying a reference type creates a pointer to the original; changes to the original will be reflected in the copy.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Define

Thread

A

Functionality executed within a larger process (re. spell checking in MS Word).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Define

Tuple

A

An “array” containing objects of multiple types.

Where an array is made up of objects of the same type (ie. string), a tuple can contain several different types (ie. string, int, DataTable,etc). Tuples can be simulated by creating an array of Objects, but this violates type safety, making it hard for the developer to know what the array items actually are.

Tuple tuple = new Tuple (1, “cat”, true);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Define

Value type

A

Variable of a well-defined type (int, string, etc). Stored on the stack. Copying a value type creates new, separate copy of that variable; making a change to the original leaves the copy unaffected.

17
Q

Define

Recursion

A

The concept of defining a function in which, as it operates, it makes a call to itself.

  • Int factorial(int n) {*
  • If(n*
  • Return 1*
  • Else*
  • Return factorial(n-1);*

}

18
Q

Define

Multicast delegate

A

A wrapper for a group of methods that can be passed like an object. Since different methods can return different types, the multicast delegate should have a VOID return value.

19
Q

Define

Anonymous delegate

A

An inline method used as a delegate, removing the need for a named method. Useful if the delegate is only going to be used once. If the same delegate/function is going to be used in multiple places, create a named method rather than an anonymous delegate.

  • Var evens = Enumerable.Range(1, 100).Where(delegate(int I)*
  • {*
  • return (x % 2) == 0;*
  • }**) .ToList();*
20
Q

Define

Indexer

A

A method for referring to a class’ members/data through an index. Since implementation of an indexer is left up to the developer, the choice of members/data to be exposed by the indexer is also left up to the developer.

21
Q

Define

LINQ

A

Language Integrated Query. Standardized syntax / technology for quering & modifying data from any (qualified) source: database, collection of objects, XML, etc.

22
Q

Define

XAML

A

Extensible application markup language Included in .NET 3.0 and later. Used heavily in WPF and WF. Declarative XML language.

23
Q

Define

WF

A

Windows Workflow Foundation.

More information needed

24
Q

Define

Extension

A

A static member “added” to an existing object without the developer needing access to the original object’s code. This allows an object’s functionality to be extended, providing abilities the original developer did not build.

  • string x;*
  • x.HelloWorld();*
25
Q

Define

Interface

A

Signature (methods, properties, types) that a child class inheriting the interface must implement.

Interfaces provide Loose Coupling.

26
Q

Define

Covariance / contravariance

A

Both enable implicit reference type conversion for arrays, delegates and generic types. Covariance maintains assignment compatibility, while contra variance reverses it.

Assignment compatibility - an object of a more derived type is assigned to a var of a less derived type

  • String str = “test”;*
  • Object obj = str;*

//covariance - an object that is instantiated with a more derived type argument is assigned to an object instantiated with a less derived type argument

//assignment compat is preserved

IEnumerable strs = new List();

IEnumerable objs = strs;

Contravariance. Assume this method exists:

Static void SetObject(object o)

An object that is instantiated with a less derived type argument is assigned to an object instantiated with a more derived type argument. Assignment compat is reversed

  • Action aO = SetObject;*
  • Action aS = aO;*

See this blog for more detail. This one too.

27
Q

Define

Reflection

A

The ability to inspect & manipulate program elements at runtime.

28
Q

Define

Encapsulation

A

Keeping the implementation of an object or method’s functionality hidden. This is synonymous with “black box programming”.

29
Q

Define

Polymorphism

A

A concept where objects / functions of different types provide methods that make them seem alike. For example, the “+” operator can be used in both arithmetic and string concatenation.

Interface and functionality inheritance is one way this can be achieved.

30
Q

Define

Loose coupling

A

The practice of allowing for flexible interaction between objects. This allows changing the functionality of an object without affecting objects that may rely upon it. Interfaces provide loose coupling; so does Black Box object-oriented programming.

31
Q

Define

Containment & Composition

A

A class whose scope is determined by the class which contains it.

Car.Engine Represents an Engine object associated with a Car object. When the Car goes out of scope, the Engine goes with it. Composition can be thought of as a PART-OF relationship.

An Engine is part of a Car. See also: aggregation

32
Q

Define

Aggregation

A

A class related to another, but whose scope is independent of the other.

A Customer has an Address, but the customer doesn’t disappear if the address disappears. Aggregation can be thought is as a HAS-AN relationship. A customer has an address. See also: Containment / Composition

33
Q

Define

Design pattern

A

A solution or set of solutions to common problems / challenges seen in development projects. Singleton, strategy, decorator, composite, state - these are all examples of design patterns.

Need more info about this…

34
Q

Define

Generics

A

Classes, structures, interfaces and methods that have placeholders (type parameters) for one or more of the types they store and use. Use of generics provides an improvement in performance, in that they avoid boxing while providing type safety.

SortedList is an example