Model–View–Controller (MVC) is a design pattern for computer user interfaces that divides an application into three areas of responsibility. It is often applied to websites.

learn more… | top users | synonyms

3
votes
1answer
47 views

Best practice for generating jQuery dynamical content

I am new user of CodeIgniter and I am trying to build an application that there are lots of jQuery dynamical content. Below I provide a code that I am using in order to be precise. The code below is ...
-1
votes
0answers
22 views

MVC in PHP: store and verify user input [on hold]

I'm trying to write an MVC script in PHP. I've an object, e.g. a car, that can be booked. I created a class "car" and a child class "carEdit". In carEdit the controller can easily store and verify ...
0
votes
0answers
15 views

Passing an object to the view in CodeIgniter

I'm trying to use an object and persist it into the data base. I created a class in the library's folder. <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); class ...
2
votes
0answers
57 views

Laravel model and controller interaction

I want to know if I'm going about creating and calling two functions from my model to my controller in the simplest and cleanest way. Model: public function getPosts() { $post = ...
1
vote
0answers
43 views

Laravel 4 clean code review of users controller and model, trying to maintain MVC structure

I'd like you to review my attempt at creating an authorization class and let me know if there is re-factoring to be done and/or how I can make the code cleaner and abide by the MVC structure. ...
1
vote
0answers
33 views

Correct MVC in CodeIgniter

In my CodeIgniter I have a Login controller that load this view: <ul class="sub-menu"> <li> <a href="javascript:;" class = "menu-item" ...
1
vote
1answer
14 views

Codeigniter view within a view

I'm calling a view into a view. Am I doing correctly, or is this a bad practice? <div class="tab-pane" id="tab_1_2"> <div class="portlet "> <div class="portlet-title"> ...
5
votes
1answer
35 views

Is this nesting of partial views poor design?

I feel like using this many partial views where a view renders a partial that renders a partial is just digging a hole of poor design, so I'm looking for any suggestions or guidance as to if this is ...
4
votes
1answer
57 views

Using a BaseController in MVC asp.net to reuse the repository

I have a repository class that impliments a repository Interface. In my Controllers I want a way to access the repository without creating constructors each time in the controller. So now all my ...
6
votes
3answers
109 views

HTTP scraper not clean and straightforwardly coded?

A job application of mine has been declined because the test project I submitted was not coded in a clean and straightforward way. Fine, but that's all the feedback I got. Since I like to ...
4
votes
2answers
61 views

Refactoring asynchronous JS pre-rendering code

A few months ago I wrote this module but, coming back to it, I find it a bit hard to read and reason about. I want to ask community's opinion on whether this needs to be refactored, and how I could ...
2
votes
2answers
117 views

Is this data access layer design good?

I am working on an ASP.NET MVC-5 project, using code-first approach for database design. I have a question about my code design. I have an Entity in my database schema called Student: public partial ...
2
votes
1answer
48 views

How to optimize the code in order to reduce the loading time of page?

I'm using PHP, MySQL, Smarty, jQuery, etc. for my website. I'm using a MVC architecture to develop the website. Now in one of the functionality I'm fetching a large amount of data and perform some ...
8
votes
2answers
119 views

toString() in a model or view layer?

I would like to ask those of you, who are a little bit more expirienced in development. I would like to ask about toString() method usage. In what situations do you use it? I've found some info about ...
0
votes
0answers
50 views

Symfony2: Refactor messy Controller action

I have a fairly ugly controller method I would like to refactor / extract. I can only test this in a integration type test which kind of signals a code smell. The method processes the form and needs ...
2
votes
1answer
374 views

Review my PHP router class

I'm writing yet another mvc framework just for learning purpose and i would like you guys to review my code. Whenever i'm coding i have that feeling that my code is horrible and not the most efficient ...
2
votes
1answer
105 views

Need reviews for an authentication system

