Board index » delphi » Design patterns in the modern IDE (Delphi, MFC, etc.)

Design patterns in the modern IDE (Delphi, MFC, etc.)

Look at
http://www.burn-{*word*221}.demon.co.uk/patterns.htm
http://www.modelmaker.demon.nl/patterns.htm
Quote
Andy Bulka wrote:
> Summary: Can anybody spot the patterns in existing development tools
> (e.g. Delphi, Toolbook, VB) and tell me how to leverage those pattern
> architectures in combination with hand coded patterns that I read from
> pattern books?

 

Re:Design patterns in the modern IDE (Delphi, MFC, etc.)


Quote
Andy Bulka wrote in message <36D493F5.50595...@netspace.net.au>...
>Summary: Can anybody spot the patterns in existing development tools
>(e.g. Delphi, Toolbook, VB) and tell me how to leverage those pattern
>architectures in combination with hand coded patterns that I read from
>pattern books?

I haven't actually looked for patterns in Delphi, but there are a few that
come to mind.

Quote
>Of course patterns summarise what is best practice - so
>there will always be patterns to be found in modern development
>environments and their class libraries.  I'm thinking more of what
>facilities, components, concepts and class libraries modern development
>environment vendors are already providing us, without necessarily
>calling them 'patterns'.

>More specifically, I want to know what patterns are being used in say,
>the Delphi VCL or the Microsoft Foundation Class Library.  Has anybody
>ever gone through and identified the patterns being used in say Delphi?

While reading Pattern Hatching, I was struck that Delphi's method of
deriving
a class from TForm for the developer to use, is a bit of a twist on the
Generation Gap pattern that Vlissides describes.

Object destruction for classes in the VCL is (I suspect) an implimentation
of the Template Method pattern, as the coder calls MyObject.Free, which is
defined as a method of TObject (Delphi's base class), which in turn calls
the
virtual Destroy method.

Quote
>e.g. again, the idea of components having events must be a well known
>pattern...

I would expect that there is a pattern for this written up somewhere.

Basicly, a component has a set of method pointers, which it calls at
appropriate times, and that the developer (and the environment) can set
to point to method that are to be executed at that appropriate time.

Quote
> And data-aware components - aren't these implementing the
>'observer pattern'?  ActionLists in Delphi (version 4) I think are
>a variation of observer.

I haven't looked at the source, but their behavior implys that they could
very well be.

Quote
>Datasource component - proxy pattern
>perchance?

I don't think so.  From the description of the Proxy Pattern at
http://rampages.onramp.net/~huston/proxy.html

"You need to support resource-hungry objects, and you do not want to
instantiate
such objects unless and until they are actually requested by the client. "

I don't see the Datasource Component working that way.  To me it creates a
single
interface for a few different other components (TTable and TQuery)

Which to me sounds more like an Adaptor or a Bridge.

Quote
>Secondly - I am particularly interested in the MVC
>(Model/View/Controller)
>architectural pattern and how to implement it in a modern
>environment like Delphi.  (I know Smalltalk has MVC built in, and Java
>programmers have MVC in Swing - but am ignorant of the details).  I
>don't want to write tons of code to implement MVC - hopefully I can
>LEVERAGE some of what Delphi already has!

>For example, in some sense, data-aware components
>provide multiple 'views' of the same 'data/model', so by using these
>Delphi components, I may be getting a cheap & easy Model/View/Controller
>implementation - aren't I? (assuming I write my new 'views' as
>combinations of data-aware visual components...)

I'm thinking that that is what you're getting.

Simon

Re:Design patterns in the modern IDE (Delphi, MFC, etc.)


Quote
>Secondly - I am particularly interested in the MVC
>(Model/View/Controller)
>architectural pattern and how to implement it in a modern
>environment like Delphi.

I've just implemented a set of model-view-controller things in my
application. It's great fun building these patterns with so-called
non-visual controls (by which they mean that they're visible at
design-time but not at run-time).  So normally you'd write out the code
for each of the parts of the MVC. But in Delphi you plonk down a 'model'
component, plonk down a 'controller' component and connect up its
properties, and plonk down a visual 'view' component and connect up its
properties and that's it. Delphi already provides 'free-notification'
stuff which helps a lot with this sort of peer-object-arrangement but
you'll have to do the change-notification stuff yourself.

And yes, you're correct that the database data-aware controls already
implement this.

--
Lucian Wischik, Queens' College, Cambridge CB3 9ET. www.wischik.com/lu

Other Threads