Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

1. Please define the difference between an ActiveX component and a DLL file.

 

2. What is meant between "in process" and an "out of process"?

 

3. How is unmanaged code specified in (pick one: C# or VB.NET)?

 

4. What is an example (with explanation) of ISOMORPHISM in (pick one: C# or VB.NET)?

 

I'm trying to get a grip on this whole Object Oriented thing, but these topics are confusing me. Could someone answer to one or more of these?

Posted
1. Please define the difference between an ActiveX component and a DLL file.

 

I dont have a good description of a DLL, there are way to many forms of DLL. (to name a few: dynamic link library (think of shell32 api), COM server, .NET classlibrary and probably loads more).

An activeX component is a COM component that supports some specific COM interfaces. You could say that activeX components are a subset of the DLLs.

 

2. What is meant between "in process" and an "out of process"?

 

Unless somebody is doing some strange stuff (it takes some registry settings), EXE are 'out of process' and DLLs run 'in process'.

This should be covered by a long story, but I'll try to keep it short.

-out of process:

The component that runs 'out of process' runs as its own process that can be identified in the task manager.

-in process:

The component that runs 'in process' is loaded into an existing process and can't be found in the taskmanager.

 

In process/out of process has an impact on:

-performance. In process communication is always (a bit) faster than out of process.

-memoy: each process that uses an in process component loads that component. If 2 processes uses it, it is loaded 2x in memory, while an out of process component only has to run 1x (but could still run 2x, depending on configuration... confusing enough ;) )

-member variables. Has to do with using an in process component in 2 places in one process. There can be unexpected behavior of member variables of the in process component if you didnt design it for this. You'd need somebody better than me to explain this properly in less than 50 pages ;).

 

 

3. How is unmanaged code specified in (pick one: C# or VB.NET)?

I think you can just add a reference to a COM component (in solution explorer, right mouse on References -> COM -> wait some time -> select the COM component) and the IDE will add it. After that you can use it just like the rest of .NET as it will appear in the intellisense popups you get when you create a new object etc.

 

For old fashioned API dlls you use dllImport:

[DllImport("KERNEL32.DLL", EntryPoint="MoveFileW",  SetLastError=true,
CharSet=CharSet.Unicode, ExactSpelling=true,
CallingConvention=CallingConvention.StdCall)]
public static extern bool MoveFile(String src, String dst);

 

4. What is an example (with explanation) of ISOMORPHISM in (pick one: C# or VB.NET)?

I have never heard of isomorphism. Hope it is something like polymorphism. I'll give an example of polymorphism.

Say you have a baseclass: 'Car', and a subclass (of Car) named 'WreckedCar'.

The Car has a 'Move' method that envolves starting the engine, releasing the brake, etc.

The 'WreckedCar' also has a 'Move' method (it inherited this from the Car baseclass). However, a WreckedCar is moved very differently, it needs a 'TowTruck' to move. So the 'WreckedCar' class has its own implementation of the 'Move' method which involves a towtruck, cables, lots of money for repairs, etc.

 

In C# the Car and WreckedCar would look something like this:

public class Car
{
 //using the keyword 'virtual' indicates that this method can be 
 //  're-implemented' by a subclass.
 public virtual void Move()
 {
   //start the engine
 }
}

public class WreckedCar : Car
{

 //now implement the WreckedCar version of the Move.
 //using the 'override' keyword lets us re-implement a method that is
 //already implemented at the baseclass.
 public override void Move()
 {
   //get the towtruck
 }
}

 

The fact that the 'WreckedCar' can have a 'Move' method that looks just like its baseclass 'Car' but is implemented totally different is called polymorphism.

 

 

I'm trying to get a grip on this whole Object Oriented thing, but these topics are confusing me. Could someone answer to one or more of these?

Some starting points to read would be:

http://www.xtremedotnettalk.com/showthread.php?t=87847

http://www.xtremedotnettalk.com/showthread.php?t=89346

Nothing is as illusive as 'the last bug'.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...