Why is there no View class in Yii?

I find it a little confusing that many methods in the CController class doing things what would fit better in a View class. I mean for example the render(), resolveViewFile(), getLayoutFile() and a few other methods are not really a "Controller" thing. Is there a reason why it "breaks" the MVC pattern and merges the View things in to the Controller? Is it because performance or something else?

I think these do belong to the controller… the view is only for presentation. But you can set them in the view also if you prefer…

After all you would access such a view object via the controller anyway (eg $this->view->render()).

I actually agree with the OP. I think it would be cleaner if we had a view class instead of having everything in the controller which already has a lot of functions even without the view related ones. There would definitely be benefits in separating the view logic from the controller.

What is most confusing is that $this in views points to the controller and not the view object. Another thing that bothers me is that the params passed to the view are not stored anywhere. They are simply extracted with extract(). I haven’t yet found a way to list which params I have available in the view.

Actually Yii do have view class. It’s just not mandatory.

http://www.yiiframework.com/doc/guide/topics.prado

Is there a particular reason for not having a view class in normal cases?

Yes. Performance.

You could use this function compact()