This is part of PEP 20 – The Zen of Python.

Think on a good mystery novel or show. With the murderer revealed the line of evidence must be clear. Any detail is pulled out only during the last show-down makes poor whodunnit. Only those things the audience knows about can be implicit.

The same goes for software. Explicit does not mean that the logic is obfuscated with lots of scaffolding. It does mean that when the code references something, a reader of said code can follow that something back to source and/or documentation.

This is why I am not comfortable with dependency injection. I am reading some code that all of a sudden refers to an instance of an object that has not been defined or instantiated anywhere I can find.

DRY is a fine principle. I continually refactor my code so that I do not have the same algorithms in more than one place. But, I am happy to explicitly check authorisation at the start of each servlet where I can see it. I do not consider this scaffolding or breaking the DRY principles – I am just explicitly telling the servlet what I expect.

About these ads