Exceptions Are Hidden Return Values – And That’s a Problem

Exceptions are one of the most widely adopted error-handling mechanisms in modern programming languages. They are convenient, expressive, and deeply integrated into the runtime of languages such as Java, C++, and C#.

But there is a fundamental problem with using exceptions to represent failures: they introduce additional exit channels into functions, outside their declared return type.

And that makes code harder to understand, reason about, test, and maintain.

A function should have an explicit contract

Consider a simple Java method:

public Account withdraw(Account account, Money amount) {
    // ...
}

When reading this signature, we know what the function returns: an Account.

But do we know all the possible outcomes?

Not necessarily.

The method might throw an InsufficientFundsException, an IllegalStateException, a NullPointerException, or any number of other runtime exceptions.

The actual contract is therefore not simply:

  • Input: Account, Money
  • Output: Account

It is closer to:

  • Input: Account, Money
  • Output: Account, or potentially any unchecked exception.

The signature tells us only part of the story.

This is particularly problematic because a caller cannot determine, by looking at the method signature, which exceptional outcomes it should expect or handle.

Checked exceptions don’t solve the fundamental problem

Java attempted to address this issue with checked exceptions.

Consider:

public Account withdraw(Account account, Money amount)
        throws InsufficientFundsException {
    // ...
}

At least now the compiler forces callers to acknowledge InsufficientFundsException.

But we have introduced a second completion channel.

The method can either return an Account or terminate by throwing an InsufficientFundsException. These are two distinct possible outcomes, and both are part of its contract.

Conceptually, the method has two possible result types:

Account | InsufficientFundsException

Of course, Java doesn’t represent them as a single return type. Instead, it uses a separate language mechanism.

This separation is precisely the problem.

And checked exceptions don’t cover everything. Runtime exceptions can still escape without being declared, meaning the actual set of possible outcomes can be larger than the signature suggests.

We have traded some uncertainty for a different kind of complexity, without eliminating the underlying issue.

Why not make failures part of the return type?

There is a much more explicit way to model multiple possible outcomes: represent them in the return type itself.

Languages with algebraic data types and libraries providing Either and Result types make this possible.

For example, using the Vavr library in Java, instead of throwing an exception when an account has insufficient funds, we could write:

import io.vavr.control.Either;

public Either<WithdrawalError, Account> withdraw(
        Account account,
        Money amount) {
    if (account.balance().isLessThan(amount)) {
        return Either.left(new InsufficientFunds());
    }

    return Either.right(account.withdraw(amount));
}

The function returns one of two explicitly declared outcomes:

  • A successful result: Account
  • A business failure: WithdrawalError

The caller cannot pretend that the second outcome doesn’t exist. It is part of the function’s return type.

In a language with exhaustive pattern matching, the compiler can also help ensure that every possible outcome is handled.

For illustration, the following is pseudocode rather than Java:

match withdraw(account, amount) {
    Right(updatedAccount) -> save(updatedAccount)
    Left(InsufficientFunds) -> rejectWithdrawal()
}

There is no hidden exit channel. There is no surprise exception waiting to escape at runtime.

The function’s contract describes its possible business outcomes, and the type system can help enforce that contract.

Business errors are not exceptional circumstances

Perhaps the most important distinction is between business failures and system failures.

Consider these examples:

  • An account has insufficient funds.
  • A customer is not eligible for a discount.
  • A requested operation violates a business rule.
  • An invoice cannot be issued because a required field is missing.

Are these exceptional circumstances?

Not really. They are ordinary outcomes of business operations.

A withdrawal can succeed or fail because of insufficient funds. Both outcomes are legitimate possibilities within the business domain.

A customer can be eligible or ineligible for a discount. Both are valid results of evaluating the business rules.

Calling these outcomes exceptions doesn’t make them exceptional. It simply forces us to express normal business decisions through a mechanism designed to interrupt normal program execution.

Business logic should explicitly model these outcomes.

If a business operation can fail for a known reason, that reason should be represented in its return type.

This has another important consequence: business errors become part of the domain model rather than implementation details of the language’s exception mechanism.

They can be documented, tested, transformed, composed, and handled intentionally.

What about system failures?

There is a common argument against this approach: system failures are different.

Network connections can drop. Disks can become unavailable. Database servers can crash. Operating system calls can fail.

These are real failures, and we cannot simply ignore them.

