Assaf Naor shares his advice to young mathematicians. Assaf Naor is an Israeli American and Czech mathematician, computer scientist, and a professor of mathematics at Princeton University.
Young mathematicians in this context can mean people who are new in this field. If you are middle aged but still young or new in this field then it will apply to you.
In the video he specifically said to avoid specializing as long as possible. Then he said it's important to specialize to spend time with hard problem to finish them cause it could take 20 years. I think this could mean as far as your career goes. If someone is older and beginning studying math maybe this advise still applied to them. Eventually they'll probably need to specialize. Say they manage to solve a significant problem in analysis. Then that might be a good time to specialize in analysis.