I've always wondered why they didn't just do away with windows and instead have holographic walls that project real time images captured from outside the ship? Surely the overall structure of the ship is slightly compromised by the cavities needed to place windows?
There could be a good psychological reason for having actual windows as opposed to holographic ones. Having real windows may ease any claustrophobic senses one might have and give them a good sense of "connection" with whatever is outside the ship.
I'd also assume the materials and construction methods of the 23rd/24th century would render any structural integrity problems with the windows null. (Not even counting the structural integrity fields of the ship.)
If I were claustrophobic, I would feel better knowing there's a solid unobtanium (duranium, etc) wall between me and cold, deadly vacuum, as opposed to an inevitably frailer window.
And making holes in a structure weakens its structure of resistance, regardless of materials used - the same structure, without windows, will always be more resistant.
Windows on a starship are an anachronism that makes no sense for someone with the federation's optics/holographics technology.