Design, develop, and test software systems using the MIM (Module - Infrastructure - Module) architecture and foundational modular design principles.
100
Quality
100%
Does it follow best practices?
Impact
100%
1.25xAverage score across 5 eval scenarios
MIM organizes code around business processes rather than technical layers, splitting logic into Business and Infrastructure modules.
For complex logic, a module is split into two parts:
IRepository, IExternalService).MIM favors Sociable Unit Tests over solitary tests with heavy mocking.
InMemoryRepository) instead of mocking frameworks. Fakes are more reliable, easier to maintain, and lead to less brittle tests.jest.fn().mockRejectedValue(). Instead, add a shouldFail flag or a specific error response to your fake class.class FakeIoTGateway implements IIoTGateway {
public shouldFail = false;
async send(version: string, deviceId: string) {
if (this.shouldFail) throw new Error("Connection failed");
// ... success logic
}
}
test("should handle gateway failure", async () => {
const gateway = new FakeIoTGateway();
gateway.shouldFail = true; // Configure fake to fail
const service = new FirmwareDispatcher(new FakeFirmwareRepo(), gateway);
await expect(service.dispatch("v1", "d1")).rejects.toThrow("Connection failed");
});FirmwareDispatcher).dependency-cruiser or manual inspection of import statements to confirm the unidirectional dependency.// FirmwareDispatcher/BM/FirmwareDispatcher.spec.ts
import { FirmwareDispatcher } from "./FirmwareDispatcher";
import { FakeFirmwareRepo } from "./fakes/FakeFirmwareRepo";
import { FakeIoTGateway } from "./fakes/FakeIoTGateway";
test("should dispatch firmware update correctly", async () => {
const repo = new FakeFirmwareRepo();
const gateway = new FakeIoTGateway();
const service = new FirmwareDispatcher(repo, gateway);
await service.dispatch("v1.2.3", "device-456");
const dispatched = await gateway.getDispatchedForDevice("device-456");
expect(dispatched).toBe("v1.2.3");
});// BM (Business-Module)
export interface IAlarms {
raise(details: AlarmDetails): Promise<void>;
}
// IM (Infrastructure-Module)
export class PagerDutyAlarms implements IAlarms {
async raise(details: AlarmDetails) {
// Technical implementation for PagerDuty...
}
}Install with Tessl CLI
npx tessl i jpc0/mim-architecture@0.1.2