Re: best way to get data into a new instance?



John Salerno wrote:
Let's pretend I'm creating an Employee class, which I will later subclass for more specific jobs. Each instance will have stuff like a name, title, degrees held, etc. etc.

So I'm wondering, is the best way to get all this information into the object to just have a really long __init__ method that takes each argument?

Does a question like this depend on how the class will be used? I'm trying to construct it in a way that is independent of, say, the GUI interface that will be used, but I can't help but think that if all the data is entered into a GUI, then passed programmatically to the class, then it's no big deal because it happens behind the scenes. But if, for instance, someone manually created a new instance, they would have a ton of arguments to type in each time. Granted, even with the GUI they are basically typing in arguments, but in the manual case you'd have to type in the call to the class, the parentheses, commas, quotes around the strings, etc. (But still, I'm trying not to let a specific interface influence the construction of what should probably be a completely independent class implementation.)

Thanks.

Thanks again guys! I guess I'm letting all these little "getting started" questions hang me up too much. I should just start coding like Fredrik suggested ages ago and find out the bad design ideas for myself. :)

Right now I started messing around with designing the GUI that will be used to input the data. It's much easier, I guess because it's just a matter of *doing* and not really figuring things out, but that's also why it gets tedious rather quickly!
.



Relevant Pages

  • best way to get data into a new instance?
    ... Let's pretend I'm creating an Employee class, which I will later subclass for more specific jobs. ... I'm trying to construct it in a way that is independent of, say, the GUI interface that will be used, but I can't help but think that if all the data is entered into a GUI, then passed programmatically to the class, then it's no big deal because it happens behind the scenes. ... Granted, even with the GUI they are basically typing in arguments, but in the manual case you'd have to type in the call to the class, the parentheses, commas, quotes around the strings, etc. (But still, I'm trying not to let a specific interface influence the construction of what should probably be a completely independent class implementation.) ...
    (comp.lang.python)
  • Re: Snr. Java Developer
    ... technologies, recommend new ideas, and must be a very effective communicator in a business environment. ... J2EE, GUI Developer, GUI Analyst Flash MX, JSP, Servlets, Struts, ... JavaScript, Action Script, DHTML, XML,.NET, UI design, GUI interface, ... You will be responsible for the design and implementation of the User ...
    (comp.lang.javascript)
  • Re: Great SWT Program
    ... GUI to configure something. ... version of the configuration file. ... Is its design based pragmatically around ... stick shift with the groove pattern ...
    (comp.lang.java.programmer)
  • Re: very interesting survey of Tk vs. other toolkits
    ... Ease of distribution for Tk with Ruby isn't great... ... a modern GUI. ... GUI Design and programming are totally different ... same in every scripting language, except for tcl (and applescript, ...
    (comp.lang.tcl)
  • Re: VS2005 and VS 6.0
    ... design principles, but that's all old stuff anyway, and what good is it? ... Most of MFC is unchanged. ... Am I expected to re-learn the entire GUI? ... And how do I override the OnPaint function? ...
    (microsoft.public.vc.mfc)