Earlier quoted context omitted.
my rails apps pass this test with flying colors. Nearly all of my end points have at least 3 views. 1 for html, 1 for json (often used for ajax calls), and 1 for rss/atom.
JSON and RSS views don't make sense - in MVC, views are visual representations of data (the model). Views are how the user percieves the application. JSON and RSS are just different methods for representing data to be communicated to other systems.
MVC is dead, it's time to MOVE on
131–140 of 233 posts
Re: MVC is dead, it's time to MOVE on
#132Earlier quoted context omitted.
I agree, I really like the "services" layer. I used it for years programming with Java/Spring and missed a lot when learning RoR. I think it is no coincidence that the two RoR real-world projects that I worked had enormous controllers. The service layer is great to orchestrate operations between models and I don´t know a reason for not using it.
Does anything stop you from using a service layer with Rails?
Re: MVC is dead, it's time to MOVE on
#133Earlier quoted context omitted.
I suspect this is because most people do not actually understand what MVC is and how it applies to server-client relationships; in fact, the wikipedia article on MVC is slightly off on the subject, assuming one accepts the original Xerox description as a source. Try not to wrap the entire complicated application into one big MVC umbrella because that will just confuse. There are actually multiple processes involved,…
"The big epiphany for me was when I realized that the server has its own MVC, and the browser has its own MVC." While I'd still advocate DRY over this POV (unless of course DRY leads you here naturally), I will agree this is a generally valid viewpoint, because you've got the server-client model built in there instead of glossed over. And you are now the first person who has gotten me to be generally agreeable about…
I use Angularjs in the browser, now.js for the interface, and, at the moment, custom code on the server that follows the MVC pattern.
The server is lightweight: its role is to
* manage authentication and authorizations,
* ensure data integrity and
* push data on update according to user permissions.
That's it.Re: MVC is dead, it's time to MOVE on
#134Earlier quoted context omitted.
I'm a human user and I have a mental model of the json and rss apis I consume via code I write. I notice that he didn't say visual as you did earlier
"A view is a (visual) representation of its model. It would ordinarily highlight certain attributes of the model and suppress others. It is thus acting as a presentation filter." Source: http://heim.ifi.uio.no/~trygver/1979/mvc-2/1979-12-MVC.pdf And you are not a human user, you are an engineer.
I am most certainly a human user.
Re: MVC is dead, it's time to MOVE on
#135Earlier quoted context omitted.
JSON and RSS views don't make sense - in MVC, views are visual representations of data (the model). Views are how the user percieves the application. JSON and RSS are just different methods for representing data to be communicated to other systems.
HTML is also one of those different methods. It just so happens that the browser renders it instead of spitting out the raw text. That said, non-HTML output bypasses the view entirely in Rails (it makes sense to), so it can equally be the case that the distinction is correct.
https://github.com/rails/jbuilder/
It looks a lot like a view file :)
Re: MVC is dead, it's time to MOVE on
#136Are you talking about pure mvc's like sproutcore? faux mvc's like backbone? model2 patterns like rails and most other server side architectures? I think what you mean is 'Model2 is dead...'. MVC is great for any environment where the observer pattern can be implemented (eg web front-end). The biggest problems I've seen in model 2 architectures is weak models. The side effect of this is everything gets stuffed in the…
Having used MVC for many years, and in the environment where it was invented (Smalltalk-80), I couldn't help but wonder why he was reinventing MVC while thinking he was criticizing it.
Re: MVC is dead, it's time to MOVE on
#137The best practices I've seen for MVC apps isn't to put all the logic in the controllers. What you do is to create a "services" or "managers" layer that is called on by the controllers. A userService, for example, might have a function user = userService.login(name, password) It's also nice to abstract this service layer with some clean interfaces so that you can replace the underlying implementation, for example to m…
I agree, I really like the "services" layer. I used it for years programming with Java/Spring and missed a lot when learning RoR. I think it is no coincidence that the two RoR real-world projects that I worked had enormous controllers. The service layer is great to orchestrate operations between models and I don´t know a reason for not using it.
Re: MVC is dead, it's time to MOVE on
#138Earlier quoted context omitted.
JSON and RSS views don't make sense - in MVC, views are visual representations of data (the model). Views are how the user percieves the application. JSON and RSS are just different methods for representing data to be communicated to other systems.
> JSON and RSS are just different methods for representing data to be communicated to other systems. We call those, "views".
Re: MVC is dead, it's time to MOVE on
#139Earlier quoted context omitted.
Let me give you an example. In your model, you have represented the salary of an employee as an integer. In a web application, the salary can be presented to the user through numerous different views - as a number on the screen (plain HTML), as a slider (jQuery UI slider), as a bar in a bar chart (using some charting library). The tools you use to build the view are not relevant.
> In a web application, the salary can be presented to the user through numerous different views - as a number on the screen (plain HTML), as a slider (jQuery UI slider), as a bar in a bar chart (using some charting library) as JSON encoded output, as XML....
Re: MVC is dead, it's time to MOVE on
#140This sure looks like MVC, but they call the Controller "operations". The MVC abstraction has an issue with web applications, since the request-response cycle doesn't provide feedback as directly as the hardware-monitor-software cycle that the pattern was originally designed around. However, if the problem is that you are putting too much "logic" into your controllers, you should probably find a better place for it. I…