Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/RTL/Delphi    [ Add a report in this area ]  
Report #:  102417   Status: Open
Add Patterns.pas to allow easily doccument code
Project:  Delphi Build #:  16.0.4358.45540
Version:    16.3 Submitted By:   gad lord
Report Type:  New Feature Request Date Reported:  1/7/2012 1:10:17 PM
Severity:    Commonly encountered problem Last Updated: 8/6/2012 12:58:53 PM
Platform:    All versions Internal Tracking #:  
Resolution: None (Resolution Comments) Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
I woudld be very happy to see an (out of the box) Patterns.pas unit which defines the most common (according to Design Patterns - Elements of reusable object-oriented software book) patterns.

Having this out of the box would push the developers to put the names and implementations of their classes.

I suggest the Patters.pas class to contain a definition like this:

unit Patterns;

interface

type
  TPatternAttribute = class (TCustomAttribute)
  end;

  /// <remarks>
  /// A creational pattern abstracts the instantiation process.
  /// </remarks>
  TCreationalAttribute = class (TCustomAttribute)
  end;

  /// <remarks>
  /// A structural pattern groups objects into larger structures.
  /// </remarks>
  TStructuralAttribute = class (TCustomAttribute)
  end;

  /// <remarks>
  /// A behavioral pattern defines better communication among objects.
  /// </remarks>
  TBehaviouralAttribute = class (TCustomAttribute)
  end;

  {$REGION 'Creational Patterns'}
  TFactoryAttribute = class sealed(TCreationalAttribute)
  end;

  TAbstractFactoryAttribute = class sealed(TCreationalAttribute)
  end;

  TBuilderAttribute = class sealed(TCreationalAttribute)
  end;

  TPrototypeAttribute = class sealed(TCreationalAttribute)
  end;

  TSingletonAttribute = class sealed(TCreationalAttribute)
  end;

  TMultitonAttribute = class sealed(TCreationalAttribute)
  end;
  {$ENDREGION}

  {$REGION 'Structural Patterns'}
  TAdapterAttribute = class sealed(TStructuralAttribute)
  end;

  TBridgeAttribute = class sealed(TStructuralAttribute)
  end;

  TCompositeAttribute = class sealed(TStructuralAttribute)
  end;

  TDecoratorAttribute = class sealed(TStructuralAttribute)
  end;

  TFacadeAttribute = class sealed(TStructuralAttribute)
  end;

  TFlyweightAttribute = class sealed(TStructuralAttribute)
  end;

  TProxyAttribute = class sealed(TStructuralAttribute)
  end;
  {$ENDREGION}

  {$REGION 'Behavioral Patterns'}
  TChainOfResponsibilityAttribute = class sealed(TBehaviouralAttribute)
  end;

  TCommandAttribute = class sealed(TBehaviouralAttribute)
  end;

  TInterpreterAttribute = class sealed(TBehaviouralAttribute)
  end;

  TIteratorAttribute = class sealed(TBehaviouralAttribute)
  end;

  TMediatorAttribute = class sealed(TBehaviouralAttribute)
  end;

  TMementoAttribute = class sealed(TBehaviouralAttribute)
  end;

  TObserverAttribute = class sealed(TBehaviouralAttribute)
  end;

  TStateAttribute = class sealed(TBehaviouralAttribute)
  end;

  TStrategyAttribute = class sealed(TBehaviouralAttribute)
  end;

  TTemplateAttribute = class sealed(TBehaviouralAttribute)
  end;

  TVistorAttribute = class sealed(TBehaviouralAttribute)
  end;
  {$ENDREGION}

implementation

end.
Steps to Reproduce:
None
Workarounds
None
Attachment
None
Comments

None

Server Response from: ETNACODE01