[Qt-interest] Design Patterns

Dan White ygor at comcast.net
Tue Nov 10 14:04:35 CET 2009


> Hi Erpin
> 
> Oliver.Knoll wrote:
> > erpin2006 wrote on Monday, November 09, 2009 1:25 PM:
> >
> >> I recently read Design Pattern by GoF. However, now I find I cann't
> >> write anything anymore!
> >
> > Welcome to the next level! Don't worry, your dizzyness is absolutely 
> > normal and will fade quite quickly in time!
> >
> > Now that you know about design patterns you can go on a learn about why 
> > class inheritance is evil ;)
> 
> Or read the PLOPD books and discover that there are actually 12 distinct 
> sub-types of Proxy design pattern and plenty more useful design patterns. If 
> you enjoyed GoF I highly recommend the PLOPD books -- I was just thinking of 
> Conduit Of Change vs Observer last night. After I read GoF there were a few 
> patterns which I found I could make use of straight away.. good starting 
> points are: Singleton, Factory, Observer others may take longer to find 
> their way into your toolbox.
> 
> Someone wiser than I pointed out that many GoF design patterns are just 
> workarounds for natural functional programming constructs (to make up for 
> the fact that C++ doesn't have closures for example).
> 
> Qt implements quite a few design patterns:
> 
> Abstract Factory:
> QMetaObject::newInstance()
> http://doc.trolltech.com/4.5/qmetaobject.html
> 
> Adapter / Proxy:
> QGraphicsProxyWidget (adapts QWidget into a QGraphicsItem)
> http://doc.trolltech.com/4.5/qgraphicsproxywidget.html
> 
> Composite:
> QObject / QWidget
> http://doc.trolltech.com/4.5/qobject.html
> http://doc.trolltech.com/4.5/qwidget.html
> 
> Facade:
> QListWidget, QTreeWidget, QTableWidget
> http://doc.trolltech.com/4.5/qlistwidget.html
> http://doc.trolltech.com/4.5/qtreewidget.html
> http://doc.trolltech.com/4.5/qtablewidget.html
> 
> Chain of Responsibility:
> QWidget and QGraphicsItem event bubbling
> 
> Command:
> QUndoCommand
> http://doc.trolltech.com/4.5/qundocommand.html
> 
> Interpreter:
> QScriptEngine:
> http://doc.trolltech.com/4.5/qscriptengine.html
> 
> Memento:
> QByteArray in QMainWindow::saveState() / restoreState()
> 
> Observer:
> Signals & Slots
> Model/View framework
> http://doc.trolltech.com/4.5/model-view-programming.html
> 
> Any others in Qt?
> 
> 
> If you're looking for another enlightening read try Martin Fowler's 
> "Refactoring" -- another Addison Wesley book which changed my life.
> 
> Cheers
> 
> Ross. 
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest

PLOPD (for the Google-challenged) == Pattern Languages of Program Design

How would you compare these books to the POSA (Pattern-Oriented Software Architecture) books ? I started on those because of Doug Schmidt and the ACE libraries.  Heavy reading, but worthwhile once you fight your way through it.

“Sometimes I think the surest sign that intelligent life exists elsewhere in the universe is that none of it has tried to contact us.”
Bill Waterson (Calvin & Hobbes)






More information about the Qt-interest-old mailing list