Simple foreign Android codebase hands on guide (Part 1)

So you just joined a team, or you are working on a part of code that you forgot the file/class names and you want to do a new feature or fix some bugs and not sure where to start. The codebase is huge (millions lines of code) have no idea where to start. This is a good flow that I usually follows and tells my mentees to do:

Working on a bug: 

Android Example:  I clicked on something on the UI but it didn't work. I expect a UI change.

1. Look for state changes: is this a reproducible bug?  Is there any changes in the UI that you can identify such as text or color? Is it a reaction of user action such as click or touch? Or is it a model change or device state change?    

Identify the state changes and find where those state changes occur. This will nail you into a specific place: click/touch listeners; model setters; or behavior receivers.

Android Example: Look for the string that you clicked on; that will give you a clue to the class or layout xml file. Now find the best places to put break points.

2. Did you click on the right item? Is the right click listeners getting triggered?

Android Example: Look for where the listeners are assigned and put a breakpoint on them. See if they are triggered.  Is your listener set correctly? If they are not, you may be looking at the wrong place: either the wrong click listener is triggered or the wrong view is getting the callback, or you have overridden some of the expected responders.  -- Fix the layout / UI responder/listener may fix your problem.

3. Now your trigger is happening correctly. Then the action it triggered: is it getting processed properly? If you are still having problem, you will trace how the action is handled or if the response from finishing handling it is done properly, but at this point, you have already found the entry points and reset should follow general debugging methodologies. 

Follow this flow will help you fix most of the bugs you find on a codebase that you are not used to with very high efficiency. :)