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

  • Home
  • SEARCH
  • 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 525755
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:42:18+00:00 2026-05-13T08:42:18+00:00

I recently found out about Presenter First and read their whitepapers and blogs, etc.

  • 0

I recently found out about Presenter First and read their whitepapers and blogs, etc.

In most of the examples I found, the events are not declared directly on the interface but rather as a method for it. For example,

public interface IPuzzleView
{
    void SubscribeMoveRequest(PointDelegate listener);
    // vs
    event PointDelegate MoveRequest;
}

I don’t understand exactly why. I thought I saw a paper/article/blog somewhere that explains the reasoning behind this but I can no longer find it. The said text also contained snippets of unit testing code as well – I know this because I remember saying to myself, that one of the unit test was incorrect.

UPDATE:

The following is an example for comparison:

public class Collect
{
    public static CollectAction<T> Argument<T>(int index,
        CollectAction<T>.Collect collectDelegate)
    {
        CollectAction<T> collect = new CollectAction<T>(index, collectDelegate);
        return collect;
    }
}

public interface IApplicationView
{
    event EventHandler Load;

    // or

    void SubscribeLoad(Action action);
}

Mockery mockery = new Mockery();
IApplicationView view = mockery.NewMock<IApplicationView>();
IApplicationModel model = mockery.NewMock<IApplicationModel>();

Subscribe style:

Action savedAction = null;
Expect.Once.On(view).Method("SubscribeLoad").Will(
    Collect.Argument<Action>(0,
    delegate(Action action) { savedAction = action; }));
Expect.Once.On(model).Method("LoadModules");
new ApplicationPresenter(view, model);
savedAction();
mockery.VerifyAllExpectationsHaveBeenMet();

vs. Event:

Expect.Once.On(view).EventAdd("Load", Is.Anything);
Expect.Once.On(model).Method("LoadModules");
new ApplicationPresenter(view, model);
Fire.Event("Load").On(view);
mockery.VerifyAllExpectationsHaveBeenMet();

FYI, the event style above will not work as is since ApplicationPresenter gets garbage-collected right away and the wiring never happens.

  • 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. Editorial Team
    Editorial Team
    2026-05-13T08:42:18+00:00Added an answer on May 13, 2026 at 8:42 am

    The short answer is: Presenter First evolved originally in the days of .NET 1.1 and VS2003, and C# events could be problematic.

    Then-current testing/mocking tools didn’t support our need to encapsulate event subscription and dispatch. Over time we came to feel that exposing the specific nature of events outside their emitting classes was burdening the client code with too much knowledge of the implementation, which made refactoring difficult.

    For published examples, we wanted to avoid associating the Presenter First technique with a language-specific feature. (Eg, Java has no equivalent to C# events or delegates, but that doesn’t mean you can’t use the Observer pattern.)

    I see that events, anonymous delegates and mocking tools have come a long way in the past few years. The next time I pick up a C# project, I will re-evaluate all of my assumptions on “the best way” to handle event subscription and dispatch. The above examples are intriguing.

    To summarize our original, perhaps dated, reasons for hiding our use of C# events:
    – Mocking event subscription wasn’t possible in unit tests
    – Occasionally we’d use a different internal mechanism to handle event subscription/dispatch. This led to inconsistency from one interface to another.
    – Several times we considered abandoning C# events even internally, as they behaved differently when no subscribers existed. Exposing events externally would have made it much harder to re-implement.

    When Jiho Han messaged me with this question, he also inquired about data binding and a more fleshed-out PF example, which I have responded to by publishing a newer, fuller example of Presenter First and elaborating on Adapters.

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

Sidebar

Related Questions

I recently found out about livecoding where someone will program something on the fly
I've recently found out about protocol buffers and was wondering if they could be
I only recently found out about URL rewriting , so I've still got a
I recently asked a question about IIf vs. If and found out that there
I recently found out about oEmbed which is a fomat for allowing an embedded
I recently found out about auto-properties and like them quite a lot. At this
I recently found out about C# extension methods and wrote this one: /// <summary>
I recently found out about n-grams and the cool possibility to compare frequency of
I recently found out about the awesomeness of the iTunes COM for Windows SDK.
Recently, I found myself having to write up some concerns I have about race

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.