But why should they require a different mechanism for leaving a function?

There is no fundamental reason.

A network request can return a successful response or a connection error. A database operation can return a result or a database error. A file operation can return its contents or an I/O error.

All these outcomes can be represented in types.

And we don’t need a functional programming language to do this. Java can express exactly the same idea using Either or Result types.

For example, using Vavr:

import io.vavr.control.Either;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

public Either<IOException, String> readFile(Path path) {
    try {
        return Either.right(Files.readString(path));
    } catch (IOException e) {
        return Either.left(e);
    }
}

The method explicitly declares both possible outcomes:

  • A successful result containing the file contents.
  • An IOException describing why the operation failed.

The exception is caught at the boundary where the system interaction happens and converted into an ordinary, typed result.

From that point on, callers don’t need to know about Java’s exception mechanism. They can compose operations, inspect results, and decide how to handle failures using the same mechanism they use for business-level errors.

This is the important distinction: the fact that a failure originates in the operating system or an external service doesn’t mean it needs a different representation in application code.

We know that networks fail. We know that disks fail. We know that external services become unavailable.

Their occurrence may be unpredictable, but their possibility is not.

And if a function can produce a particular observable failure, its contract should communicate that possibility.

There is no fundamental reason to give system failures a separate exit channel from successful results.

Exceptions can still be a valid architectural mechanism

There are programming models where exceptions have a legitimate and important role.

Erlang is a particularly interesting example.

Its concurrency model uses lightweight BEAM processes, isolation, and supervision trees. Process failures and exception handling are first-class architectural concepts.

A process can fail, and a supervisor can detect its termination and apply a configured restart strategy.

This is an explicit fault-tolerance strategy built into the runtime and programming model.

It is fundamentally different from using exceptions to represent ordinary business outcomes.

A customer cannot withdraw money because their account has insufficient funds. That is a business result.

A BEAM process crashes because an unexpected failure prevents it from continuing. That is a process failure managed by the supervision architecture.

These are different concerns, and they deserve different handling strategies.

The existence of such programming models doesn’t invalidate the argument. It reinforces the importance of distinguishing between domain-level outcomes and runtime-level fault management.

Explicit contracts lead to more predictable systems

Why does this distinction matter so much?

Because software becomes harder to reason about when functions can exit through channels that aren’t visible in their signatures.

When a function returns a Result or Either, its possible outcomes are explicit.

A caller can inspect those outcomes, decide what to do, and propagate them to another operation.

When a function throws an unchecked exception, the caller might not even know that such an outcome is possible.

This creates several problems:

  • Incomplete error handling: callers may handle the expected return value while overlooking an unchecked exception.
  • Hidden dependencies: understanding a function’s behavior requires reading its implementation and potentially the implementations of everything it calls.
  • Fragile refactoring: changing an internal implementation can introduce new runtime exceptions that callers were never designed to handle.
  • Less reliable tests: tests may verify the declared return values without covering all the possible exceptional execution paths.

None of these problems is inevitable, and exceptions can certainly be handled carefully. But the language mechanism makes it easier to leave parts of the contract implicit.

Explicit result types move that responsibility into the type system.

They make the code communicate its intentions rather than relying on developers to discover them.

This is particularly valuable in small engineering teams, where code is frequently maintained by people other than its original authors and where there may not be enough resources for exhaustive testing.

A compiler that can help identify unhandled outcomes is a valuable safety net.

It doesn’t eliminate bugs, but it can prevent entire categories of mistakes before the application runs.

The type system should describe the whole contract

Exceptions are useful. They are deeply integrated into many programming languages, and some programming models even depend on them for their fault-tolerance mechanisms.

But usefulness doesn’t make them the right abstraction for representing the possible outcomes of a function.

A function’s observable behavior should be reflected in its type.

If it can return an account or an insufficient-funds error, its return type should say so.

If it performs I/O, its type should communicate that effect.

If it can produce a network error, that possibility should be represented explicitly rather than escaping through an undeclared control-flow channel.

There is no fundamental reason to give failures a separate exit channel from successful results.

The goal is not to make error handling more complicated. It is to make the actual contract of a function visible, intentional, and enforceable.

A function’s signature should tell us what it can do and what outcomes it can produce. Not just what happens when everything goes right.

Your Framework Should Not Own Your Business Logic

We have a habit of calling things non-functional requirements when we don’t want to think too hard about them.

