Re: Where to put user interface
From: Greg Comeau (comeau_at_panix.com)
Date: 12/12/03
- Next message: jeffc: "Re: C++ a little help please."
- Previous message: Chris \( Val \): "Re: String iteration"
- In reply to: Gary Labowitz: "Where to put user interface"
- Next in thread: Anthony Borla: "Re: Where to put user interface"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 12 Dec 2003 09:47:26 -0500
In article <JKidnSzIhtZnJESiRVn-jw@comcast.com>,
Gary Labowitz <glabowitz@comcast.net> wrote:
>I've been seeing more and more students putting cout/cin statements in
>constructors to get the data needed to build an object. This is even though
>I have told them that the I/O should be done in the application and then
>used to create an object initialized with the arguments from the I/O.
>It's falling on deaf ears.
>Is it so natural to think of constructing an object by asking for the
>information?
>Thoughts on this design?
Actually, it is a natural'ish process, or else so many would
not be doing it. That said, it can be circumvented.
It sounds like you are their instructor? It doesn't
always help to just say "don't do that!". I would
suggest at least having them hoist such code into
a member function (so they can see the work IF IT IS
NECESSARY AT ALL can be done elsewhere and in the worst
case the ctor can call it), reviewing lightweight ctors
with them, having them avoid cin and cout specifically
in the class (since I/O could be to some other files),
going over homework in detail, painful detail, spend
hours if necessary, formally integrating and designing
the homeworks into the curriculum. That provides
a feedback circuit, a forum for alternatives to be
explored, for problems to be discussed and debated, etc.
You can also require that the classes change its state
through it's life, so they can see things always just
don't happen at construction time. This ties into a
whole slew of design issues they either may not be
aware of, or can't grasp. It helps if the assignment
is not toy'y too and as real as it can be made.
There's lots to say here, but I'll leave it at that for now.
-- Greg Comeau/4.3.3:Full C++03 core language + more Windows backends Comeau C/C++ ONLINE ==> http://www.comeaucomputing.com/tryitout World Class Compilers: Breathtaking C++, Amazing C99, Fabulous C90. Comeau C/C++ with Dinkumware's Libraries... Have you tried it?
- Next message: jeffc: "Re: C++ a little help please."
- Previous message: Chris \( Val \): "Re: String iteration"
- In reply to: Gary Labowitz: "Where to put user interface"
- Next in thread: Anthony Borla: "Re: Where to put user interface"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|