DEV Community

Mian Usman Khalid
Mian Usman Khalid

Posted on

Deterministic Software + AI: Why the Best Products Need Both

The Builder’s Letter — Edition 9

Deterministic Software + AI: Why the Best Products Need Both

Artificial Intelligence is changing the way we build software.

Applications can now understand natural language, interpret user requests, generate content, analyze information, and perform tasks that previously required significant manual effort.

This creates exciting opportunities for software engineers and product builders.

But there is a question we should ask before integrating AI into every part of an application:

Should every software decision be handled by AI?

My answer is no.

AI is powerful, but not every problem requires intelligence, interpretation, or probabilistic reasoning.

Some problems require something much simpler: predictable execution.

A financial calculation should produce the correct result every time. A permission check should follow clearly defined rules. A database transaction should maintain data integrity. A payment operation should not execute twice because an AI agent misunderstood a request.

These responsibilities belong to deterministic software.

The real opportunity is not choosing between traditional software and AI.

It is understanding how to combine them.

1. What Is Deterministic Software?

Deterministic software produces the same output when given the same input and operating under the same conditions.

Consider a simple financial calculation:

A customer has an outstanding balance of PKR 20,000 and makes a payment of PKR 5,000.

The remaining balance is:

PKR 20,000 − PKR 5,000 = PKR 15,000.

This is not a task that requires an AI model.

It requires a well-defined calculation implemented through reliable application logic.

Other examples include:

  • Calculating invoice totals.
  • Applying tax rules.
  • Validating transaction amounts.
  • Checking user permissions.
  • Updating inventory quantities.
  • Enforcing business rules.
  • Managing database transactions.
  • Generating account balances.

These operations should be predictable, testable, and consistent.

In production software, predictable behavior is not a limitation.

It is a strength.

2. What Makes AI Different?

AI models operate differently from traditional application logic.

An AI model can interpret multiple ways of expressing the same request.

For example, a user might say:

  • "Show my expenses for this month."
  • "How much have I spent this month?"
  • "Give me my monthly spending summary."
  • "What did I spend money on recently?"

A traditional application may require predefined filters, buttons, or commands.

An AI-powered interface can interpret these different expressions as a similar user intention.

AI is particularly useful for:

  • Understanding natural language.
  • Interpreting ambiguous requests.
  • Extracting information from documents.
  • Classifying unstructured content.
  • Generating explanations.
  • Identifying patterns.
  • Coordinating multi-step workflows.

However, AI responses are probabilistic.

The same request may not always produce exactly the same wording or interpretation. Models can misunderstand instructions, omit context, or produce unsupported information.

That is why AI should not automatically control every critical operation in an application.

3. The Biggest Mistake: Replacing Business Logic With AI

One common mistake in AI-powered product development is trying to move existing application logic into prompts.

Imagine a financial application where the AI is responsible for calculating customer balances.

A user asks:

"How much does Ahmed owe me?"

The AI receives a collection of transactions and attempts to calculate the outstanding amount.

This may work in a simple demonstration.

But production systems have additional complexities:

  • Partial payments.
  • Reversed transactions.
  • Multiple transactions on the same date.
  • Duplicate records.
  • Cancelled entries.
  • Adjustments.
  • Different transaction types.
  • Historical balance calculations.

A prompt cannot replace a properly designed financial calculation engine.

A better architecture is:

  1. AI understands that the user wants Ahmed's outstanding balance.
  2. The application identifies the correct customer.
  3. The backend retrieves the relevant records.
  4. Deterministic business logic calculates the balance.
  5. The application returns the verified result.
  6. AI explains the result in natural language.

This division of responsibilities makes the system more reliable.

Do not ask AI to perform a task that ordinary software can perform more accurately and consistently.

4. Understanding the Right Division of Responsibilities

The most effective AI-powered applications assign responsibilities according to the strengths of each technology.