Transactions. Retries. Rollbacks. These are often delegated to frameworks through annotations, configuration, or other runtime mechanisms. We treat them as infrastructure concerns, separate from the application itself.

I think this is a mistake.

Not because frameworks are bad, or because annotations are inherently wrong. The problem is that, by using them, we can unknowingly delegate decisions that belong to our application to a framework that has no business making them.

A transaction is not just an infrastructure concern

Consider a Spring application:

@Transactional
public void processOrder(Order order) {
    inventory.reserve(order);
    payment.charge(order);
    shipping.schedule(order);
}

This looks reasonable. The method performs a business operation, and Spring takes care of the transaction.

But what does taking care of the transaction actually mean?

  • Which operations must succeed or fail together for the order to remain consistent?
  • What happens if inventory is reserved but the payment fails?
  • Can we roll back the payment? Can we release the inventory?
  • What happens if shipping has already been scheduled when a later operation fails?
  • Which failures should trigger a rollback, and which should not?

These are not merely database questions. They are business questions.

A transaction defines a consistency boundary. It determines which state changes must be treated as one logical operation and what happens when that operation cannot be completed.

Putting @Transactional on a method does not answer these questions. It delegates the execution of a transaction to Spring, while the actual consistency requirements remain the application’s responsibility.

Worse, the annotation can make us believe that we have handled consistency when we have only configured one particular mechanism for it.

A database rollback, for example, cannot undo a payment processed by an external provider. The framework cannot infer the correct business response to that situation.

The application must own the decision. The framework should only help implement it.

The same problem applies to retries

Consider another familiar annotation:

@Retryable(maxAttempts = 3)
public void processPayment(Order order) {
    paymentGateway.charge(order);
}

Three attempts. Sounds reasonable.

But should we retry every failure? What if the payment provider processed the charge but the response was lost? Could another attempt charge the customer twice? Is the operation idempotent? Should a timeout be treated differently from a declined payment?

The correct retry policy depends on the operation’s semantics, its failure modes, and the guarantees provided by the external system.

Those are application-level concerns.

A retry annotation can execute a policy, but it cannot determine whether that policy is correct for the business operation. Even when the annotation is configured carefully, the retry mechanism can obscure the actual control flow and make it harder to reason about the application’s behavior.

This does not mean that retry mechanisms should be implemented from scratch. It means that the decision to retry, the conditions under which retries are allowed, and the consequences of repeated execution should be explicit and testable application behavior.

The framework may provide the mechanism. It should not silently become the owner of the policy.

Why do we call these non-functional requirements?

I suspect the terminology contributes to the problem.

We call performance, reliability, consistency, transaction management, and retry behavior non-functional because they do not describe the primary business outcome of an operation.

But this classification can be misleading.

Some concerns that are commonly grouped under non-functional requirements have direct consequences for functional correctness.

A payment processed twice is not merely a reliability issue. An order whose inventory has been reserved but whose payment has failed is not merely a transaction-management issue. A retry that repeats an irreversible operation is not merely an infrastructure issue.

These are failures of application behavior.

Of course, not every non-functional requirement is business logic. HTTP transport, database drivers, memory consumption, and deployment configuration are genuine infrastructure or operational concerns. But we should not use the label non-functional as an excuse to remove important decisions from the application code.

If a decision changes what the application does when something succeeds, fails, or is repeated, it deserves the same scrutiny as any other business rule.

Make the application testable without its framework

The application should be testable using plain Java tests, without starting Spring, a CDI container, or a database just to verify its decisions.

Consider a payment operation that should be retried only when a temporary failure occurs. Instead of delegating the entire policy to a @Retryable annotation, we can express it through a separate, reusable retry operation:

public static <T> Either<RuntimeException, T> retry(
        Supplier<T> operation,
        Class<? extends RuntimeException> retryOn,
        int maxAttempts) {

    RuntimeException lastError =
        new IllegalArgumentException("maxAttempts must be positive");

    for (int attempt = 0; maxAttempts > 0 && attempt < maxAttempts; attempt++) {
        Try<T> result = Try.of(operation::get);

        if (result.isSuccess()) {
            return Either.right(result.get());
        }

        Throwable cause = result.getCause();

        lastError = cause instanceof RuntimeException
            ? (RuntimeException) cause
            : new RuntimeException(cause);

        if (!retryOn.isInstance(lastError)) {
            break;
        }
    }

    return Either.left(lastError);
}

