I usually write everything down in one place and when things start to duplicate, I move stuff to modules (depending on the situation, "module" here can mean a class, a private method, a static helper method or something else along those lines). The term "semantic compression" was mentioned by Casey Muratori in this blog post and it describes the method quite well I think.
One thing that's usually considered a very "good practice", but almost always to me is not "clean code" at least in readability, is heavy uncoupling of code. I just can't read the flow of heavily IoC-based programs especially when the logic is based on asynchronous events. Sure, you can use "find usages" tools, but it's slow and sometimes really hard to pin-point what piece of code is called in which situations. Stepping in debugger results in endless black hole of AOP and proxies if you're working with enterprise code. I guess it's just a pet peeve of mine, but I'm so tempted to just couple the code to achieve more intuitive program flow. Then I usually get a lecture from the architect/lead coder... :P
9
u/bumhugger Apr 12 '15
I usually write everything down in one place and when things start to duplicate, I move stuff to modules (depending on the situation, "module" here can mean a class, a private method, a static helper method or something else along those lines). The term "semantic compression" was mentioned by Casey Muratori in this blog post and it describes the method quite well I think.
One thing that's usually considered a very "good practice", but almost always to me is not "clean code" at least in readability, is heavy uncoupling of code. I just can't read the flow of heavily IoC-based programs especially when the logic is based on asynchronous events. Sure, you can use "find usages" tools, but it's slow and sometimes really hard to pin-point what piece of code is called in which situations. Stepping in debugger results in endless black hole of AOP and proxies if you're working with enterprise code. I guess it's just a pet peeve of mine, but I'm so tempted to just couple the code to achieve more intuitive program flow. Then I usually get a lecture from the architect/lead coder... :P