That said, there are a lot of "programming" books that are more technology-independent and contain more "timeless" knowledge about the art and craft of programming (and more fundamentally, computer science). If you want to make sure that your purchases stand the test of time, look for those. You can find a lot of them by searching sites like HN, Reddit, and Stack Overflow for lists of the best computer science and software engineering books. A few examples that tend to show up on these lists:
- Bentley, "Programming Pearls"
- Kernighan and Pike, "The Practice of Programming"
- McConnell, "Code Complete"
- Brooks, "The Mythical Man-Month"
- Abelson and Sussman, "Structure and Interpretation of Computer Programs"
- Gamma et al., "Design Patterns"
- Fowler, "Refactoring"
- Kernighan and Ritchie, "The C Programming Language"
just to list a few off the top of my head.