40 is old for a software developer. Someone who is 40 today entered college just as web browsers were being invented. You could not just connect the dots on library calls to put together an application then. Now you can.
I have a strong sense of wanting to know how things work that comes from having built a lot of software in the 80's and 90's, when you had to know the internals to make progress. That is downright counterproductive in web development now. By the time you learn enough to understand how a library works, the developer who just learned enough to use it already shipped their code. That's the sort of disconnect between age ranges at work now.
Yeah, that slapdash mentality is a large part of what I have to manage, so we don't experience continual disaster. I didn't say I was a software developer any more. I ride herd over business analysts, systems analysts, and the menagerie of IT who do the programming.
Fortunately, I have a long technical history, and even though I got my degree about 8 years before the first browsers, I picked up web programming just like I did every other model, from mainframe to minicomputer to PC, to web services. It's so much easier to manage my folks when they realize they can't bullshit me.