Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 170077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:44:39+00:00 2026-05-11T12:44:39+00:00

Ted Faison in a podcast on event-based software design mentioned that sender and self

  • 0

Ted Faison in a podcast on event-based software design mentioned that ‘sender’ and ‘self’ objects in .NET, C++ and Java event statements such as:

private void Button_Click(object sender, RoutedEventArgs e) 

are a misnomer since e.g. in the above example ‘sender’ is not really the object which produced the event but a proxy, since you wouldn’t want to couple your applications that tightly.

Did I understand him incorrectly (since when I debug it, ‘sender’ does indeed seem to be the original object).

Or is it that common event patterns in these languages (e.g. a common click handler) are tightly coupled but they should be more decoupled, e.g. in composite applications.

He also mentioned that e.g. you shouldn’t make inherit from EventArgs since it leads to an explosion of classes, one per event, which only transport a few variables. Many times in his opinion, you can just send a string for instance. He mentioned that this opinion is the opposite of what Microsoft Patterns and Practices suggests.

Any thoughts on these areas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T12:44:39+00:00Added an answer on May 11, 2026 at 12:44 pm

    In most cases, sender is the Button (or whatever) that raised the event. There are some occasions when this isn’t the case – such as a (perhaps lazy) pass-thru event:

    class Foo {    private Bar bar;    public Foo(Bar bar) {        this.bar = bar;    }    public event EventHandler SomeEvent {        add {bar.SomeEvent += value;}        remove {bar.SomeEvent -= value;}    }    //... } 

    Here, if we subscribe to foo.SomeEvent, we will actually get back the event originated by the Bar instance – so sender won’t be foo. But this is arguably because we’ve implemented Foo.SomeEvent incorrectly.

    To be honest, in most cases you don’t need to check sender; the main time this is useful is when a number of controls share a handler. You should generally be able to assume the sender is the instance you subscribed to (for the purposes of reference-equality tests).

    Re EventArgs – the standard pattern (when creating a new event-type) would recommend you to inherit from this. I don’t recommend deviating from this. A minor reason is that it allows you to use EventHandler<T>, but there are other variance reasons too. Besides – sometimes doing what other people expect is reason enough; people expect an EventArgs derived value.

    That said – I have done non-standard events before (in MiscUtil’s Push LINQ) – but this was already in a very unusual setup, so it didn’t feel out of place.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 339k
  • Answers 339k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The two concepts are unrelated: In the iPhone SDK, an… May 14, 2026 at 4:31 am
  • Editorial Team
    Editorial Team added an answer I sincerely doubt that any company will start a new… May 14, 2026 at 4:30 am
  • Editorial Team
    Editorial Team added an answer Yes, catching any RuntimeException is almost always a code smell.… May 14, 2026 at 4:30 am

Related Questions

Ted talks of a Player Cache existing within Flash Player 9.3 that allows the
Inspired by a recent TED talk , I want to write a small piece
How resizing and fitting different images in a fixed space as done in http://www.ted.com/talks/browse
Let's say I have the following data in the Customers table: (nothing more) ID

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.