Posts

Showing posts from October, 2017

Why is writing clean code so hard?

Image
"The business logic is too complicated to simplify the code."   Could there be anything more frustrating to hear? Why do so many of us truly believe that? Sure, some code gets to that point, but its not because its solving the  Vaught conjecture , but because some basic code organization tricks weren't followed. So what's the deal? I follow these few steps to help me simplify my code. Step 1- PLAN! If I had eight hours to chop down a tree, I'd spend six hours sharpening my ax. Basically, write a flow diagram... pretend like you're explaining the flow to a child; they will keep asking: "Then what happens? Then what happens..." over and over until you give them the pieces to solve the puzzle. This should be your process boxes in your flow.  Now, each of those boxes need to be a method your main public method will call them in the same way your diagram presents them. Step 2 - Organize your parameters! I'm not going to go into