AccountController Code: public class AccountController : ApplicationController { public AccountController(ITokenHandler tokenStore, IUser user) : base(tokenStore, user){} public ...
2
votes
1answer
129 views

Is the structure for this MVC Blog ok?

I made a MVC Blog based on a tutorial for a framework from here. It's not finished yet, but I want to know if the structure and the classes are ok and what can I change. Feel free to say anything. ...
1
vote
1answer
908 views

Java MVC and code example

I have a MVC design for a GUI Java program. I was wondering if: Someone could either comment the code to help me out in understanding what I am doing better. Help me fix newbie mistakes to make ...
2
votes
1answer
378 views

Builder pattern for Codeigniter ActiveRecord queries

I am using Codeigniter and it's ActiveRecord. I had this idea for a base class that provided a generic getter/setter for doing simple queries on a database. I have a lot of database objects that ...
1
vote
1answer
687 views

Basic PHP MVC setup for form submissions

I'd like your thoughts on this basic implementation of MVC. The view outputs a form, and when the page is loaded, the controller checks for a form submission and then updates the model accordingly. ...
0
votes
1answer
272 views

PHP MVC: how to do $_POST the right way

I am not sure if I am doing right on how to handle $_POST data in MVC pattern. Below is my attempt. Am I doing it right? // Dummy $_POST data, $_POST = array( "menu" => array( ...
2
votes
1answer
153 views

How to put XML results in the MVC pattern?

I have been writing PHP programs in the MVC pattern for quite some time. But I am not sure if I am doing it right. For instance, I have this PHP file that prints a result in XML, and I put this file ...
1
vote
0answers
172 views

Tiny MVC - Handling validation / sanitization in a model

I was told to post this here - original post. I'm fairly new to MVC concepts and PHP input validation. I'm open to all input, but I'm largely wanting to know if the following: Follows the MVC ...
0
votes
0answers
92 views

Model Input Sanitation / Validation - Is this acceptable?

I'm fairly new to MVC concepts and PHP input validation. I'm wanting to know if the following: Follows the MVC pattern correctly - if not, how can I improve it? Has any huge apparent security ...
0
votes
1answer
65 views

Javascript MVC Design Feedback

I would like to share my design of mvc via js. What do you think about it? I tried to not use any mvc framework but i want to get clear structure and a decoupled organisation. Next step for me is ...
3
votes
1answer
533 views

TicTacToe - introduction to MVC pattern

After reading about MVC pattern in Head First Design Patterns, I've decided to write a TicTacToe app. I will not reveal the source code of the classes Matrix, Dimension, and Size because they do not ...
2
votes
1answer
259 views

First attempt at MVC javascript pattern

I would really appreciate a review of my interpretation of MVC here. http://jsfiddle.net/zuVkt/ It's as bare bones and clear as possible, i've based it on some in-depth reading but I don't know if I ...
1
vote
3answers
345 views

Look over my code for PDO and MVC

I'm building this website with PDO and Pattern MVC. I'm currently working on the login page and would like to know if this structure is correct for MVC pattern. I'd also like your opinions and ...
1
vote
1answer
95 views

Which parts of my code are redundant?

Hey guys I have the following code, which i kind of just put together sloppily since I'm not really familiar with Razor/html... but nonetheless it does what I want it to do, which is basically passing ...
2
votes
1answer
256 views

Structure pages mvc + oop

I am developing a website and I want to use PDO and MVC. Before, I was coding in procedural MySQL, but I'm starting to understand the object-oriented programming. My problem is the following: If I ...
3
votes
1answer
207 views

First introduction to MVC

I'm not sure that I fully understand this pattern. I've written a simple application that uses MVC. Please criticize my approach to the use of this pattern. For convenience, I'll post the source code ...
0
votes
1answer
30 views

Nested routes and proper place for a function?

I have a rails app and in it I have two models, widget and votes. Votes are used to keep track of the desirability of a widget. So in my models I have: class Vote < ActiveRecord::Base ...
1
vote
0answers
396 views

Java. Combining a JFrame, AbstractTableModel, and SQL Query

Building on my previous questions. I've managed to make a GUI that queries a SQL database and displays the result in a table. Christ, it's a lot of work for such a simple activity. The code below ...
1
vote
1answer
94 views

Decoupling MVC model methods in java

I have a basic swing application that I am trying to develop using MVC structure. The principal class in the model connects to a derby database and retrieves values from columns and stores them in ...
2
votes
1answer
1k views

Is this correct implementation of MVC pattern for PHP website?

I'm currently developing a music website using OOP PHP and I'm trying to correctly implement the Model View Controller pattern. I am creating this website from scratch so I would like to avoid ...
1
vote
1answer
85 views

Is this a good way for Controller to interact with Model ? (MVC)

In my controller I had the idea to do something like the following: // retrieve fields from form $firstname = $form->getInput('firstname'); $lastname = $form->getInput('lastname'); [...] // ...
4
votes
1answer
174 views

How can I refactor my Controller Action to not be so complex?

I'm building a website that is used to search our system. The users can search on a lot of critera at once. As I try to do this though, I can't figure out how to simplify this horrible action. ...
0
votes
1answer
323 views

Multi-page form attempt

I have just started playing around with L4 and would like to get some feedback on how I implemented a multi-page form Here are my routes: Route::model('appointment', 'Appointment'); ...
2
votes
1answer
525 views

PHP MVC - Custom Routing Mechanism

Note #2: This was a post from a while back. Although the top rated answer is useful (generally), I'm looking for something more specific to this issue including routing / architecture. I've even ...
3
votes
1answer
155 views

JQuery code repetition and MVC

A while ago I started working on a project, which does things mostly with JQuery and PHP. I had some problems with my structure and started using CodeIgniter which uses an MVC pattern. So the PHP part ...
6
votes
1answer
236 views

Feedback on college project

I would appreciate some feedback regarding best practices on the following code for a college project. What should go in the controller and what in the views? How to attach and remove the views to ...
1
vote
1answer
449 views

Router Class In a Lightweight MVC Boilerplate

I'm trying to come up with a simple router class. I considered using a Request class but that will rather make simple to complex. That is why I did not consider creating one for my framework. class ...
1
vote
1answer
387 views

Java; Generic Observer/Observable - is this as messy as I think?

I have recently had a whole load of help trying to roll my own loosely-coupled Observable/Observer paradigm, here: Loosely coupled observer pattern To keep things simple and to aid in my ...
1
vote
0answers
165 views

Student administration application

I have set up a basic MVC project which is a student administration application based upon a CSV file as datastore. Each user has a specific role (student, lecturer, professor, leader of degree ...
1
vote
0answers
37 views

Code review for MVC Design using backbone.js

I am a backbone.js newbie. I have created a color picker application using backbone.js. I am trying to fiure out if I have nailed the MVC concept. Please review my code and let me know if I can do ...
1
vote
2answers
74 views

Please tell me if it is a good controller or not. Would really appreciate

<?php session_start(); include_once("model/Model.php"); class Controller { public $model; public function __construct() { $this->model = new Model(); } public ...
1
vote
1answer
252 views

Some feedback on first attempt to write Java MVC app

I'm writing my first Java MVC application which should be a desktop student administration application with a swing gui. DAO is already implemented: Need some feedback - student administration ...
6
votes
2answers
235 views

Where should I define my entities?

I am working on my own PHP MVCframework. Now I want to know where to get and specify my entities. An example, should I do this: class User_Model extends Model { private $name; public getName() {} ...
1
vote
2answers
376 views

MVC : Does code to save data is session or cache belongs in controller?

I'm a bit confused if saving the information to session code below, belongs in the controller action as shown below or should it be part of my Model? I would add that I have other controller methods ...