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 6854203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:36:16+00:00 2026-05-27T01:36:16+00:00

The question in broad terms: I have an object with a method that performs

  • 0

The question in broad terms:

I have an object with a method that performs a long iterative process and I have a second object which is designed to log/monitor the happenings within that long iterative process. What is the best design/design-pattern to observe and monitor the progress of the iterative process?

The specific problem I’m working on:

I have a RandomWalker object with a method InitiateRandomWalk() which causes the random walker to walk thousands of steps. I also have a HeatMaps object which describes a set of heat map images which are rendered by analyzing every step of the randomly walked path.

I don’t want to wait until the completion of the InitiateRandomWalk() method to pass the path data to the Heatmaps object and start rendering the heat map. Instead, I want my Heatmaps object to observe and log the random walk data as it happens.

Some possibilities:

  • I could make the heatmap logging method public and static and call that method from within the InitiateRandomWalk() method but that would be bad design.
  • I could have InitiateRandomWalk() return an IEnumerable and yield return each step and then pass each step to Heatmaps.
  • I could pass the Heatmaps object to the InitiateRandomWalk() method as a parameter.

Which design/design pattern would be best?

  • 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-27T01:36:17+00:00Added an answer on May 27, 2026 at 1:36 am

    From the usage of yield return keyword construct, I’m assuming you’re using C#. Using that construct with Reactive Framework is a PERFECT approach (although somewhat advanced) to solving your problem. Here’s a good overview of how to use it in action.

    The other option is to simply declare an event StepTaken on the RandomWalker. The HeatMap would subscribe to the event and InitiateRandomWalk would fire the event every time it generates a step.

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

Sidebar

Related Questions

A fairly broad question I know, apologies for that! So I have a data
I know this is a rather broad question, but have a class that has
A broad question. We have a client application that currently talks to a web
OK, this is rather broad question but ... Is there a chart that says
This is somewhat of a broad question, but it is one that I continue
It's a somewhat broad question, and for that I apologise, however I am struggling
This is a really broad question, but I have come across it a couple
I understand that this is a very broad question, but a short it depends
This is a broad-based question around delivering a javascript library that other web developers
That is a broad question but I want to listen to your opinion. Three

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.