I have a java class with a thousand line method of if/else logic like this:
if (userType == \"admin\") {
if (age > 12) {
if (location == \"
The first thing I would do with this code is create the types Admin and Student, both of which inherit from the base type User. These classes should have a doStuff() method where you hide the rest of this logic.
As a rule of thumb, any time you catch yourself switching on type, you can use polymorphism instead.