This is probably correct more often than not, but still not always.
An example where it might not be that straighforward: if whatever you want to
draw using openGL requires data from your CDocument, you won't have that in
CDialog. Obviously, a particular kind of document may be displayed in more than
one kind of view -- but even then some parameters of the view can alter how the
information from the document is displayed. You can certainly try to extract
these parameters from a view and feed your renderer with these parameters and
information from that document -- but this logic, in combination with drawing
code, will most certainly take more than 20 lines of code.
Or, if what you are creating is some small custom reusable cool visual component
(say, a custom button, whose document is, for example, some very special
combination of text some graphics and animation, specific to that component,
possibly dynamic i.e. changing with time), it is highly unlikely that you need
another view with exactly same drawing + interaction logic -- and view is good
for wiring in all the data and user-interaction events (if any); then you might
appreciate packing this all in a single class. Your desired rendering may need
to rely on more view-specific data (I do not mean document, but, say, even CWnd
and parent CWnd parameters and events) than you initially planned and you might
find yourself busy programming wiring from those to your openGL renderer instead
of working on actual drawing.
On the other hand, if you want to provide two ways of rendering: one basic with
GDI and another, advanced, with OpenGL, you will have to decompose your data
flows anyway. But even then it might turn out easier to just create two parallel
views, basic and advanced -- because a view essentially is not much more than
wiring connecting rendering to document data, events and window system state.
Also, event handling might want some information back from the renderer for
usability -- think of clicking on animated object.
Where you might really appreciate a separate renderer and data flow
decomposition is in porting your app or component away from MFC to another
platform allowing OpenGL. Just remember that work on portable/multi-platform
components and that decomposition will take your valuable time, so I would not
do it just because it is "the right thing".
Long story short -- optimal design depends on what you are doing, what data the
renderer will eventually need and the feedback the view might need from the
renderer.
>