Simplifying Complex If statement
Where ever I go, what ever project I end up, no matter how simple the problem. I almost always end up having to deal with complex nested if statement. These statements seem logical at the time, but if left unchecked, grow into this special kind of monster which no one can decipher.... not even the guy who wrote it! A project I worked on recently was revolved around a booking engine. This engine contained the business logic which dictated how the a booking was processed, which state it would move to, what validation had to fire when, etc etc. It was split into several pages, all working on the same object (a booking) but a slightly different aspect of the booking. (pricing, accounts etc) I decided that it would be a good idea to run all the different aspects of the booking through the same method, thus encapsulating the logic of a booking, and hence having 1 place to maintain this logic. It sounded nice at the time, however, over the cource of the 6 - 12 months of developement with 5-6 ...