-2

I've been trying to evaluate the pros and cons of writing a system that generates data reports in two different approaches, but I am trying to talk about these different approaches as general concepts. I know there must be a lot of material on this topic, but I can't exactly narrow down the terminology I am looking for so that I can actually look up the concept... so I'll describe it here.

In simple terms, it's the difference between two approaches, in this case for a system that generates data reports:

1) You make a unique model "hard-coded" (for lack of a better term) to the given report data, meaning that you have a property with the name of the individual unit of data.

For example, a CartonOfJuice might have a property for Color, Volume, ExpirationDate, Price, Label, RefrigerationNeeded, etc.

Then you have a piece of code that specifically runs calculations on a collection of CartonOfJuice models to come out with an output, this may mean that you have a SUM function that specifically calculates a total based on all the Price values on every CartonOfJuice.

This might also mean a new database table for every single unique model.

If you want to add a new model or calculation, you write a new class model with properties attached, and a new set of functions and calculations to handle the input and output of a report related to those new models.

2) Instead you write an engine where you can be given a list of key value pairs, and a class that runs basic calculations on any number of values based on a configuration, including the ability to have custom user defined scripts that define more complex functions.

Now if you want to add a new model or calculation, you don't need to write any new code as long as you've got the basics covered. The user can define a whole new model by defining a list of keys and types, and they could even script a function that does a custom calculation and add it to the system.

The system will now run defined data transformations without you having to compile a new system or "hard-code" any models to a specific report.

In theory this could mean you use a lot less code to get a system that processes 20 different reports, rather than having to code out the implementation for each report by itself.

Instead of having to add a new database table, you would just save a new JSON configuration model (for example) that describes a new data set and a new set of rules or steps that you want to run as transformations on that data set. You may also provide a new script that pairs with one of the rules or steps in your configuration model.

So what am I describing here, if the word "hard-coded" is used when you define a value in code, what is the word for when you define a variable name in code?

I know it's more than just DRY, and just "configuration" doesn't seem specific enough.

TL;DR How do I look up resources on the pros and cons of writing an engine versus "hard coding" some specific functionality, and is there a better term besides "hard coding" for this concept?

  • Just so we're clear this is asking for a definition or a pre-defined concept, not looking for an opinion, there is an objective answer to this question. – MetaGuru Sep 9 at 22:10
  • From my experience, your type 1 is just what is meant by "report" - it is coded up by a developer (or equivalent specialist). A "custom report" allows an end-user to define their own reports from a set of pre-defined options and operations. Relatedly, a "static report" is one that is generated once and the data is frozen into the report, while a "dynamic report" is updated whenever reviewed/refreshed. You might look at "custom reports" as a term and see how existing systems talk about the features and options to held advance your search. – BrianH Sep 9 at 22:54
  • report was just the example, I'm curious about the general term for software that is hard coded versus customizable, but maybe what I am looking for doesn't exist, but another example could be like if I wrote code to create a PowerPoint presentation versus writing PowerPoint and now anyone can make presentations... – MetaGuru Sep 10 at 17:53
  • It sounds a bit like you're asking for a "domain specific language" (DSL), at least when it comes to the scripting. – Simon B Sep 11 at 7:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.