The business operation remains independent of the retry mechanism:

public Either<RuntimeException, PaymentResult> charge(Order order) {
    return retry(
        () -> paymentGateway.charge(order),
        TemporaryFailure.class,
        3
    );
}

Now we can test the retry policy independently, using a plain unit test and a fake payment gateway. We can verify that a temporary failure is retried, that success stops further attempts, and that the final failure is returned.

No Spring context. No proxies. No application server.

The example is deliberately simple; a real implementation must also consider idempotency, timeouts, backoff, and which failures are safe to retry. Those decisions depend on the operation and belong in its policy, not in a generic annotation applied without considering its semantics.

The point is that we should be able to test the application’s decisions independently of the mechanism that executes them.

Testing through the execution mechanism adds complexity on both sides: tests become harder to write and maintain, while the application inherits additional runtime behavior that can introduce overhead, hidden interactions, and bugs.

That complexity has a cost: development time, maintenance effort, and, ultimately, correctness. We should pay that cost only when the mechanism provides real value, not simply because our framework makes it convenient.

The same principle applies to transaction boundaries. We should be able to test which operations must succeed together and how failures are handled, while using integration tests to verify that the real database adapter correctly implements commits and rollbacks.

Does this mean we should eliminate frameworks?

Absolutely not.

An application does not run in a vacuum. It needs an environment, and that environment provides essential capabilities.

We are not going to write our own HTTP server just to receive user requests. We are not going to write a database driver. We do not need to implement dependency injection ourselves when a suitable container already exists.

Using Spring Boot, CDI, an application server, or another runtime is perfectly reasonable. So is using framework-specific adapters to connect the application to databases, message brokers, HTTP endpoints, and external services.

The distinction is where we draw the boundary.

I want the application to depend on abstractions that express the capabilities it needs, while the runtime supplies the implementations.

For example:

  • An HTTP adapter translates incoming requests into application calls.
  • A persistence adapter translates application operations into database queries.
  • A transaction adapter implements the transaction boundaries requested by the application.
  • A retry mechanism executes a retry policy that the application has explicitly defined.

The application should not need to know how an HTTP request is received or how a database connection is managed. But it should know which operations must be consistent, which failures are recoverable, and what should happen when an operation cannot be completed.

This is not about eliminating all framework dependencies from every line of code. It is about keeping framework-specific concerns at the edges, rather than allowing them to define the application’s behavior.

Framework independence is also about avoiding unnecessary complexity

There is another reason to care about this distinction: frameworks can introduce behavior that is not immediately visible in the code.

A method annotated with @Transactional may be intercepted by a proxy. Its behavior can depend on how the object was created, how the method was invoked, whether the invocation crossed the relevant proxy boundary, and how transaction propagation and rollback rules are configured.

Self-invocation, for example, can bypass proxy-based transaction interception in common Spring configurations. A method may look transactional in the source code while its actual execution does not behave as expected.

The issue is not that Spring is defective. These mechanisms have legitimate uses, and the framework documents their constraints.

The issue is that an implicit runtime mechanism introduces another layer of behavior that developers must understand and verify.

Sometimes that layer is justified. Sometimes a small, explicit piece of application code would be easier to reason about, easier to test, and less likely to conceal a mistake.

The more important a decision is to correctness, the less comfortable I am leaving it implicit.

Portability is a consequence, not the main goal

An application whose core behavior can be tested independently of its runtime is generally easier to move to another environment.

Perhaps today we use Spring Boot and tomorrow we need an application server. Perhaps we replace a database, change a message broker, or introduce a different external service.

If our application is tightly coupled to framework-specific annotations and runtime behavior, these changes can affect far more code than they should.

If the application expresses its requirements through ordinary code and clear interfaces, we can often replace the relevant adapters without rewriting the business logic.

But portability is not the primary goal.

I am not suggesting that every application should be designed to support five different frameworks or databases. That can become abstraction for abstraction’s sake.

The primary goal is to make application behavior explicit, understandable, and independently testable. Portability follows naturally from that discipline.

A practical rule

When deciding whether something belongs in the application or in a framework, I ask a simple question:

Can I verify that this behavior is correct using ordinary tests of the application itself, without starting its runtime?

If the answer is no, I investigate why.

