[bt-devel] Programming Techniques

David White bt-devel@crosswire.org
09 Mar 2002 23:15:48 +1100


On Sat, 2002-03-09 at 21:20, Joachim Ansorg wrote:
> Hi Dave!
> > CStyleEditorDlg* dlg = new CStyleEditorDialog(style,this);
> > dlg->exec();
> > delete dlg;
> >
> > It should instead read:
> >
> > CStyleEditorDlg dlg(style,this);
> > dlg.exec();
> 
> Fixed now.

ok great, but of course this was one example of many.

> 
> > (Exception: Some gui libraries require that certain objects be allocated
> > on the heap. This is not common, but if it is the case with Qt then this
> > would be an exception)
> 
> All QWidgets delete their child widgets at destruction time. So the child 
> child widgets should be created on the heap.

this is like MFC, I don't like this at all, but nothing we can do :-/

> Since the backend/ classes are our own ones we can still discuss on design 
> decissions :)

ok, great :) we can discuss this at some point.

> 
> > I assume CSwordVerseKey is a class (directly or indirectly) derived from
> > CSwordKey. Now, firstly the key class hierarchy should do its best to
> > use polymorphism so that you don't have to get a pointer to the derived
> > class. If you do have to get a pointer to the derived class, in my
> > opinion that is a sign of a potential design flaw in the CSwordKey
> > hierarchy.
> 
> I'd suggest to dicuss abut our class structure after 1.1 is released.

ok sure. On this topic, don't feel any *urgency* about my suggestions.
They are just suggestions. (1) Don't feel obliged to actually do them if
you don't want, they are just suggestions and I will not feel offended
or refuse to contribute in the future if you choose not to follow them,
and (2) don't feel obliged to do them soon. Release schedule should
always come first. Often a good technique for implementing coding
standards is only implement on code when you are actually dealing with
that code anyway, rather than feeling you have to go through your whole
project and do it in one hit.

Blessings,

David.