Nowadays, JavaScript is all over the place. As the code evolved, testing libraries and strategies like TDD and BDD also did. Indeed, we all agree on the same thing: Code must be tested.
In the past years, a big part of the community shifted towards Functional programming. As a side effect, the paradigm shift brought us a more straightforward way of defining and writing unit tests.
So the thing is …
What is Functional programming?
Functional programming is a programming paradigm — a style of building the structure and elements of computer programs — that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data — wikipedia
Let's take a look at an example of code which will be the system under test:
Pretty simple, right? The function receives a response and a source, we compose the message based on data received on the response, and we return it. Let's test it!
describe('It should show the error message', ()=> { const response = {data: {status: 'fail', title: 'edit'}} const source = { message: 'The post action had '} it('Adds the extra info', ()=> { expect(showResponseMessage(response, status)).toEqual('The post action had fail edit') }) })
I know, the number of code lines increased, at a glance, it just seems like a more sophisticated way of achieving the same thing. But, we increased the number of tests too, enhancing the overall quality assurance.
describe('It should show the error message', ()=> { const source = { message: 'The post action had'} const response = {data: {status: 'fail', title: 'edit'}} const {status, title} = response.data; it('gets the message from source', ()=> { expect(getMessage(source)).toEqual('The post action had') }) it('Adds Title properly', ()=> { let message = getMessage(source); expect(addTitle(title, message)).toEqual('The post action had edit') }) it('Adds Status properly', ()=> { let message = getMessage(source); expect(addStatus(status, message)).toEqual('The post action had fail') }) it('Adds returns the right message', ()=> { expect(showResponseMessage(response, source)).toEqual('The post action had fail edit') }) })
In the first example, if we change the structure of the response and title, the test will fail, but we won't know why the test failed. Did it fail because of a missing response message or a wrong title retrieved as part of the response?
In the second example, we are testing each functionality separately. By assigning each function it's own responsibility, we make the code more maintainable, efficient, and versatile. For more information, check the single responsibility principle.
Let's consider the following scenario, suppose that our business logic changes, and we want to prevent the spaces on title and status. In such a case, we will have to create a function that receives a text and returns the sanitized version. To test that function, we have to create a test that solely asses that requirement; this test will not be related to showResponseMessage, but to space trimming.
That example points out a single case. However, as the logic and size of the application grow, the more relevant this approach to testing will become. When we start working with async calls, with the ability of composition and Higher-Order functions, we can make our "features" readable and our functions real units.
Furthermore, all of our original values are immutable. In the first example, we modified the message variable, now we don't, we still have our original message — And why is that important? Mutation means change, change adds complexity, opens the door for bugs, and sometimes makes things unpredictable.
When our code is predictable, self-explanatory, and easier to track and read, it's much easier to write cleaner tests.
'Indeed, the ratio of time spent reading versus writing is well over 10 to 1. We are constantly reading old code as part of the effort to write a new code. ...[Therefore,] making it easy to read makes it easier to write.' Robert C Martin.
So stay functional for simple testing and happier code reviews :)
Nowadays, JavaScript is all over the place. As the code evolved, testing libraries and strategies like TDD and BDD also did. Indeed, we all agree on the same thing: Code must be tested.
In the past years, a big part of the community shifted towards Functional programming. As a side effect, the paradigm shift brought us a more straightforward way of defining and writing unit tests.
So the thing is …
What is Functional programming?
Functional programming is a programming paradigm — a style of building the structure and elements of computer programs — that treats computation as the evaluation of mathematical functions and avoids changing-state and mutable data — wikipedia
Let's take a look at an example of code which will be the system under test:
Pretty simple, right? The function receives a response and a source, we compose the message based on data received on the response, and we return it. Let's test it!
describe('It should show the error message', ()=> { const response = {data: {status: 'fail', title: 'edit'}} const source = { message: 'The post action had '} it('Adds the extra info', ()=> { expect(showResponseMessage(response, status)).toEqual('The post action had fail edit') }) })
I know, the number of code lines increased, at a glance, it just seems like a more sophisticated way of achieving the same thing. But, we increased the number of tests too, enhancing the overall quality assurance.
describe('It should show the error message', ()=> { const source = { message: 'The post action had'} const response = {data: {status: 'fail', title: 'edit'}} const {status, title} = response.data; it('gets the message from source', ()=> { expect(getMessage(source)).toEqual('The post action had') }) it('Adds Title properly', ()=> { let message = getMessage(source); expect(addTitle(title, message)).toEqual('The post action had edit') }) it('Adds Status properly', ()=> { let message = getMessage(source); expect(addStatus(status, message)).toEqual('The post action had fail') }) it('Adds returns the right message', ()=> { expect(showResponseMessage(response, source)).toEqual('The post action had fail edit') }) })
In the first example, if we change the structure of the response and title, the test will fail, but we won't know why the test failed. Did it fail because of a missing response message or a wrong title retrieved as part of the response?
In the second example, we are testing each functionality separately. By assigning each function it's own responsibility, we make the code more maintainable, efficient, and versatile. For more information, check the single responsibility principle.
Let's consider the following scenario, suppose that our business logic changes, and we want to prevent the spaces on title and status. In such a case, we will have to create a function that receives a text and returns the sanitized version. To test that function, we have to create a test that solely asses that requirement; this test will not be related to showResponseMessage, but to space trimming.
That example points out a single case. However, as the logic and size of the application grow, the more relevant this approach to testing will become. When we start working with async calls, with the ability of composition and Higher-Order functions, we can make our "features" readable and our functions real units.
Furthermore, all of our original values are immutable. In the first example, we modified the message variable, now we don't, we still have our original message — And why is that important? Mutation means change, change adds complexity, opens the door for bugs, and sometimes makes things unpredictable.
When our code is predictable, self-explanatory, and easier to track and read, it's much easier to write cleaner tests.
'Indeed, the ratio of time spent reading versus writing is well over 10 to 1. We are constantly reading old code as part of the effort to write a new code. ...[Therefore,] making it easy to read makes it easier to write.' Robert C Martin.
So stay functional for simple testing and happier code reviews :)
Applying changes across microservices is difficult because business logic is distributed across multiple services, each with its own data, contracts, and responsibilities.
In our experiment at Kaizen Softworks, we tested whether an AI system could safely apply coordinated changes across a microservices architecture using only minimal input.
Short answer: Yes, but only when the AI has enough architectural context.
Why are coordinated changes in microservices so hard?
In distributed systems, a single business change rarely affects just one service.
It often requires:
Updating multiple microservices
Modifying message contracts
Keeping DTOs (Data Transfer Objects) consistent
Respecting domain boundaries defined by Domain-Driven Design (DDD)
Key entities in this system:
Microservice: An independently deployable service responsible for a specific domain
Aggregate (DDD): A cluster of domain objects treated as a single unit
DTO (Data Transfer Object): A structured format used to transfer data between services
Message/Event: A communication mechanism between services
The complexity is not in the code, it’s in the relationships between components.
The experiment: Can AI reason across services with minimal input?
We designed a controlled experiment to test whether an AI model could apply system-wide changes with limited information.
Input given to the AI:
Message definitions (events between services)
DTOs (data contracts)
Tasks the AI had to perform:
Identify affected aggregates
Determine service ownership
Apply coordinated changes across services
Maintain consistency in messages and DTOs
In other words, the AI had to behave like a software architect, not just a code generator.
What was the biggest obstacle?
The biggest challenge was not technical, it was contextual.
Problem: unclear service naming
Instead of descriptive names like:
order-service
billing-service
Our services were named:
john
sally
roger
This removed any semantic clues about responsibility.
Result: The AI could not infer which service owned which domain logic.
The missing piece: aggregate ownership mapping
To solve this, we introduced a simple but powerful structure:
Aggregate → Service mapping
Order → john
Shipment → sally
Invoice → roger
This created a clear relationship between domain concepts and system components.
Once ownership was explicit, the architecture became understandable.
How we used AI to generate architectural context
Instead of building this mapping manually, we used AI to analyze the codebase and extract:
Where each aggregate was defined
Which microservice implemented it
The relationship between domain and infrastructure
The result was a machine-readable architecture map.
In practice, we used AI to generate the context that AI itself needed.
Results: Can AI safely apply distributed changes?
With the architecture map in place, the AI was able to:
Trace message flows across services
Identify affected aggregates
Locate the correct microservices
Apply coordinated updates
Maintain consistency between DTOs and messages
While not perfect, the system worked reliably as a proof of concept.
What is the real limitation of AI in microservices?
The main limitation of AI is not code generation, it’s architectural understanding.
Without knowing:
Which components exist
How they relate
Who owns what
AI cannot safely modify a distributed system.
AI performance depends more on context quality than model capability.
When can AI safely modify microservices?
AI works well when:
Aggregate ownership is clearly defined
Message contracts are explicit
Architecture is structured and consistent
AI struggles when:
Naming is ambiguous
Relationships are implicit
Context is incomplete
Simple rule: If the architecture is clear, AI can reason. If not, it guesses.
Final thoughts
This experiment revealed something important:
AI doesn’t fail because it can’t write code. It fails because it can’t see the system.
As teams move toward AI-assisted development, the focus will likely shift from:
Writing better code to Designing better systems for machines to understand
At Kaizen Softworks, we see this as a foundational shift.
Because when AI can understand architecture, it doesn’t just generate code, it helps evolve systems.
There's a myth that in flat organizations, everyone decides on everything.
That's not how it works. At least not at Kaizen.
When people hear "no managers," they often picture one of two extremes: either total chaos where nobody is accountable, or endless meetings where 80 people vote on which coffee to buy. The reality is neither.
Not everyone decides on everything. Not everyone votes. What we do have is a clear set of decision-making methods that we choose based on context.
It depends on who's affected and how deep the impact goes
Before choosing how to decide, we ask ourselves a few questions:
Who is affected? A decision that only impacts one team doesn't need the whole company involved. A decision that affects everyone's daily work does.
How deep is the impact? Changing the office furniture is wide but shallow. Changing the salary model is deep and lasting.
Is it reversible? If we can easily undo it, we can move fast and just inform. If it's hard to reverse, we slow down and include more people.
How urgent is it? And here we're careful to distinguish real urgency from anxiety, the pressure to decide quickly because someone already has "the answer" in mind.
These dimensions help us pick the right method. Not every decision deserves the same process.
Our decision-making toolkit
Over the years, we've landed on a few methods that we use depending on the situation:
1. Role-based decisions
Some decisions belong to a specific role. If someone owns a responsibility, say, office logistics or hiring for a team, they decide within that domain. No committee needed. The key is that roles are transparent: everyone knows who owns what, and the scope of each role's authority is clear.
2. Advice Process
When a decision doesn't clearly belong to one role, or when it crosses boundaries, we use the advice process. Here's how it works:
Someone takes the initiative. They identify the problem and own the process.
They gather input from people who are affected and people with expertise.
They seek advice, real conversations, not rubber-stamping.
They make the decision and communicate it, including what advice they incorporated and what they didn't (and why).
The decision-maker is not a committee. It's one person (or a small group) who takes responsibility. But they don't decide in isolation, they bring in the perspectives that matter.
We sometimes call this "Team Advice" when a working group forms around an issue that doesn't naturally fall into anyone's area, and "Area Advice" when a team opens up a topic that exceeds their own scope.
3. Consent (not consensus)
Consent is not "everyone agrees." Consent means "no one has a strong enough objection to block this." We do use a poll, but not to count votes — we use a 1-to-5 scale to measure the level of agreement and surface objections, not to let the majority rule.
We use it in two flavors:
High-participation consent: For decisions with deep, company-wide impact. This is our most expensive and slowest method, which is exactly why we reserve it for high-impact decisions that affect many people. The Board sets the boundaries, for example, when we moved offices, they defined the monthly budget. Then a working group produced proposals, collected feedback, evolved them, and the whole company expressed their position for the final decision. Silence is not approval; we explicitly ask people to weigh in, even if it's just "I have no objection."
Lightweight consent: For decisions that are broad but not deep. Participation is optional, anyone who's interested can jump in. We share the proposal, open a window for objections, and if nobody opposes, we move forward. This gives us speed without sacrificing transparency. If nobody engages, that's a signal too, maybe the proposal doesn't add enough value, or we're using the wrong channel.
4. Inform, don't fake-consult
Not everything needs participation. When a decision has already been made through a legitimate process, the right move is to inform, not to fake-consult. One of the fastest ways to kill self-management is to ask for feedback and then ignore it. If you're not going to change course based on input, don't ask for it, just be transparent about the decision and the reasons behind it.
What we explicitly avoid
Decision by Voting. In a company context, majority rule creates losers. And losers become detractors, often generating more resistance than an autocratic decision would have. Instead of voting, we prefer to evolve a proposal through feedback until it's "good enough for now," and then introduce a review point to adjust later. If voting happens at all, it's the cherry on top, not the main course.
The "surprise" approach. Working behind closed doors and then unveiling a finished decision is a recipe for frustration. Adults don't need surprises. Adults need to feel like they're part of the process. The complaints that follow a surprise aren't about the decision itself, they're about not being included.
Why we work this way
We didn't adopt these methods because they're trendy. We adopted them because they solve real problems:
Better decisions. When you include affected people, you get information you wouldn't have had otherwise. Ideas emerge that no single person would have come up with alone.
Less resistance. A person who feels heard is far less likely to resist a decision, even one they wouldn't have made themselves.
Faster execution. It sounds counterintuitive, but participative decisions often execute faster because people already understand and support them. The time you "save" by deciding alone, you spend later managing pushback.
Distributed authority. When people can make decisions within their domain without escalating everything to a founder, the organization scales. The bottleneck disappears.
Resilience. If a shared decision fails, the group adjusts together. If a top-down decision fails, the blame falls on one person and the chances of proactive correction drop.
The real principle behind all of this
Transparency is the foundation. Every method we use, from role-based decisions to high-participation consent, works because information flows openly. People know what's being decided, who's deciding it, and how they can participate.
Horizontal doesn't mean structureless. It means fewer hierarchical levels, clearer roles, and intentional decision-making processes that match the weight of each decision.
Not everyone decides on everything. But everyone knows how things get decided.