re: Why Java Interfaces Are Terrible VIEW POST


Go has a structural type system in the sense that interfaces are just bags of methods. So if you have a small bag as input then you can always just substitute a bigger bag that contains the smaller bag and the type system won't care.

Java has a nominal type system and the same approach won't work. Incidentally Typescript has a structural type system and what you're trying to do here would work just fine.

The only way you can make this work in Java is make a class that implements your interface and wraps the actual dynamo DB implementation. In other words, you'll need to use an adapter class.

code of conduct - report abuse