Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 753815
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:56:26+00:00 2026-05-14T14:56:26+00:00

I know it’s important to keep user interface code separated from domain code–the application

  • 0

I know it’s important to keep user interface code separated from domain code–the application is easier to understand, maintain, change, and (sometimes) isolate bugs. But here’s my mental block …

Delphi comes with components with methods that do what I want, e.g., a RichText Memo component lets me work with rich text. Other components, like TMS’s string grid not only do what I want, but I paid extra for the functionality. These features put the R in RAD.

It seems illogical to write my own classes to do things somebody else has already done for me. It’s reinventing the wheel [ever tried working directly with rich text? 🙂 ] But if I use the functionality built into components like these, then I will end up with lots of intermingled UI and domain code–I’ll have a form with most of my code built into its event handlers.

How do you deal with this issue? … Or, if I want to continue using the code others have already written for me, how would you suggest I deal with the issue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T14:56:26+00:00Added an answer on May 14, 2026 at 2:56 pm

    First off, remember that “dealing with rich text” isn’t what your app is supposed to do. Your app is supposed to enable the user to perform a certain task, and the code to take care of that task is your domain logic. If part of the task that your program needs to accomplish involves working with rich text, then you can delegate that part of it to a rich text component. The complexity comes, as you mentioned, at the interface between these libraries and domain logic.

    The way Delphi domain logic and Delphi UI controls interact with each other is mostly through event handlers. But that doesn’t mean that you need to put your domain logic in the event handlers themselves. Instead, try writing units that contain the code for the domain-specific tasks you need to accomplish, and have the event handlers call those units.

    In other words, don’t write classes to reinvent the wheel and do things others have already done for you. You’re right, that would be illogical. But write the application-specific parts that the controls and libraries you use haven’t provided as their own separate classes in their own separate units, and connect them through event handlers and public methods or properties on your forms, and you’ll end up with decent separation of concerns.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Know of a way to mock %[]? I'm writing tests for code that makes
I know Google Maps (or VLC used to) lets you share files from iTunes
Does anyone know how can I replace this 2 symbol below from the string
I know in certain circumstances, such as long running processes, it is important to
I know Python has many ways of storing and reading data from files, so
Know this might be rather basic, but I been trying to figure out how
Know if it's possible to access the iPhone compass in Safari using JavaScript? I
I know you can not set a key value dynamically, but what about the
I know that Phonegap has an event for back button, but it's only available
I know there have been many questions on grid and pack in the past

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.