What is impedance mismatch?

The misalignment of application layer objects to tables and rows is called impedance mismatch. Developers usually want a database which is easy to use. Relational databases save data in tables and rows, but our application hardly ever does.

class A{int x,string[] tags

————————————————————————————–

In the above example we have an object that contains a field x and tags, which contains a bunch of strings, or tags .If we want to save this data in a database we would need three tables one for main object, another for tags, and another to map tags to main object. This forces the developer to write a mapping layer or use an ORM to translate between object in our memory and what is saved in the database.

What do you mean by endpoints in WCF?

All communication with a Windows Communication Foundation (WCF) service occurs through the endpoints of the service. Endpoints provide clients access to the functionality offered by a WCF service. We expose endpoints for making our service to be consumed.
Each endpoint consists of four properties:
  • Address: The address uniquely identifies the endpoint and tells potential consumers of the service where it is located. We mainly use URL as address.
  • Binding: The binding specifies how to communicate with the endpoint like transport protocol, encoding for messages and necessary security requirements. WCF uses by default wsHttp binding. 
  • Contracts: The contract outlines what functionality the endpoint exposes to the client.There are many contracts like service, operation, data, fault and message contracts. A contract specifies:
    • What operations can be called by a client.
    • The form of the message.
    • The type of input parameters or data required to call the operation.
    • What type of processing or response message the client can expect.
  • Behaviors: We can use endpoint behaviors to customize the local behavior of the service endpoint. Endpoint behaviors achieve this by participating in the process of building a WCFruntime.

How does Garbage collector work ?

Garbage collector serves as a automatic memory manager. It allocates memory for objects on managed heap. The heap is divided into three generations, generation 0, generation 1 and generation 2 , so it can handle short-lived and long-lived objects. A temporary variable is an example of short-lived object and an object in server application with static data is an example of long lived object.

Generation 0 is youngest generation and contains short-lived objects. All newly created objects are contained in generation 0. Garbage collection occurs more frequently in this generation. If there is no memory in generation 0, they are promoted to generation 1.

Generation 1 acts as a buffer between short-lived and long-lived objects, it contains short-lived objects.

Generation 2 contains long lived objects.

A garbage collection has the following phases:
  • A marking phase will find and create a list of all live objects.
  • A relocating phase will update the references to the objects that will be compacted.
  • A compacting phase will reclaim the space occupied by the dead objects and will compact the surviving objects. The compacting phase will move objects that have survived a garbage collection toward the older end of the segment.
Collecting a generation means collecting objects in that generation and all its younger generations.

What is managed code and unmanaged code?

Managed code is not compiled to machine code but to an intermediate language which is interpreted and executed by some service(Common Language Runtime in case of .NET) on a machine and is therefore operating within a secure framework which handles dangerous things like memory and threads for us.

Unmanaged code is compiled to machine code and therefore executed by the Operating System directly.

What is GAC? Where is it located?

Global assembly cache  (GAC) is a folder in windows directory to store the .NET assemblies that are specifically designated to be shared by all applications executed on a system. Assemblies can be shared among multiple applications on the machine by registering them in global assembly cache(GAC).

To install assembly in Cache, use  Gacutil. To run Gacutil, goto “Visual Studio Command Prompt” and type “gacutil -i <assembly_name>”, where (assembly_name) is the DLL name of the project.

 To uninstall assembly, type gacutil –u <assembly name> in  Visual Studio Command Prompt.

What is Assembly?

An Assembly is a “unit of deployment” for .NET ,almost always a .exe or .dll. A .NET assembly is a file that contains our compiled code, code that can execute under supervision of Common Language Runtime.

In C# terms its basically a single C# project.

Assemblies are building blocks of  .NET Framework applications; they form the fundamental unit of deployment ,version control, reuse ,activation, scoping and security permissions.

An assembly is a collection of types and resources that are built to work together and form a logical unit of functionality. An assembly provides the common language runtime with the information it needs to be aware of the type implementations. To the runtime, a type does not exist outside the context of an assembly.

What is CLR

Common Language Runtime or CLR is the run-time execution environment of .Net Framework. Converting MS-IL into platform or OS specific code is done by the CLR.
CLR is responsible for bringing application to life and its also the CLR’s job to tear down application when its finished executing or if it has an unrecoverable error.

CLR actively tracks all the memory a program uses and it knows when the program is finished with memory so it will clean things up and allows program to have enough memory as it runs. The CLR also virtualizes our execution environment so we don’t have to worry about things like CPU cores,32bit or 64 bit or what instruction set is available. The CLR will take care of all those things and makes sure that our application will execute correctly.

What is Garbage Collector?

Garbage collector serves as a automatic memory manager. It has the following benefits:

  • It would enable us to develop our application without having to free memory.
  •  It allocates objects on managed heap efficiently.
  •  It reclaims the objects that are no longer being used, clears their memory and keeps the memory available for future allocations.
  •  It provides memory safety by making sure that an object cannot use the context of another object.

    What is .NET Framework?

    .NET Framework is a software framework developed by Microsoft that can be used to develop business applications, to build games, web applications and apps that can run on different types of phones and mobile devices.