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

  • Home
  • SEARCH
  • 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 533987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:33:54+00:00 2026-05-13T09:33:54+00:00

On a project I’m working on, there is an existing messaging system that sends

  • 0

On a project I’m working on, there is an existing messaging system that sends in-app messages and emails. All the messages are currently hard-coded, with placeholders for specific variables (name, date, stuff like that).

An upcoming requirement for the project is to make all these messages configurable. The details aren’t hugely important, all that matters are these points:

1) The messages should be able to take any object from our ORM and replace portions of the content of the message with values from the object. For example, something like ${User.FirstName} or ${Customer.IsEnabled}, etc.

2) The messages need to be editable by the system admins easily. So compiling stuff in (unless it’s done on the fly) is a no-go.

3) Ideally, there will be a way for me to verify that the message is “valid”, and can be parsed properly. Not a requirement (I intend make a sandbox for them to play in anyway), but it would be nice.

Anyone have any suggestions for the best way to go about this?

  • 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-13T09:33:55+00:00Added an answer on May 13, 2026 at 9:33 am

    You really need to divide the problem into some discrete sub-problems:

    1. Implement a mechanism to load templates from some type of configuration file or database.
    2. Implement a mechanism to parse the templates and extract the substitution markers from them.
    3. Implement a mechanism that interprets and evaluates substitution markers against objects in your program dynamically.
    4. Optionally, implement a mechanism that allows substitution markers to be statically evaluated either during compilation or at application startup.

    So, here’s some advice on each of the sub-problems:

    Template Repository: I would consider going with a simple mechanism initially, but one that would allow you sys admins to make changes without risking messing anything else up. I would probably rule out web/app config files for this reason – and use either a settings file or (if your app already uses it) a database table. You may want to give each template a stable internal identifier as well as a customizable name. The code would rely on the stable identifier while the name is just a convenient way for admins to organize these templates.

    Parsing Markers: This is one place where regular expressions seem to be a reasonable choice. It’s not terribly difficult to parse out patterns of the form $(…) correctly.

    Interpreting/Evaluating Markers: This is one of the more complicated parts of your problem. Unless performance is of paramount concern, I would probably use reflection and a bit of string manipulation to do the job. If you can constraint the substitution markers to only ever refer to public properties of your ORM objects, that would make life a lot simpler too. You could then just split the string based on ‘.’ characters and then use iterative logic to fetch the value of the corresponding property until you get to the final value.

    Compile/Runtime Validation: This is a tall order. You definitely want to get all of the other pieces working first. Once you do, one way of implementing this may be to load all templates at app startup, visit each one and make sure that the markers in the templates all exist in the object types in your ORM. Since it looks like you are already prefixing the object type name into the marker, this should be possible. Unfortunately, you probably can’t reuse the same logic that evaluates markers to validate them – since for validation you don’t have instances of the types – just their type information.

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

Sidebar

Related Questions

A project I'm working on at the moment involves refactoring a C# Com Object
My project is currently using a svn repository which gains several hundred new revisions
The project I'm working is using n-tier architecture. Our layers are as follows: Data
Project file here if you want to download: http://files.me.com/knyck2/918odc So I am working on
Project is C#. So I have a bunch of multithreaded code that is designed
Project#1 has some interfaces and classes that project#2 references. Now I want to use
Project Darkstar was the topic of the monthly JavaSIG meeting down at the Google
Every project invariably needs some type of reporting functionality. From a foreach loop in
My project is based on spring framework 2.5.4. And I try to add aspects
My project has both client and server components in the same solution file. I

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.