Faculty of Engineering and Mathematical Sciences 
Not logged in (login)

help3403


This forum is provided to promote discussion amongst students enrolled in Agile Web Development (CITS3403).
 
Options:
RSS cloud
Jump to:

project model-view-controller structure

2 of 419 articles shown, currently no other people reading this forum.
photo
From: Nathan S.
Date: Mon 18th May, 2:07pm
Actions: 
        Login-to-reply
Hi Tim,

We finished the bulk of our project a while back, functionally, it works fine.  But 
it probably doesn't fit into any of these MVC type structures the lectures 
described.  I am trying to determine right now, how much refactoring of code to do.  
After going through the model-view-controller lecture and the latest lecture on 
REST, I am not sure.  So, the structure of our project is that most of the rendering 
is done clientside in js.  The models are defined mirroring the DB schema, that is 
clear, but the views and controllers are not so clear.  The view functinality is 
mainly at the client and the controller function is probably split between the two.  
What is clear is that the server just authorises the tokens, and talks to the DB.

Description of the functionality:
The initial pages (landing/login/register) are served in a standard way with 
render_template, but after login all requests are tokenised GET ajax requests, where 
the request context is gained from the token, some GET parameters and the route 
(that sounds like a REST API... kind of).  The reponse is just a json object 
containing the status, template html string and the dynamic content json.  The 
client then removes all document nodes from the DOM and rebuilds the page with the 
new template html (it sounds complicated but it's like one command), then a page 
specific function builds the dynamic content (that is your view function).  There is 
also controller type functionality built into the page, eg. as a student, you click 
on a quiz that you have already taken, the js will request a quiz review as opposed 
to if you had not taken it yet, in which case, the js would request to take the quiz 
instead.  That functionality is NOT at the server, as I mentioned before, the server 
simply determines if the token is good for the request and then processes it.  

So the question is considering the structure is not really conformant to anything 
you described, should I spend time trying to split out controller function somehow.  
I do not know if that is a good use of my time at this point.

Regards,

Nathan  

project model-view-controller structure

photo
From: Timothy F.
Date: Tue 19th May, 9:32am
Actions: 
        Login-to-reply
Hi Nathan,

No I don't think you shoudl consider refactoring. MVC is typically used for serverside 
rendering. There are client side patterns, like MVVM (Model-View-View-Model), but your 
design sounds fine.
This Page


Program written by: [email protected]
Feedback welcome
Last modified:  8:27am May 24 2020