Headline

Log and analyze salary changes

Description

Salaries of employees may change over time. For instance, a salary cut systematically decreases salaries. Of course, a pay raise could also happen; point-wise salary changes are conceivable as well. Salary changes are to be logged so that they can be analyzed within some window of interest. Specifically, a salary cut is to be logged with names of affected employees, salary before the change, and salary after the change. The log is to be analyzed in a statistical manner to determine the median and the mean of all salary deltas.

Motivation

The feature requires logging of updates to employee salaries. Depending on the programming language at hand, such logging may necessitate revision of the code that changes salaries. Specifically, logging of salary changes according to a salary cut may necessitate adaptation of the actual transformation for cutting salaries. Logging should be preferably added to a system while obeying separation of concerns. So logging is potentially a crosscutting concern, which may end being implemented in a scattered manner, unless some strong means of modularization can be adopted.

Illustration

The log for salary cut for the "standard" sample company would look as follows.

[ LogEntry {name = "Craig", oldSalary = 123456.0, newSalary = 61728.0},
  LogEntry {name = "Erik", oldSalary = 12345.0, newSalary = 6172.5},
  LogEntry {name = "Ralf", oldSalary = 1234.0, newSalary = 617.0},
  LogEntry {name = "Ray", oldSalary = 234567.0, newSalary = 117283.5},
  LogEntry {name = "Klaus", oldSalary = 23456.0, newSalary = 11728.0},
  LogEntry {name = "Karl", oldSalary = 2345.0, newSalary = 1172.5},
  LogEntry {name = "Joe", oldSalary = 2344.0, newSalary = 1172.0}
]

For what it matters, the salary cut operates as a depth-first, left-to-right traversal of the company; thus the order of the entries in the log. Projection of changes to deltas and sorting them results in the following list of deltas:

[ -117283.5,
  -61728.0,
  -11728.0,
  -6172.5,
  -1172.5,
  -1172.0,
  -617.0
]

Clearly, the median is the element in the middle:

-6172.5

By contrast, the mean is much different because of the skewed distribution of salaries:

-28553.355

See Contribution:haskellLogging for a simple implementation of the feature in Language:Haskell.

Relationships

Guidelines

  • The name of the type for logs should involve the term "log".
  • A suitable demonstration of the feature's implementation should cut the sample company and compute the median of the salary deltas, as indeed stipulated above.

Ralf Lämmel edited this article at Mon, 26 Jun 2017 20:18:36 +0200
Compare revisions Compare revisions

User contributions

    This user never has never made submissions.

    User edits

    Syntax for editing wiki

    For you are available next options:

    will make text bold.

    will make text italic.

    will make text underlined.

    will make text striked.

    will allow you to paste code headline into the page.

    will allow you to link into the page.

    will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

    will allow you to paste image into the page.

    is list with bullets.

    is list with numbers.

    will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

    will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

    will allow your to insert code snippets from @worker.

    Syntax for editing wiki

    For you are available next options:

    will make text bold.

    will make text italic.

    will make text underlined.

    will make text striked.

    will allow you to paste code headline into the page.

    will allow you to link into the page.

    will allow you to paste code with syntax highlight into the page. You will need to define used programming language.

    will allow you to paste image into the page.

    is list with bullets.

    is list with numbers.

    will allow your to insert slideshare presentation into the page. You need to copy link to presentation and insert it as parameter in this tag.

    will allow your to insert youtube video into the page. You need to copy link to youtube page with video and insert it as parameter in this tag.

    will allow your to insert code snippets from @worker.