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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:14:01+00:00 2026-05-30T12:14:01+00:00

I have read a lot about MVC design pattern, but some of the things

  • 0

I have read a lot about MVC design pattern, but some of the things are still unclear to me. I know that “Model” is for data and business logic, “View” is for presentation and “Controller” is for using “Models” and providing “Views” (i.e. C is the communication channel between M and V).

Now, I have the following problem I want to solve:

Problem: The web application takes as input, a list of Nodes from a user. Then, a Model is used to make a Graph (i.e. Data Structure Graph and not x-y graph) out of those nodes (using a database).

I then use Dijkstra’s algorithm to find out the shortest path from a starting node to an ending node in that graph. Do I use the Dijkstra’s algorithm in the Model or the Controller?

I think I should use the Model layer because the “shortest path” itself is data.

But sometimes, I think I should put it in the Controller because it uses the Models (Graph and List of nodes) to do something.

Can anyone give me the right answer? For now I am going to implement Dijkstra’s algorithm in the model layer.

  • 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-30T12:14:02+00:00Added an answer on May 30, 2026 at 12:14 pm

    Yes you are right.
    You should put your Dijkstra’s algorithm in model. The reason is that you may use a different algorithm to find shortest path tomorrow, so in that case you need not change your controller, just change the logic of class that implements the algorithm.
    And the outcome of the this algorithm should be incorporated in view.

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

Sidebar

Related Questions

I have read a lot about this issue but mine still seems to be
I have read a lot about unit testing, but I still haven't found any
I have read a lot about jquery and i have a simple webservice that
I have read a lot of tutorials about animation of the rows, but all
I have read a lot about preventing race conditions, but typically with one record
I am new to SCOM, but I have read a lot about it and
I have read a lot about how to validate dynamically generated content in mvc
I have read a lot about Java classloaders, but so far I have failed
I have read a lot about accessing files in an iPhone app, but I
I have read a lot about projective geometry and cross ratio, but I don´t

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.