Sometimes the behavior genuinely belongs to infrastructure, and an integration test is the appropriate way to verify it.

But sometimes the application has delegated a decision it should own to an annotation, a proxy, a container, or a framework default.

In that case, I try to bring the decision back into explicit application code and leave the framework responsible for providing the underlying mechanism.

This is not a ban on annotations. It is not a demand for hand-written infrastructure. And it is certainly not an argument for implementing everything ourselves.

It is a way of keeping responsibility where it belongs.

Your framework should help your application do its job. It should not quietly decide what that job is.

Choosing a Programming Language Is an Engineering Decision, Not a Matter of Taste

Performance, correctness, deployment, ecosystem, and maintenance: the objective criteria that matter more than personal preference.

Software engineers can spend an extraordinary amount of time debating programming languages. Rust versus Go. Java versus C++. TypeScript versus Elm. Functional programming versus object-oriented programming.

These discussions often revolve around personal preferences, isolated benchmarks, syntax, or the latest industry trends. Yet the most important question is rarely asked:

Which programming language minimizes the total cost and risk of building, deploying, and maintaining this particular system?

A programming language is a tool. Like any engineering tool, its value depends on the problem being solved, the constraints involved, and the people using it.

There are objective criteria for evaluating that value. Understanding them makes language selection a rational engineering decision rather than a matter of taste.

1. Runtime performance: measure the generated program, not the language’s reputation

The claim that C++ is fast, Java is slower, and Python is slow is a convenient oversimplification.

At the lowest level, computation comes down to machine instructions, register usage, memory access, cache locality, branching, and parallel execution. Programming languages are different ways of expressing computations, and their implementations translate those expressions into operations the hardware can execute.

For a given computational problem, different languages can produce machine code with comparable performance. The important distinction is not necessarily the performance they can achieve, but the effort required to achieve it.

Consider Java and C++.

A Java application running on a modern JVM can benefit from just-in-time compilation, method inlining, escape analysis, and other runtime optimizations. With an understanding of how the JIT compiler works, a developer can structure code so that the runtime produces highly optimized machine instructions.

In some workloads, the resulting performance can be comparable to an equivalent C++ implementation.

That does not mean the languages are universally equivalent in performance. Their memory models, runtime overhead, optimization opportunities, and constraints differ. It means that a language’s reputation is a poor substitute for measuring the actual system.

When evaluating performance, consider:

  • The computational workload and its algorithmic complexity.
  • The quality of the compiler, JIT compiler, or interpreter.
  • Memory layout, cache locality, and allocation behavior.
  • Vectorization, concurrency, and hardware acceleration.
  • Latency requirements, throughput, and memory consumption.

Benchmark representative workloads, not artificial examples that have little resemblance to production.

When the language really matters

Some constraints make particular language and runtime choices objectively unsuitable.

A small embedded device with limited RAM may not have room for a garbage collector and its associated runtime. A hard real-time system may not tolerate unpredictable pauses. A GPU kernel may require a specific programming model. A browser application must execute in an environment with defined compatibility constraints.

These are real engineering limitations, not stylistic preferences.

The right question is not which language is fastest in general, but which implementation can meet the system’s performance requirements within its resource constraints.

2. Correctness: how many bugs can you prevent before execution?

Performance gets attention because it is easy to compare in benchmarks. Correctness is often more important and considerably harder to quantify.

A defect discovered during development is generally cheaper to fix than one discovered in production. For small teams, this creates a particular challenge: the people writing the software may also be responsible for testing it, deploying it, supporting it, and fixing production incidents.

A language that catches more classes of mistakes at compile time can reduce the amount of verification work required elsewhere.

This is where languages such as Elm and Haskell become interesting.

Elm: making entire categories of mistakes harder to express

Elm is a statically typed functional language designed for front-end development. Its type system, exhaustive pattern matching, and explicit modeling of application state can make many common mistakes detectable during compilation.

For example, consider an application that represents a user account with several possible states:

  • Loading
  • Loaded successfully
  • Failed to load

A loosely modeled application might represent these states using several independent variables. That allows contradictory combinations: a request can be marked as both successful and failed, or the application can attempt to display data that does not exist.

Elm encourages developers to represent these alternatives explicitly using custom types and to handle them through pattern matching.

The compiler can then identify missing cases when the model changes.

Elm’s compiler also reports errors when code no longer conforms to the declared types. Its compiler is famously helpful when refactoring because changes to data structures and function signatures reveal many affected parts of the application.

