C++’s template system is powerful and robust enough that template metaprogramming is Turing complete. Given that kind of power, it’s no surprise that pretty much every other object-oriented language eschews templates for code generation.

Java, for example, uses generics- essentially templates without the metaprogramming. What we still keep is compile-time type-safety, and all the benefits of generic programming, but without the complexity of compile-time code generation.

Thierry L inherited a Java application, and the original developer seems to miss that degree of complexity.

public abstract class CentralValidationDistributionAssemblingService<
        DC extends DistributionChannel,
        DU extends DistributionUnit<DC>,
        AC extends AssemblingContext,
        EAC extends AC,
        A extends Assembly<DC>,
        AAR extends AbstractAssemblingResult<DC>,
        AARB extends AbstractAssemblingResultBuilder<DC, AAR>
        >
        implements DistributionAssemblingService<DC, AC, DU, AAR>
{
    //…
}

The best part about this is that the type abbreviations are an onomatopoeia of the choking noises I made when I saw this code:

"DC… DU?… AC-EAC! A-AAR-AARB!"

[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!