What are the Fitness Functions?

Ritresh Girdhar
Nerd For Tech
Published in
4 min readJul 9, 2021

--

An evolutionary architecture supports guided, incremental changes across multiple dimensions.

Photo by Shahadat Rahman on Unsplash

Background

Fitness function initially stated in Evolutionary computing and Genetic Algorithm to guide simulations towards optimal design solutions.

Evolutionary computing is all about guided incremental changes, in which engineers access the current state and measure how close it is to the desired state.

Purpose

Is to help in identifying how close a given solution is to the optimum solution of the desired problem. In layman's terms determine the fitness of the solution.

For Example: When using a genetic algorithm to optimize wing design, the fitness function assesses wind resistance, weight, airflow, and other characteristics desirable to good wing design.

For a Junior Developer, the Fitness function could be a unit test case of the code written by her related to some business provided problem.

For a Software Architect, the Fitness function could be the way to make sure the developer does not impact the basic architecture characteristics of the software while making continuous incremental changes.

An architectural fitness function provides an objective integrity assessment of some architectural characteristic(s).

Why do we need It — Software architecture?

Software applications and their architecture evolve in multiple dimensions over time. Facebook could be the perfect example to discuss, over the years it grows in numerous dimensions from performance to integration.

Software architecture, can not be guided by a single fitness function but it could be guided by a Systemwide fitness function which is nothing but a set of fitness functions that corresponds to each dimension.

System-wide fitness function will make sure that software evolving in each dimension as guided by the respective fitness function.

Dimensions could be

  • Performance,
  • Reliability,
  • Security,
  • Operability,
  • Coding standards, and
  • Integration

As an architect, it is our duty to define fitness function for each component and dimension of software architecture. For example: If the requirement of a Rest Api is to serve the request within 100ms then the fitness function would be a performance test implementation that will randomly hit the Rest API multiple times and measure the time taken by the API and fails if API response time is greater than 100ms.

This set of tests would become a performance suit. For any minor/major change these performance suits could execute to check the performance dimension of the software application.

These are some of the categories of Fitness functions.

Atomic Versus Holistic

Atomic fitness functions run against a singular context and exercise one particular aspect of the architecture.

Holistic fitness functions run against a shared context and exercise a combination of architectural aspects such as security and scalability.

Triggered Versus Continual

Triggered fitness functions run based on a particular event, such as a developer executing a unit test, a deployment pipeline running unit tests, or a QA person performing exploratory testing

Continual tests don’t run on a schedule, but instead, execute constant verification of architectural aspect(s) such as transaction speed.

Static Versus Dynamic

Static fitness functions have a fixed result, such as the binary pass/fail of a unit test.

Dynamic fitness functions rely on a shifting definition based on extra context.

Automated Versus Manual

Continuous integration, deployment pipelines — can be the example of the automated fitness function.

Manual fitness functions are verified by a person-based process like QA Testing.

When To Design Fitness Functions?

Fitness function designing should be started at an early stage, For example: If architects determine that security and payment play a significant role in the system-wide fitness function, it may lead the team to design an architecture that keeps these concerns together.

Without identifying fitness functions this early, a team may end up with these responsibilities scattered throughout the entire codebase, requiring a broader impact analysis to understand change and driving up the overall cost of modification.

Who Should Review Fitness Functions?

Business and technical stakeholders will update the fitness function to meet design goals.

A fitness function review generally includes the following:

  • Reviewing existing fitness functions
  • Checking the relevancy of the current fitness functions
  • Determining the change in the scale or magnitude of each fitness function
  • Deciding if there are better approaches for measuring or testing the system’s fitness functions
  • Discovering new fitness functions that the system might need to support

Thanks for reading, hope you will get the idea about the importance of Fitness function in Software Architect life.

Do check out my other articles here https://ritresh-girdhar.medium.com

--

--

Ritresh Girdhar
Nerd For Tech

Father || Coder || Engineer || Learner || Reader || Writer || Silent Observer