The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

cliffeh (2) [Avatar] Offline
Hello! Thanks for your work on this book, I'm through Chapt 2 & like it so far.

One question, though. In Figure 2.4, you say "Models have their own View", and in the renderComment() method of the CommentsView, you do set a view property on your model.

Maybe it's a matter of opinion, but I prefer models to not know anything about views. In your renderComment() method, you wouldn't need to assign a view property to the model, just do var view =..., and then call view.render(), keeping the model out of it.

In our application, we've reused models across views (e.g. a ReadonlyCommentView and an EditCommentView), but that only works because our models are view-agnostic.

Thoughts? Thanks again for what's shaping up to be a good book
rasorface (2) [Avatar] Offline
Re: Models have their own View?
Models having knowledge of views would not be the way I'd go. Here is a post ( that makes a pretty good argument why you might not want to do that. It discusses the classic ToDo example, which did have models saving references to views. There are some other interesting ideas presented, too.