It helps to understand the mechanism your eyes use to focus. For eyes with normal vision, they are at their most relaxed when you are looking far away and your lens is at infinity focus. When you look at something close up, a muscle pulls on your lens to shift the focus point closer. (Additionally, as you get older, your lens gets harder, so it takes more pull to get it to focus closer , and you may need reading glasses once you can no longer focus as close up.) If you do close work all day, that muscle will be pulling all day, hence the recommendation to look at something far away every once in a while to give it the opportunity to relax.
What I did was to get a pair of computer glasses. I measured how far away I usually keep my monitors, and I took that information to my optometrist. She put the eye chart at that distance and we went through all the questions (is A better, or B?) to figure out the prescription. Now, when I'm at the computer, my eyes are at the same relaxed focus that they would normally be at for faraway things, and the computer glasses are providing the focus adjustment for close up.
I learned one other thing as well. If you have progressive lenses, only the small "intermediate" zone in the middle of the lens is really good for computer use. The top "far" zone makes your eyes work hard to focus close up, and the bottom "close" zone is generally focused too close for the computer screen. The problem is that you can't really scan well across the screen with your eyes while wearing progressives -- instead, you have to turn your head to keep the screen in that intermediate zone, which started to give me neck trouble. The computer glasses took care of that as well, since the whole lens is at the correct focus for the computer screen and you can scan with your eyes instead of your head.
One last thing. If you do hobbies or work that is really close up, I would recommend an Optivisor or a jeweler's loupe. I used to be able to do fine soldering without one, but I'm in my mid-30s now, and it really helps. And check the ergonomics for your setup. A high bench and a low chair, plus a Optivisor or a loupe, is way easier on the eyes and neck than a high chair and a low bench, which will make you crane your neck to get it closer to the work, and then strain your eyes from focusing so close. Look at a watchmaker at their bench for an example. There are plenty of watchmakers who work on tiny little parts into their 60s and 70s without messing up their vision.