Re: Where to put user interface
From: Karl Heinz Buchegger (kbuchegg_at_gascad.at)
Date: 12/12/03
- Next message: Robert Stankowic: "Re: reading data file into struct...best way?"
- Previous message: Chris \( Val \): "Re: Where should I use assert(<pointer>!=NULL)?"
- In reply to: Gary Labowitz: "Where to put user interface"
- Next in thread: Greg Comeau: "Re: Where to put user interface"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 12 Dec 2003 14:19:21 +0100
Gary Labowitz 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?
No doubt that this is bad design. But where should
the students get this information from? They have
no experience.
So give them an example and let them do it their way.
But then: create a second assignment where they have
to reuse the already created class. But this time make
sure that the reading in the ctor gets in their way
(eg. let them read from a file, but insist that the
reading is done in a seperate function ). They will have to
change the class for doing this. Now go back to
assignment one and ask what changes need to be done
in order to make the same class usable in both assignments.
This way they will actually see, what disadvantage it brings,
if the ctor does the reading.
-- Karl Heinz Buchegger kbuchegg@gascad.at
- Next message: Robert Stankowic: "Re: reading data file into struct...best way?"
- Previous message: Chris \( Val \): "Re: Where should I use assert(<pointer>!=NULL)?"
- In reply to: Gary Labowitz: "Where to put user interface"
- Next in thread: Greg Comeau: "Re: Where to put user interface"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|