This does not eliminate logical errors, incorrect business rules, or every runtime failure. It does make certain classes of mistakes harder to introduce unnoticed.

Haskell: stronger abstractions for expressing invariants

Haskell takes a similar philosophy further, offering algebraic data types, pattern matching, type classes, higher-order functions, and advanced type-system features.

These capabilities allow developers to encode more of a system’s intended behavior in its types.

For example, instead of representing an operation as a function that accepts arbitrary input and may fail in an unspecified way, a developer can model its valid inputs and possible outcomes explicitly.

Depending on the problem, types can express constraints around parsing, validation, state transitions, and error handling. The compiler can then enforce aspects of those constraints throughout the program.

The type system does not prove every business requirement correct by default. Nevertheless, a well-designed type model can prevent entire categories of invalid states and make assumptions visible in the code.

Why this matters for small teams

Imagine a project maintained by one developer or a team of two or three people, without dedicated QA engineers.

Every change carries a verification cost. Tests must be written, executed, interpreted, and maintained. Manual testing consumes time. Regression bugs can go unnoticed because there is nobody else routinely reviewing the system.

A language that shifts some of this verification into compilation can offer a structural advantage.

The benefit is not that testing becomes unnecessary. The benefit is that the compiler becomes another continuously available line of defense.

A useful way to think about it is:

The more correctness properties the language can enforce automatically, the less the team must rely exclusively on human discipline and runtime testing to preserve them.

For a small team, this can be a more valuable advantage than a modest improvement in execution speed.

3. Deployment: can the program run where it needs to run?

A language can be technically excellent and still be the wrong choice if deploying its applications is difficult or incompatible with the target environment.

Deployment constraints are concrete and often decisive.

For a browser application, relevant questions include:

  • Can the application run in the required browsers?
  • What JavaScript output, compatibility, or runtime support is required?
  • How large is the delivered application?
  • Are there restrictions on browser APIs or the execution environment?

For a backend service:

  • Is the language supported by the target hosting platform?
  • Does it require a particular application server or runtime?
  • How easy is it to build, package, deploy, and roll back?
  • Can the application run in the available containers or serverless environment?
  • What operating-system and architecture dependencies exist?

For mobile and embedded applications, hardware support, platform APIs, binary size, memory usage, and toolchain availability can be even more important.

These constraints should be evaluated before selecting a language, not after the application has been built.

A deployment model that works perfectly in a developer’s environment but requires substantial additional infrastructure in production introduces cost and operational risk.

4. Ecosystem maturity: how much infrastructure must you build yourself?

A language’s ecosystem determines how much existing engineering work you can reuse.

Consider the availability and quality of:

  • Libraries for required integrations and protocols.
  • Frameworks and established architectural patterns.
  • Database drivers and migration tools.
  • Testing, debugging, profiling, and observability tools.
  • Security updates and maintained dependencies.
  • Documentation and practical examples.

A mature ecosystem can significantly reduce development time and the amount of custom code that must be maintained.

However, the total number of packages is not a useful metric on its own. A smaller ecosystem may be entirely adequate for a specialized application, while a large ecosystem may still lack a critical integration.

The objective question is whether the language and its ecosystem provide the capabilities the project actually needs, at an acceptable maintenance and security cost.

5. Developer availability: how expensive is it to build and maintain the team?

Hiring and knowledge transfer are real engineering costs.

A language with a large pool of experienced developers is usually easier to staff. A niche language may require more recruitment effort, longer onboarding, or reliance on a small number of specialists.

The implications extend beyond hiring. Consider what happens if the original developer leaves, the project needs urgent support, or a new team must take ownership.

But popularity should not automatically override every other criterion.

For a small, stable application maintained by one experienced developer, a language that substantially improves correctness or productivity may be worth its smaller talent pool.

For a large organization with frequent team changes, broad hiring availability may carry much more weight.

The correct decision depends on the project’s expected lifetime, staffing model, and operational risk.

6. Maintainability: optimize for the lifetime of the system

Writing code is only one part of software development. Reading, modifying, debugging, and extending existing code can consume far more effort over the lifetime of a system.