Responsibility Best suited approach
Understanding user intent AI
Natural-language interpretation AI
Document information extraction AI with validation
Financial calculations Deterministic logic
Authentication Traditional security systems
Authorization Deterministic permission rules
Database transactions Application/backend logic
Business rule enforcement Deterministic logic
Generating explanations AI
Preparing recommendations AI
Executing sensitive operations Controlled application workflows

This is not a rule that AI can never participate in critical workflows.

AI can help coordinate them.

But the application must enforce the rules and control execution.

The goal is to use the right technology for the right responsibility.

5. A Practical Architecture: AI as an Intelligent Layer

Consider a business application that includes customer management, expenses, inventory, and financial reporting.

A well-designed architecture could contain the following layers.

1. User Interface Layer

The user interacts through a mobile application, web dashboard, chat interface, or voice input.

2. AI Interpretation Layer

The AI understands the request and converts it into a structured intention.

For example:

"Show me all customers with outstanding balances above PKR 10,000."

The AI identifies the operation, threshold, and requested information.

3. Authentication and Authorization Layer

The application verifies the user's identity and permissions.

4. Business Logic Layer

The backend validates the request, applies the appropriate business rules, and performs calculations.

5. Data Layer

The database stores authoritative business records and maintains their relationships and integrity.

6. Response Layer

The application returns verified information, and AI can convert the result into a clear explanation.

A simplified workflow:

User → AI Interpretation → Permission Validation → Business Logic → Database → Verified Results → AI Explanation → User

Notice something important.

AI does not replace the existing application architecture.

It works alongside it.

This allows product teams to introduce intelligent capabilities without rebuilding every part of their software.

6. Why This Architecture Matters for Financial and Business Applications

Let's consider three practical examples.

Example A: Customer Outstanding Balance

User request:

"Which customers owe me more than PKR 20,000?"

AI understands the request and identifies the threshold.

The application retrieves the relevant customer records and calculates outstanding balances using its financial rules.

The results are filtered and returned.

AI then explains the findings.

The model does not independently calculate the balances or modify financial records.

Example B: Inventory Management

User request:

"Which products are running low on stock?"

AI understands the user's question.

The application checks current inventory quantities against predefined minimum-stock levels.

It identifies products that need attention.

AI can then summarize the results and suggest possible next steps.

The stock quantities and threshold comparisons remain controlled by deterministic application logic.

Example C: Recording an Expense

User request:

"Record an office expense of PKR 3,500 for stationery."

AI extracts the information:

  • Type: Expense.
  • Amount: PKR 3,500.
  • Category: Office Supplies.
  • Description: Stationery.

The application validates the extracted information.

If required information is missing, the user is asked to provide it.

After the appropriate confirmation, the application creates the transaction through its normal business workflow.

AI makes data entry easier.

The application remains responsible for saving accurate records.

7. The Importance of Testing AI and Traditional Software Differently

Traditional software and AI-powered functionality require different testing strategies.

For deterministic application logic, developers can write tests with precise expected results.

For example:

Given:

  • Opening balance: PKR 20,000.
  • Payment received: PKR 5,000.

Expected outstanding balance:

PKR 15,000.

The result should remain consistent.

AI functionality requires additional evaluation.

For example, when users express the same intention in different ways, does the system identify the correct operation?

Does it extract the correct amount?

Does it ask for clarification when a customer is ambiguous?

Does it avoid making unsupported claims?

Does it select only tools that the user is authorized to access?

AI testing should therefore include:

  • Different ways of expressing the same request.
  • Ambiguous instructions.
  • Missing information.
  • Incorrect or conflicting information.
  • Unexpected user inputs.
  • Unauthorized operations.
  • Model failures and service timeouts.
  • Attempts to trigger duplicate operations.

A reliable AI product requires both conventional software testing and systematic evaluation of model behavior.

8. Security: Never Let AI Become the Authority

Another important consideration is security.

An AI model should not be treated as an authorization mechanism.

Suppose a user asks:

