Yes, in the past I've been both a contractor myself and a contracting customer. And while I have seen newly built code bases thrown out for various reasons, from what I've seen that's not very common. AFAIK most of the code that I've ever written is still out there and working, unless maybe it died a natural death - company closed, got bought out, changed technologies, or what have you.
At my last gig as an independent contractor I did a lot of work on a project that mostly revolved around one of their largest customers. But then the employee who I was working with the most on this took early retirement due to medical reasons, which caused a change of direction somewhat because the employee who took over that job wanted to do things a bit differently. Then their big customer went out of business, which had a rather dramatic effect on the overall project. But as far as I know the code and such that I worked on is still in active use, it's just not nearly as critical to the business now as it used to be.
Before that I worked at a local mega-corporation, and there was one project there which I worked with on and off for ten years. But then one day, due to an act of legislative fiat, its reason for being just up and disappeared, so almost overnight all of the software and hardware that was used to make it work just went away.
But that same place suffered a bit from what you describe, in that it wasn't too unusual for them to spend money on software that didn't actually work, so it was ultimately abandoned. In fact, I had a running joke with them: "Gee folks, if I'd known that you were willing to settle for software that didn't actually work and that you were going to just throw out anyway, I would have only charged you half of what you paid those other folks to develop it!"
At my last gig as an independent contractor I did a lot of work on a project that mostly revolved around one of their largest customers. But then the employee who I was working with the most on this took early retirement due to medical reasons, which caused a change of direction somewhat because the employee who took over that job wanted to do things a bit differently. Then their big customer went out of business, which had a rather dramatic effect on the overall project. But as far as I know the code and such that I worked on is still in active use, it's just not nearly as critical to the business now as it used to be.
Before that I worked at a local mega-corporation, and there was one project there which I worked with on and off for ten years. But then one day, due to an act of legislative fiat, its reason for being just up and disappeared, so almost overnight all of the software and hardware that was used to make it work just went away.
But that same place suffered a bit from what you describe, in that it wasn't too unusual for them to spend money on software that didn't actually work, so it was ultimately abandoned. In fact, I had a running joke with them: "Gee folks, if I'd known that you were willing to settle for software that didn't actually work and that you were going to just throw out anyway, I would have only charged you half of what you paid those other folks to develop it!"