2020-06-26

Domain Oriented Programming



The software that we write often invokes other software to get parts of the job done. These are known as Services or Dependencies. If Class A is making use of some Class B, then Class A depends on Class B, so Class B is a dependency of Class A. The principle of Dependency Inversion (says that a class should not contain any hard-coded direct calls to specific instances of any of its dependencies. Instead, it should receive these instances as parameters during initialization.

That's all very nice, but passing dependencies around can become quite a complicated business, and in large systems it can become a nightmare.

2020-05-30

On Validation vs. Error Checking

Let me start with a couple of pedantic definitions; stay with me, the beef follows right afterwards.

Conventional wisdom says that validation is different from error checking.

Validation is performed at the boundaries of a system, to check the validity of incoming data, which is at all times presumed to be potentially invalid. When invalid data is detected, validation is supposed to reject it by returning an appropriate result, not throwing an exception. Validation is supposed to be always on, you cannot switch it off on release builds and only have it enabled on debug builds.

Error checking, on the other hand, is performed inside a system, checking against conditions that should never occur, to keep making sure that everything is working as intended. In the event that an error is encountered, the intent is to signal a catastrophic failure (throw an exception) instead of causing some result to be returned. Essentially, the term Error Checking is shorthand for Internal Error Checking.  It can be implemented using assertions, thus being active on the debug build only, and having a net cost of zero on the release build.

So far so good, right?

2020-04-01

Index of GitHub projects

mikenakis-rumination

Making plain old java objects aware of their own mutations.


mikenakis-testana

A command-line utility for running only those tests that actually need to run.
https://blog.michael.gr/2018/04/github-project-mikenakis-testana.html

mikenakis-classdump

A command-line utility for dumping the contents of class files.
https://blog.michael.gr/2018/04/github-project-classdump.html

mikenakis-bytecode

A lightweight framework for manipulating JVM bytecode.
https://blog.michael.gr/2018/04/github-project-bytecode.html

mikenakis-agentclaire

A Java Agent to end all Java Agents.
https://blog.michael.gr/2018/04/github-project-agentclaire.html