Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Algorithm visualization application - Design suggestions  RSS feed

Kemal Sokolovic
Posts: 825
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello to all Ranchers!

It's been a while since I have created a new topic here. Now I would like to hear some advices about the following, though I must point out that I would prefer this to be more of a design than the implementation discussion.
I am about to start working on a Swing based application. The goal is to develop one able to visualise algorithm execution. To simplify, I am now focusing on sorting algorithms, and let's suppose that algorithms are operating on numeric values that are displayed as bars of height depending on their value. Also let's say that values are stored in some simple datastructure (ArrayList). These assumptions are made for the simplicity of discussion.

The main concern I'm having is how to properly divide responsibilities among different parts, and these include: datastructure(s), algorithm(s) implementation and component able to visualize what's happening with the first at each step of algorithm execution. Another goal I'm having is to make the application as modular as possible, so all those parts should be loosely coupled, developed as separate libraries/component that can be reused outside of this particular application is necessary.

The first idea that came to my mind is to exploit the benefits of the Observer pattern, where particular datastructure that algorithm is operating on is notifying component each time a change is made, so that component can display it in its new state. This possible solution gives some benefits (like simplicity of implementation), but it also has some disadvantages. These are the first that come to my mind: Datastructures implementation will be "soiled" with some additional code that maybe should not be there; What if algorithm is operating on a large set of data (say few thousand numbers), then re-displaying a whole structure might not be very effective.

I hope to hear opinion about the first idea, or some further suggestions.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!