IT SOLUTIONS
Your full service technology partner! 
+Expand
   ► KBRole-Based T...Coding & OOObject Orien...   Print This     
  From the August 2010 Issue of Prestwood eMag
 
Coder Object Orientation (OO):
Class Helper
 
Posted 16 years ago on 2/7/2009 and updated 9/20/2009
Take Away:

A. In Dephi, class helpers allow you to extend a class without using inheritance. With a class helper, you do not have to create and use a new class descending from a class but instead you enhance the class directly and continue using it as you always have (even just with the DCU).

B. In general terms, developers sometimes use the term to refer to any class that helps out another class.

Coder Definition Flashcard:
 A flashcard from our Coder Flashcards Library
 A definition from our Coder Definitions Page

KB101868

Class Helper -

A. In Dephi, class helpers allow you to extend a class without using inheritance. With a class helper, you do not have to create and use a new class descending from a class but instead you enhance the class directly and continue using it as you always have (even just with the DCU).

B. In general terms, developers sometimes use the term to refer to any class that helps out another class.


Class Helpers Help with Source Code Control

Like partial classes, Delphi class helpers are primarily a source code control feature. A class helper tells the compiler to increase the compile scope when resolving identifiers. A partial class is a class that can be split into two or more source code files and/or two or more locations within the same source file. In very general terms, class helpers allow you to easily extend a class when inheritance isn't possible or practical. Contrast with partial classes which are used for source code management with code generators and large classes to split ownership of a class. Class helpers allow you to cheat a bit while partial classes allow you to divide and conquer.

Delphi class helpers are especially usefull with code libraries such as the VCL where it is difficult to predict and implement all future uses. When designing a rich code library, you have to decide when to surface what functionality, which classes a user can inherit from, when to seal a class, etc. Sometimes, allowing a user to use class helpers to add their routines to your code library is the best approach. Whether you use them within you're own code is a bit more questionable but ultimately if the final code is more maintainable and easier to extend, then you've done your job. 

More Info

Code:  Delphi Class Helpers (class helper for)
Definition:  Partial Class

Comments

0 Comments.
Share a thought or comment...
 
Write a Comment...
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P162A1
Enter key:
Definition Contributed By Mike Prestwood:

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains play-drums.com and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.

Visit Profile

 KB Article #101868 Counter
11283
Since 2/7/2009
Sales Website: www.prestwood.com Or visit our legacy sales site: 
legacy.prestwood.com


©1995-2025 Prestwood IT Solutions.   [Security & Privacy]