"Show me all financial records belonging to other businesses."

The model may understand the request perfectly.

But understanding a request does not mean the user has permission to perform it.

Authorization must be enforced by the application and backend.

Similarly, an AI agent should not receive unrestricted access to every database table or business operation.

A safer design provides limited tools with clearly defined permissions.

For example:

  • Read permitted customer records.
  • Retrieve authorized financial summaries.
  • Prepare a draft transaction.
  • Request approval for a sensitive operation.

The application should validate every operation independently of what the model says.

AI can recommend an action, but it must never grant itself permission to perform that action.

9. Building Products That Remain Useful Without AI

There is another product-design principle worth discussing.

An application should not become unusable simply because its AI service is unavailable.

Imagine a business owner trying to record a transaction when an AI provider is experiencing downtime.

If the entire application depends on AI, even a basic operation may become impossible.

That is a poor architectural decision.

A strong product should preserve its essential functionality through traditional software.

For example:

  • Users can still add transactions through standard forms.
  • Financial calculations continue working.
  • Customer records remain accessible.
  • Reports can still be generated.
  • Authentication and authorization remain operational.
  • Database operations continue through normal application services.

AI should improve the experience, not become a single point of failure for the entire product.

This is especially important for applications serving small businesses where daily operations cannot stop because an external AI service is unavailable.

10. A Practical Development Strategy for AI-Powered Products

For software teams building AI-enabled applications, I recommend a simple development approach.

Step 1: Build the core application first.

Establish reliable databases, business rules, authentication, authorization, and essential workflows.

Step 2: Identify genuine user problems.

Find tasks where users spend unnecessary time searching, entering information, or interpreting reports.

Step 3: Introduce AI at the interface level.

Start with natural-language search, document extraction, and conversational assistance.

Step 4: Connect AI to controlled application services.

Expose specific APIs and tools rather than unrestricted database access.

Step 5: Keep critical operations deterministic.

Financial calculations, data validation, permission checks, and transaction execution should remain controlled by trusted application logic.

Step 6: Add human approval where necessary.

Require confirmation for actions that can affect financial records, customer communication, or business operations.

Step 7: Monitor and improve.

Measure reliability, accuracy, response time, cost, and user feedback.

This approach helps teams build useful AI features without sacrificing the engineering foundations of the product.

11. The Future Belongs to Hybrid Software

I believe the next generation of successful software products will not be entirely AI-driven or entirely traditional.

They will be hybrid systems.

Traditional software will continue providing structure, consistency, security, and predictable execution.

AI will provide natural-language interaction, interpretation, adaptability, and intelligent assistance.

Human users will retain control over important decisions.

This combination can make applications easier to use without making them harder to trust.

For software companies, this is also a practical business opportunity.

Instead of rebuilding every product around AI, teams can identify where intelligence creates real value and integrate it into existing workflows.

That is a more sustainable way to build AI-powered products.


Final Thoughts

AI is an important development in software engineering, but it does not make traditional engineering principles irrelevant.

We still need clean architecture, reliable databases, secure APIs, validation, testing, and well-defined business rules.

In fact, as AI becomes more integrated into applications, these foundations become even more important.

The best products will not be those that use AI for everything.

They will be those that understand where AI adds value and where deterministic software must remain in control.

AI brings intelligence. Deterministic software brings reliability. Together, they create products people can trust.

As product builders, our responsibility is not simply to make software more intelligent.

It is to make software more useful, dependable, and accessible in the real world.


What's Next?

In Edition 10 of The Builder’s Letter, we will bring together the ideas explored throughout this series and discuss:

"Building HisabDo: Turning Practical Software Engineering and AI Into a Real-World Product."

We will explore the product-building journey, the engineering decisions behind a real business application, and the lessons involved in moving from an idea to software that solves everyday problems.


Mian Usman Khalid

Founder & CEO, XICTEK Systems

The Builder’s Letter — Building practical technology for real-world problems.

Top comments (0)