Maintainability depends on several factors:

  • How clearly the language expresses the domain model.
  • Whether the type system makes invalid states difficult to represent.
  • How safely the code can be refactored.
  • Whether the compiler identifies the consequences of changing interfaces.
  • How easily developers can understand data flow and error handling.
  • Whether the ecosystem provides stable, well-supported abstractions.

A language that allows a developer to write an initial implementation quickly may not minimize the cost of maintaining it for ten years.

Conversely, a language with a steeper learning curve may pay for itself if it consistently reduces debugging and refactoring effort.

This is one reason functional programming and strong static typing deserve consideration even when they are not the dominant choice in a particular market.

The relevant metric is not how quickly someone can write the first version. It is how much effort is required to keep the software correct as requirements evolve.

7. Productivity: measure the whole development process

Productivity is frequently used to justify subjective language preferences. One developer says a language is more productive because its syntax is concise. Another prefers a language because its abstractions feel natural.

Neither statement is sufficient on its own.

A more useful assessment considers the complete development cycle:

  1. How long does it take to implement a feature?
  2. How much code must be written and maintained?
  3. How many defects are introduced?
  4. How difficult are debugging and refactoring?
  5. How much testing and manual verification are necessary?
  6. How expensive is deployment and ongoing operation?

Concise syntax can help, but it does not automatically translate into fewer defects or lower maintenance costs.

Similarly, a strong type system can impose some upfront modeling effort while reducing the cost of subsequent changes.

For a one-person project, these trade-offs can be particularly significant. The developer has limited time and cannot compensate indefinitely for weak tooling or a language model that makes mistakes difficult to detect.

8. A practical framework for choosing a language

Instead of asking which language is best, start by identifying the project’s constraints and assigning priorities to the relevant criteria.

CriterionObjective question
PerformanceDoes it meet measured latency, throughput, and resource requirements?
CorrectnessWhich classes of errors can be detected before runtime?
DeploymentDoes it run reliably in the required target environment?
EcosystemAre the necessary integrations and tools available and maintained?
Team availabilityCan the system be staffed and supported over its lifetime?
MaintainabilityHow expensive are debugging, refactoring, and future changes?
ProductivityWhat is the total cost of implementing and operating the system?
Operational riskCan the team diagnose, deploy, recover, and support the application reliably?

Not every criterion has equal importance for every project.

For a small embedded controller, memory usage and timing guarantees may dominate the decision.

For a browser application maintained by one developer, deployment compatibility and compile-time correctness may be more important than raw execution speed.

For a high-throughput numerical workload, benchmark results and hardware utilization may be decisive.

For an enterprise system expected to survive multiple generations of developers, ecosystem maturity, hiring, and maintainability may outweigh nearly everything else.

The goal is not to assign every language a universal score. It is to identify the constraints that matter, eliminate unsuitable options, and compare the remaining candidates against the same requirements.

9. Where personal preference fits

Personal preference is not entirely irrelevant. Familiarity with a language can reduce onboarding costs, and developers who understand a language deeply are often more productive with it.

But familiarity should be treated as an economic consideration, not as proof that the language is technically superior.

A preference becomes an engineering argument when it can be connected to a measurable outcome: fewer defects, shorter delivery times, easier hiring, simpler deployment, or lower maintenance costs.

Statements such as “I prefer the syntax,” “this language feels cleaner,” or “everyone uses it” may be useful starting points for discussion. They are not sufficient grounds for a major architectural decision.

The same applies to fashionable claims about performance. A benchmark showing that one language wins a particular microbenchmark does not establish that it is the right choice for an application with different workloads and constraints.

Engineering decisions require evidence relevant to the system being built.

Conclusion: choose the tool that minimizes total engineering cost

Programming languages are not interchangeable in every practical situation. Their runtimes, type systems, deployment models, ecosystems, and hardware constraints create meaningful differences.

But those differences should be evaluated in terms of the outcomes they produce.

A language that generates exceptionally fast code may be unsuitable for a memory-constrained embedded device. A language with a smaller ecosystem may be ideal for a specialized application. A strongly typed functional language may be particularly valuable for a small team that needs to minimize the risk of regressions without dedicated QA resources.

There is no universally best programming language. There are languages that are better or worse suited to a specific set of requirements.

The most useful question is therefore not:

Which programming language do I like best?

It is:

Which language gives this team the best combination of performance, correctness, deployment simplicity, and long-term maintainability under the constraints of this project?

That is an engineering decision. And like any good engineering decision, it should be justified by evidence rather than preference.