Notes on software and the ideas behind it

Find the meaning
behind the code.

I’m Fred Yang. I write about software—how it works, why it behaves the way it does, and the ideas that make code easier to reason about.

Open the notebook

Working notes / 2026

Recently mapped

Architecture, reactivity, and the hidden relationships that shape frontend systems.

Unit Test

Create a stub with

A stub can also be created using Mocking frameworks. Semantically speaking, a stub is a simulated object, just like a mock object, that will support our test so that we can test other things....
Follow the thread
Unit Test

Strict Mork vs Non-strict mork

A strict Mock Object will only allow calling methods on it that were explicitly set via Expectations. Any call that is made which either differs by the parameter values defined, or by the method...
Follow the thread
Unit Test

An Example of Mock

[Test] Public void Analyze_TooShortFileName_ErrorLoggedToService() { MockRepository mocks = new MockRepository(); IWebService simulatedService = mocks.CreateMock(); //pre-arrange setting using(mocks.Record()) { simulatedService.LogError("file name was too short "); } //play LogAnalyzer log = new LogAnalyzer(simulatedService); string tooShortFileName="abc.ext"; log.Analyze(tooShortFileName);...
Follow the thread
Unit Test

The difference between mocks and stubs

Stubs can’t fail tests. Mocks can do (or they’d be called Stubs). Stubs simply replace an object so that we can test the object under test without problems. The easiest way to tell we...
Follow the thread
Unit Test

Unit Test Best practices

Arrange test in your solution It is common pratice to have a test class per tested class, a test rpoject per tested project and at lest one test method per tested method. Naming tests:...
Follow the thread