Pergunta

The examples of default settings:

  • Default port for server applications
  • Default resources directory for Java Applications
  • Default Webpack config file ("webpack.config.js")

My particular case

I have a utility for web application projects building, based on gulp and webpack.

enter image description here

When a user did not specify some settings in config file of his project (similar to pom.xml, webpack.config.js, etc.) DefaultSettings will be substituted. The example of default settings for markup preprocessing:

{
  indentationSpacesCountInOutputCode: 2,
  mustExecuteHTML5_Validation: true,
  mustExecuteCodeQualityInspection: true,
  mustExecuteAccessibilityInspection: true
}

Maybe I can call it "the business rules", but it including, for example, the paths which must not be watched for browser live reloading providing for specific framework:

{
  laravelBasedProjectRelativePathsWhichWillBeWatched: {
    includedDirectoriesRelativePaths: [
      "app",
      "bootstrap",
      "config",
      "database",
      "public",
      "resources",
      "routes",
      "storage",
      "tests"
    ]
  }
}

In Clean Architecture, the business rules must not know anything about frameworks.
And also, I need to put somewhere the default settings for specific utilities (e. g. Webpack).

The InternalSettings (I call them so because user can not override it) are currently restrictions of my library, for example, supported file names extensions:

export default {
  supportedSourceFileNameExtensionsWithoutDots: [ "mjs", "js", "ts" ],
  supportedOutputFileNameExtensionsWithoutDots: [ "js" ]
};

I am not sure I can call it "business rules".

If default and internal settings are not the business rules, what are they?

Foi útil?

Solução

A Default value is a piece of Business Logic.

  1. Kevin takes an order to photocopy a sheet of paper
  2. Kevin goes to the printer
  3. Kevin sees that the piece of paper is A4
  4. The customer did not specify the size of the photocopy
  5. Kevin deduces from this lack of information, and the original being sized at A4 that the copy should be A4
  6. Kevin selects the A4 Copy option
  7. Kevin finalises the transaction withthe3 customer.

There is a piece of Business Logic for making a photocopy (step 6). But the size of paper is deduced by another piece of Business Logic (step 5, with input on step 3/4).

In this case the Default Setting was a dynamic calculation. But it could easily be that the business rule is always use A4, even when copying A3/A2/A1 unless told otherwise.

The Business Rules are higher level statements like: When photo-copying copy to the size of paper the customer asked for, otherwise to the same size as the copied page.

Outras dicas

Should default settings be considered as business rules [...]

There are many posts explaning what business rules are exactly, but in the simplest definition I'd say business rules are the reason the application exists. Without business rules, there wouldn't be a need to create a program.

Business rules can have defaults, meaning if the user interface allows the end user to omit certain details, the program will use default values provided by the business.

If default and internal settings are not the business rules, what are they?

Technical settings like mentioned in the question, are required to make the application run, but they have nothing to do with actual business rules. An acceptable term would be Application configuration settings.

These kinds of settings are not provided by the business, but by the programmer working on the application.

Licenciado em: CC-BY-SA com atribuição
scroll top