How to deal with nested conditionals (Part 2)

In my previous post, I mentioned about Decomposing Conditional and Consolidate Conditional Expression for nested conditionals. The problem was not only the nested conditions but also duplicated code fragments and lots of null object controls.  In this post, we will cover Consolidate Duplicate Conditional Fragments and Testing Interface to tackle the above mentioned problems. Consolidate Duplicate Conditional Fragments […]

How to deal with nested conditionals (Part 1)

In my current project, there are 1000s of lines of code (LOC), some of which date back to 10 years ago. An important part of my day-to-day job is try to understand and debug functions just like the following example (Listing 1). I omitted the boolean expressions and the code in branches but it is still […]