To deligate joyfully for both parties is a skill mastered by few.

Deligation is part of teamwork. It requires trust and belief.

Note that with delegation we understand the distribution of a task, problem or responsibility to another individual or organisation who will report to you upon completion and if their arise complications.

The one who delegates should always first verify if there will be no pressure (other than self-imposed) on the person. All information and resources to tackle the problem or issue need to be provided (this needs to be verified at the start and during the process. The task should allow the other to function at or slightly above his or her level - one can always make the task easier or harder by providing more or less structure, support, resources, time, etc.

To delegate correctly requires a good description of what the task, problem or responsibility is, what it's framework and boundaries are, etc.

Although it is good for people in a team to specialize on specific tasks or areas, one person should not always be delegated everything related to this specialty. It has to be a team effort; perhaps that specialist can break up the work and delegate parts of it to competent individuals/organisations.

In the programming world (particularly in the realm of C#), a delegate is an anonymous function pointer, which allows a function or method to be fully encapsulated and passed as an argument to other functions. The main benefit of using a delegate is that it allows for cleaner divisions of functionality among objects.

Delegates have obvious applications in threading and event handling. For a more general explantion of how delegates apply to events, have a look at ariels' node on callbacks.

Delegates are a feature of C# that implement functionality similar to function pointers in C and C++. Unlike function pointers, delegates are a fully object oriented solution to the problem.

Syntax

To create a delegate, a delegate type is defined using the delegate keyword. The definition looks a lot like a method declaration, but really it is closer to a class definition, as you're really defining a new type. For example:

        public delegate void my_delegate(string message);

This defines a new delegate type named "my_delegate" which points at a method with one string argument and which returns nothing (void). This type can then be instantiated using the standard new operator, giving the method for the delegate to point at as an argument.

Full Example

using System;
                                                                                
class Foo {
                                                                                
        public void my_method(string message) {
                Console.WriteLine("my_method: " + message);
        }
                                                                                
        public delegate void my_delegate(string message);
                                                                                
        public static void Main(string args) {
                Foo my_obj = new Foo();
                                                                                
                my_delegate foo = new my_delegate(my_obj.my_method);
                                                                                
                foo("hello");
        }
}
This creates a new object of the Foo class, and then creates a delegate to point at the my_method method of this object. The method can then be invoked through the delegate using the standard method/function syntax.

Conclusion

As well as object methods, delegates can also be made to point at static class methods. The compiler only cares that the arguments and return type are the same.

Of course, delegates are pretty much obsolete in any language which has a lambda construct such as Lisp or Ruby.

In OpenStep (and deriving technologies such as GNUStep and Cocoa), a delegate is an object that acts in behalf of another object. They're typically used to implement things that respond to various kinds of user or system signals.

A typical example found in many programs is the application delegate. You can create a new class, for example, MyAppDelegate, and set it as the application's delegate with [NSApp setDelegate: [MyAppDelegate new]];. Now, you can implement methods to MyAppDelegate that respond to NSApplication's messages - for example, if you need to do something when the application starts up, you can implement the method - (void)applicationDidFinishLaunching: (NSNotification *)not; in the delegate class.

Another typical example is the window delegate. Likewise by using NSWindow's setDelegate: method (or setting the delegate in the interface builder of your choice), you can implement a class that responds to window signals. For example, windowShouldClose: method would be called to determine whether or not the window can be closed.

Del"e*gate (?), n. [L. delegatus, p. p. of delegare to send, delegate; de- + legare to send with a commission, to depute. See Legate.]

1.

Any one sent and empowered to act for another; one deputed to represent; a chosen deputy; a representative; a commissioner; a vicar.

2. (a)

One elected by the people of a territory to represent them in Congress, where he has the right of debating, but not of voting

. (b)

One sent by any constituency to act as its representative in a convention; as, a delegate to a convention for nominating officers, or for forming or altering a constitution.

[U.S.]

Court of delegates, formerly, the great court of appeal from the archbishops' courts and also from the court of admiralty. It is now abolished, and the privy council is the immediate court of appeal in such cases. [Eng.]

 

© Webster 1913.


Del"e*gate (?), a. [L. delegatus, p. p.]

Sent to act for a represent another; deputed; as, a delegate judge.

"Delegate power."

Strype.

 

© Webster 1913.


Del"e*gate (?), v. t. [imp. & p. p. Delegated (?); p. pr. & vb. n. Delegating (?).]

1.

To send as one's representative; to empower as an ambassador; to send with power to transact business; to commission; to depute; to authorize.

2.

To intrust to the care or management of another; to transfer; to assign; to commit.

The delegated administration of the law. Locke.

Delegated executive power. Bancroft.

The power exercised by the legislature is the people's power, delegated by the people to the legislative. J. B. Finch.

 

© Webster 1913.

Log in or register to write something here or to contact authors.