Re: preemptive OOP?




class MyNotebook(wx.Notebook):
def __init__(self, parent):
wx.Notebook.__init__(self, parent)

So my question in general is, is it a good idea to default to an OOP
design like my second example when you aren't even sure you will need
it? I know it won't hurt, and is probably smart to do sometimes, but
maybe it also just adds unnecessary code to the program.

My feeling is that there is no good reason to add the complexity of your
own custom classes if they provide no additional data or behaviour. If you
know you have plans to add your own attributes and/or methods to MyNotebook
soon, there's no harm in doing this now, but why? You can always create your
own custom subclass at the point when you have something of value to add and
through the mircale of polymorphism, it will function everywhere a Notebook
would.

-ej


.



Relevant Pages

  • Re: preemptive OOP?
    ... design like my second example when you aren't even sure you will need it? ... I know it won't hurt, and is probably smart to do sometimes, but maybe it also just adds unnecessary code to the program. ... becomes more difficult and makes the resulting code more brittle. ... In my experience a lot of GOOP results exactly from trying to anticipate future requirements, thus introducing unneeded interfaces, factories, etc. ...
    (comp.lang.python)
  • Re: preemptive OOP?
    ... design like my second example when you aren't even sure you will need it? ... I know it won't hurt, and is probably smart to do sometimes, but maybe it also just adds unnecessary code to the program. ... anyone else looking at the code has to figure out that MyNotebook is just wx.Notebook, and then wonder if they are missing something subtle because you must have had a reason to create a new class... ... It's the difference between running with running shoes on or wet, ...
    (comp.lang.python)
  • Re: Binding to Custom Classes
    ... there is a design change and there is a need to bind the data to a datagrid. ... The custom classes were designed to be simple container classes ... idea of maybe going back to the idea of typed datasets. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: up front designs always useless
    ... whole software development process because many projects are hurt by ... but you make sure to push away tying yourself to any design or ... architectural position until you absolutely have to. ...
    (comp.object)
  • Accessing Class Properties
    ... When designing a DAL, I designed the methods to return custom classes that contain properties. ... public class Employee ... private string _name; ... The requirements have since changed completely from what they were originally and I'll have to design the DAL as a web service. ...
    (microsoft.public.dotnet.framework.webservices)