liveBook · Manning

Business logic

As explained in The Art of Code

A business logic error is a failure caused by incorrect implementation of the application's domain rules or intended behavior.

Business logic errors occur when a user violates an application rule or enters a situation the rules did not anticipate. Treat them as expected failure paths: guide the user, explain the constraint, and provide a route forward instead of exposing technical details. section 7.1.1 section 7.3

Common business-rule violations include:

Design the failure path

An unanticipated user action should not lead to an infinite spinner or an incomprehensible stack trace. Validate and reject invalid requests early, communicate what happened in understandable terms, and help the user complete the intended process. Keep raw implementation details behind the application boundary. section 7.1.1 section 7.3

Table 7.1 Summary of failure types and handling strategies
Type of failure
Description
Business logic errors
Violations of business rules or expected usage constraints that the system must anticipate and communicate clearly
Technical problems
Failures caused by external systems, infrastructure, configuration, or unavailable technical dependencies
Programming errors
Defects in the code itself caused by incorrect logic, invalid assumptions, or broken invariants
Fatal errors
Critical runtime failures that compromise process stability and usually prevent normal recovery

Compare business logic errors with technical problems, programming errors, and fatal errors to choose an appropriate response. section 7.1.4

How The Art of Code covers it

How deep it goes
Defines the category and response principles, but stops short of implementation patterns or detailed validation code.
Examples
Uses invalid forms, expired discounts, unsupported files, duplicate emails, excessive login attempts, and oversized avatar images.
What it assumes
Assumes familiarity with application rules and user interactions while establishing the distinction between business and technical failures.
What you can do after
Evaluate failures by category and design explicit validation, communication, translation, recovery, or fallback behavior.
How it connects
Connects business logic errors with validation, authentication, authorization, technical problems, programming errors, and fatal errors.

Also explained in

Compare how 10 books explain business logic →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Art of Code. The section links point to the parts of the book it draws on.